1
0
mirror of https://github.com/cc65/cc65.git synced 2024-10-31 04:04:49 +00:00
cc65/libsrc/runtime/ldec.s

37 lines
551 B
ArmAsm
Raw Normal View History

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