1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 06:30:16 +00:00
cc65/libsrc/runtime/ldec.s
2018-03-09 18:48:24 +01:00

37 lines
551 B
ArmAsm

;
; Piotr Fusik, 09.03.2018
; originally by Ullrich von Bassewitz
;
; CC65 runtime: Decrement eax by value in Y
;
.export deceaxy
.importzp sreg, tmp1
deceaxy:
sty tmp1
sec
sbc tmp1
bcs @L9
; Borrow from X.
dex
cpx #$FF
bne @L9
; X wrapped from zero to $FF, borrow from sreg.
dec sreg
cpx sreg
bne @L9
; sreg wrapped from zero to $FF, borrow from sreg+1.
dec sreg+1
; Done.
@L9: rts