File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ ; Ralph Doncaster public domain AVR assembler macros
12
23.macro GLABEL name
34 .global \name
45 \name:
56.endm
7+
8+ ; in/out require an io register at address < 0x40
9+ .macro LOAD rd, ioreg
10+ .if \ioreg > 0x3F
11+ lds \rd, \ioreg
12+ .else
13+ in \rd, \ioreg
14+ .endif
15+ .endm
16+
17+ .macro STORE ioreg, rr
18+ .if \ioreg > 0x3F
19+ sts \ioreg, \rr
20+ .else
21+ out \ioreg, \rr
22+ .endif
23+ .endm
24+
25+ ; example: X_ldiw 24, 12345
26+ .macro X_ldiw rd, K
27+ ldi \rd, lo8(\K)
28+ ldi (\rd)+1, hi8(\K)
29+ .endm
30+
Original file line number Diff line number Diff line change 1010GLABEL millis_impl
1111 ldi ZL, lo8(t0_millis)
1212 ldi ZH, hi8(t0_millis)
13+ ; X_ldiw 30 , t0_millis ; Z = t0_millis
1314 _reload:
1415 ld r22, Z
1516 ldd r23, Z+1
You can’t perform that action at this time.
0 commit comments