1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 15:05:14 +00:00
cc65/libsrc/runtime/sub.s
cuz 6cbd32b49d Some more 6502 code
git-svn-id: svn://svn.cc65.org/cc65/trunk@485 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-11-27 23:37:53 +00:00

37 lines
494 B
ArmAsm

;
; Ullrich von Bassewitz, 05.08.1998
;
; CC65 runtime: sub ints
;
.export tossuba0, tossubax
.import addysp1
.importzp sp, ptr1
;
; AX = TOS - AX
;
tossuba0:
ldx #0
tossubax:
sta ptr1
stx ptr1+1
.ifpc02
lda (sp),y ; Get lo byte
ldy #1 ; Hi index
.else
ldy #0
lda (sp),y ; Lo byte
iny ; Hi index
.endif
sec
sbc ptr1
sta ptr1 ; save lo byte
lda (sp),y
sbc ptr1+1
tax
lda ptr1
jmp addysp1 ; drop TOS, set condition codes