2 ; Ullrich von Bassewitz, 07.04.2000
3 ; Christian Krueger, 12-Mar-2017, added 65SC02 optimization
5 ; CC65 runtime: += operator
7 ; On entry, the low byte of the address of the variable to increment is
8 ; in ptr1, the high byte is in Y, and the increment is in eax.
11 .export laddeq1, laddeqa, laddeq
12 .importzp sreg, ptr1, tmp1
24 laddeq: sty ptr1+1 ; Store high byte of address
27 .if (.cpu .bitand ::CPU_ISET_65SC02)
30 ldy #$01 ; Address byte 1
32 ldy #$00 ; Address low byte
37 pha ; Save byte 0 of result for later
40 adc (ptr1),y ; Load byte 1
56 pla ; Retrieve byte 0 of result