Skip to content

Commit 4fd88ad

Browse files
committed
fix wrong jump in error case, optimize table access, 147 bytes
1 parent 77a6f48 commit 4fd88ad

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

test/pinmode/pinmode-asm.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ __asm
3939
clrw x
4040
ld a, (3, sp)
4141
ld xl, a
42+
pushw x
4243
addw x, #(_digital_pin_to_bit_mask_PGM + 0)
4344
ld a, (x)
4445
ld yl,a ; yl = bit
@@ -51,12 +52,10 @@ __asm
5152
; pinmode-c.c: 10: uint8_t port = digitalPinToPort(pin);
5253
; pinmode-c.c: 13: if (port == NOT_A_PORT) return;
5354
; es könnte auch subw x, #(NUM_DIGITAL_PINS) sein
54-
clrw x
55-
ld a, (3, sp)
56-
ld xl, a
55+
popw x
5756
addw x, #(_digital_pin_to_port_PGM + 0)
5857
ld a, (x) ; port-ID. Z-Flag wird gesetzt
59-
jreq 010$
58+
jreq 032$ ; if (port == NOT_A_PORT) return;
6059

6160

6261
;
@@ -119,7 +118,7 @@ __asm
119118
BIT_CLEAR(CR2)
120119
BIT_SET(DDR)
121120
rim
122-
ret
121+
032$: ret
123122

124123
;
125124
; case INPUT // 0: input, floating

0 commit comments

Comments
 (0)