Skip to content

Commit 9bb3a72

Browse files
committed
add note about direct memory access
1 parent 8638b9c commit 9bb3a72

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

docs/developer/sdcc.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,26 @@ some registers:
8181
void f(void) __preserves_regs(b, c, iyl, iyh);
8282

8383

84+
#### Direct memory access
85+
86+
To access a memory location without using a pointer variable it is possible
87+
to do things like this:
88+
89+
```c
90+
#define ODR (*((unsigned char *)0x5005))
91+
#define bitSet(value, bit) ((value) |= (1 << (bit)))
92+
93+
void main()
94+
{
95+
96+
bitSet(ODR, 3);
97+
98+
*((unsigned char *) 0x5005) |= 4;
99+
}
100+
```
101+
102+
103+
84104
### Notes on SDCC
85105

86106
The linker `sdld` does not automatically link the object file for main.c if it

0 commit comments

Comments
 (0)