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 decrement is
8 ; in ptr1, the high byte is in Y, and the decrement is in eax.
11 .export lsubeq1, lsubeqa, lsubeq
24 lsubeq: sty ptr1+1 ; Store high byte of address
28 .if (.cpu .bitand ::CPU_ISET_65SC02)
29 adc (ptr1) ; Subtract byte 0
31 ldy #$01 ; Address byte 1
33 ldy #$00 ; Address low byte
34 adc (ptr1),y ; Subtract byte 0
38 pha ; Save byte 0 of result for later
41 adc (ptr1),y ; Subtract byte 1
57 pla ; Retrieve byte 0 of result