2000-05-28 13:40:48 +00:00
|
|
|
;
|
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
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; CC65 runtime: Decrement eax by value in Y
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export deceaxy
|
|
|
|
.importzp sreg, tmp1
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
deceaxy:
|
2013-05-09 11:56:54 +00:00
|
|
|
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
|
2000-05-28 13:40:48 +00:00
|
|
|
|