restore comment alignment
This commit is contained in:
@@ -20,34 +20,34 @@ tosaddax:
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
|
||||
adc (c_sp) ; (7)
|
||||
adc (c_sp) ; (7)
|
||||
tay ; (9)
|
||||
inc c_sp ; (14)
|
||||
inc c_sp ; (14)
|
||||
bne hiadd ; (17)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
hiadd: txa ; (19)
|
||||
adc (c_sp) ; (24)
|
||||
adc (c_sp) ; (24)
|
||||
tax ; (26)
|
||||
inc c_sp ; (31)
|
||||
inc c_sp ; (31)
|
||||
bne done ; (34)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
done: tya ; (36)
|
||||
|
||||
.else
|
||||
|
||||
ldy #0 ; (4)
|
||||
adc (c_sp),y ; (9) lo byte
|
||||
adc (c_sp),y ; (9) lo byte
|
||||
iny ; (11)
|
||||
sta tmp1 ; (14) save it
|
||||
txa ; (16)
|
||||
adc (c_sp),y ; (21) hi byte
|
||||
adc (c_sp),y ; (21) hi byte
|
||||
tax ; (23)
|
||||
clc ; (25)
|
||||
lda c_sp ; (28)
|
||||
lda c_sp ; (28)
|
||||
adc #2 ; (30)
|
||||
sta c_sp ; (33)
|
||||
sta c_sp ; (33)
|
||||
bcc L1 ; (36)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
inc c_sp+1 ; (-1+5)
|
||||
L1: lda tmp1 ; (39) restore low byte
|
||||
|
||||
.endif
|
||||
|
||||
@@ -12,10 +12,10 @@ addysp1:
|
||||
addysp: pha ; Save A
|
||||
clc
|
||||
tya ; Get the value
|
||||
adc c_sp ; Add low byte
|
||||
sta c_sp ; Put it back
|
||||
adc c_sp ; Add low byte
|
||||
sta c_sp ; Put it back
|
||||
bcc @L1 ; If no carry, we're done
|
||||
inc c_sp+1 ; Inc high byte
|
||||
inc c_sp+1 ; Inc high byte
|
||||
@L1: pla ; Restore A
|
||||
rts
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ tosanda0:
|
||||
ldx #$00
|
||||
tosandax:
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
and (c_sp) ; 65SC02 version, saves 2 cycles and 1 byte
|
||||
and (c_sp) ; 65SC02 version, saves 2 cycles and 1 byte
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
|
||||
@@ -13,6 +13,6 @@ enter: tya ; get arg size
|
||||
dec c_sp+1
|
||||
L1: dec c_sp
|
||||
ldy #0
|
||||
sta (c_sp),y ; Store the arg count
|
||||
sta (c_sp),y ; Store the arg count
|
||||
rts
|
||||
|
||||
|
||||
@@ -17,16 +17,16 @@ tosicmp:
|
||||
stx sreg+1 ; Save ax
|
||||
|
||||
ldy #$00
|
||||
lda (c_sp),y ; Get low byte
|
||||
lda (c_sp),y ; Get low byte
|
||||
tax
|
||||
inc c_sp ; 5
|
||||
inc c_sp ; 5
|
||||
bne @L1 ; 3
|
||||
inc c_sp+1 ; (5)
|
||||
inc c_sp+1 ; (5)
|
||||
@L1:
|
||||
lda (c_sp),y ; Get high byte
|
||||
inc c_sp ; 5
|
||||
lda (c_sp),y ; Get high byte
|
||||
inc c_sp ; 5
|
||||
bne @L2 ; 3
|
||||
inc c_sp+1 ; (5)
|
||||
inc c_sp+1 ; (5)
|
||||
|
||||
; Do the compare.
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
.proc popax
|
||||
|
||||
ldy #1
|
||||
lda (c_sp),y ; get hi byte
|
||||
lda (c_sp),y ; get hi byte
|
||||
tax ; into x
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (c_sp) ; get lo byte
|
||||
lda (c_sp) ; get lo byte
|
||||
.else
|
||||
dey
|
||||
lda (c_sp),y ; get lo byte
|
||||
lda (c_sp),y ; get lo byte
|
||||
.endif
|
||||
|
||||
.endproc
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
.proc incsp2
|
||||
|
||||
inc c_sp ; 5
|
||||
inc c_sp ; 5
|
||||
beq @L1 ; 2
|
||||
inc c_sp ; 5
|
||||
inc c_sp ; 5
|
||||
beq @L2 ; 2
|
||||
rts
|
||||
|
||||
@L1: inc c_sp ; 5
|
||||
@L2: inc c_sp+1 ; 5
|
||||
@L1: inc c_sp ; 5
|
||||
@L2: inc c_sp+1 ; 5
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -20,24 +20,24 @@ tosadd0ax:
|
||||
tosaddeax:
|
||||
clc
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
adc (c_sp) ; 65SC02 version - saves 2 cycles
|
||||
adc (c_sp) ; 65SC02 version - saves 2 cycles
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
adc (c_sp),y ; lo byte
|
||||
adc (c_sp),y ; lo byte
|
||||
iny
|
||||
.endif
|
||||
sta tmp1 ; use as temp storage
|
||||
txa
|
||||
adc (c_sp),y ; byte 1
|
||||
adc (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda sreg
|
||||
adc (c_sp),y ; byte 2
|
||||
adc (c_sp),y ; byte 2
|
||||
sta sreg
|
||||
iny
|
||||
lda sreg+1
|
||||
adc (c_sp),y ; byte 3
|
||||
adc (c_sp),y ; byte 3
|
||||
sta sreg+1
|
||||
lda tmp1 ; load byte 0
|
||||
jmp addysp1 ; drop TOS
|
||||
|
||||
@@ -23,24 +23,24 @@ tosand0ax:
|
||||
|
||||
tosandeax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
and (c_sp) ; byte 0
|
||||
and (c_sp) ; byte 0
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
and (c_sp),y ; byte 0
|
||||
and (c_sp),y ; byte 0
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
and (c_sp),y ; byte 1
|
||||
and (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda sreg
|
||||
and (c_sp),y ; byte 2
|
||||
and (c_sp),y ; byte 2
|
||||
sta sreg
|
||||
iny
|
||||
lda sreg+1
|
||||
and (c_sp),y ; byte 3
|
||||
and (c_sp),y ; byte 3
|
||||
sta sreg+1
|
||||
|
||||
lda tmp1
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
ldax0sp:
|
||||
ldy #1
|
||||
ldaxysp:
|
||||
lda (c_sp),y ; get high byte
|
||||
lda (c_sp),y ; get high byte
|
||||
tax ; and save it
|
||||
dey ; point to lo byte
|
||||
lda (c_sp),y ; load low byte
|
||||
lda (c_sp),y ; load low byte
|
||||
rts
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ leavey:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
|
||||
leave: tay ; save A a sec
|
||||
lda (c_sp) ; that's the pushed arg size
|
||||
lda (c_sp) ; that's the pushed arg size
|
||||
sec ; Count the byte, the count's stored in
|
||||
adc c_sp
|
||||
sta c_sp
|
||||
@@ -43,7 +43,7 @@ L1: tya ; Get return value back
|
||||
|
||||
leave: pha ; save A a sec
|
||||
ldy #0
|
||||
lda (c_sp),y ; that's the pushed arg size
|
||||
lda (c_sp),y ; that's the pushed arg size
|
||||
sec ; Count the byte, the count's stored in
|
||||
adc c_sp
|
||||
sta c_sp
|
||||
|
||||
@@ -27,20 +27,20 @@ tosoreax:
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
ora (c_sp),y ; byte 0
|
||||
ora (c_sp),y ; byte 0
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
ora (c_sp),y ; byte 1
|
||||
ora (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda sreg
|
||||
ora (c_sp),y ; byte 2
|
||||
ora (c_sp),y ; byte 2
|
||||
sta sreg
|
||||
iny
|
||||
lda sreg+1
|
||||
ora (c_sp),y ; byte 3
|
||||
ora (c_sp),y ; byte 3
|
||||
sta sreg+1
|
||||
|
||||
lda tmp1
|
||||
|
||||
@@ -31,20 +31,20 @@ tosrsubeax:
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
sbc (c_sp),y ; byte 0
|
||||
sbc (c_sp),y ; byte 0
|
||||
iny
|
||||
.endif
|
||||
sta tmp1 ; use as temp storage
|
||||
txa
|
||||
sbc (c_sp),y ; byte 1
|
||||
sbc (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda sreg
|
||||
sbc (c_sp),y ; byte 2
|
||||
sbc (c_sp),y ; byte 2
|
||||
sta sreg
|
||||
iny
|
||||
lda sreg+1
|
||||
sbc (c_sp),y ; byte 3
|
||||
sbc (c_sp),y ; byte 3
|
||||
sta sreg+1
|
||||
lda tmp1
|
||||
jmp addysp1 ; drop TOS
|
||||
|
||||
@@ -27,17 +27,17 @@ tossubeax:
|
||||
sec
|
||||
eor #$FF
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
adc (c_sp) ; 65SC02 version - saves 2 cycles
|
||||
adc (c_sp) ; 65SC02 version - saves 2 cycles
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
adc (c_sp),y ; lo byte
|
||||
adc (c_sp),y ; lo byte
|
||||
iny
|
||||
.endif
|
||||
pha ; Save low byte
|
||||
txa
|
||||
eor #$FF
|
||||
adc (c_sp),y ; byte 1
|
||||
adc (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda (c_sp),y
|
||||
|
||||
@@ -23,24 +23,24 @@ tosxor0ax:
|
||||
|
||||
tosxoreax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
eor (c_sp) ; byte 0
|
||||
eor (c_sp) ; byte 0
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
eor (c_sp),y ; byte 0
|
||||
eor (c_sp),y ; byte 0
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
eor (c_sp),y ; byte 1
|
||||
eor (c_sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
lda sreg
|
||||
eor (c_sp),y ; byte 2
|
||||
eor (c_sp),y ; byte 2
|
||||
sta sreg
|
||||
iny
|
||||
lda sreg+1
|
||||
eor (c_sp),y ; byte 3
|
||||
eor (c_sp),y ; byte 3
|
||||
sta sreg+1
|
||||
|
||||
lda tmp1
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
lda (c_sp)
|
||||
.else
|
||||
ldy #0 ; (2)
|
||||
lda (c_sp),y ; (7) Read byte
|
||||
lda (c_sp),y ; (7) Read byte
|
||||
.endif
|
||||
inc c_sp ; (12)
|
||||
inc c_sp ; (12)
|
||||
beq @L1 ; (14)
|
||||
rts ; (20)
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
.proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved)
|
||||
ldy #1
|
||||
lda (c_sp),y ; get hi byte
|
||||
lda (c_sp),y ; get hi byte
|
||||
sta ptr1+1 ; into ptr hi
|
||||
dey ; dey even for for 65C02 here to have Y=0 at exit!
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (c_sp) ; get lo byte
|
||||
lda (c_sp) ; get lo byte
|
||||
.else
|
||||
lda (c_sp),y ; get lo byte
|
||||
lda (c_sp),y ; get lo byte
|
||||
.endif
|
||||
sta ptr1 ; to ptr lo
|
||||
jmp incsp2
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
popsreg:
|
||||
pha ; save A
|
||||
ldy #1
|
||||
lda (c_sp),y ; get hi byte
|
||||
lda (c_sp),y ; get hi byte
|
||||
sta sreg+1 ; store it
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (c_sp) ; get lo byte
|
||||
lda (c_sp) ; get lo byte
|
||||
.else
|
||||
dey
|
||||
lda (c_sp),y ; get lo byte
|
||||
lda (c_sp),y ; get lo byte
|
||||
.endif
|
||||
sta sreg ; store it
|
||||
pla ; get A back
|
||||
|
||||
@@ -15,15 +15,15 @@ pusha0sp:
|
||||
ldy #$00
|
||||
pushaysp:
|
||||
lda (c_sp),y
|
||||
pusha: ldy c_sp ; (3)
|
||||
pusha: ldy c_sp ; (3)
|
||||
beq @L1 ; (6)
|
||||
dec c_sp ; (11)
|
||||
dec c_sp ; (11)
|
||||
ldy #0 ; (13)
|
||||
sta (c_sp),y ; (19)
|
||||
sta (c_sp),y ; (19)
|
||||
rts ; (25)
|
||||
|
||||
@L1: dec c_sp+1 ; (11)
|
||||
dec c_sp ; (16)
|
||||
sta (c_sp),y ; (22)
|
||||
@L1: dec c_sp+1 ; (11)
|
||||
dec c_sp ; (16)
|
||||
sta (c_sp),y ; (22)
|
||||
rts ; (28)
|
||||
|
||||
|
||||
@@ -20,21 +20,21 @@ pusha0: ldx #0
|
||||
.proc pushax
|
||||
|
||||
pha ; (3)
|
||||
lda c_sp ; (6)
|
||||
lda c_sp ; (6)
|
||||
sec ; (8)
|
||||
sbc #2 ; (10)
|
||||
sta c_sp ; (13)
|
||||
sta c_sp ; (13)
|
||||
bcs @L1 ; (17)
|
||||
dec c_sp+1 ; (+5)
|
||||
dec c_sp+1 ; (+5)
|
||||
@L1: ldy #1 ; (19)
|
||||
txa ; (21)
|
||||
sta (c_sp),y ; (27)
|
||||
sta (c_sp),y ; (27)
|
||||
pla ; (31)
|
||||
dey ; (33)
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
sta (c_sp) ; (37)
|
||||
sta (c_sp) ; (37)
|
||||
.else
|
||||
sta (c_sp),y ; (38)
|
||||
sta (c_sp),y ; (38)
|
||||
.endif
|
||||
rts ; (44/43)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
pushbsp:
|
||||
ldy #0
|
||||
pushbysp:
|
||||
lda (c_sp),y ; get lo byte
|
||||
lda (c_sp),y ; get lo byte
|
||||
jmp pusha0 ; promote to unsigned and push
|
||||
|
||||
|
||||
|
||||
@@ -12,20 +12,20 @@
|
||||
pushw0sp:
|
||||
ldy #3
|
||||
pushwysp:
|
||||
lda c_sp ; 3
|
||||
lda c_sp ; 3
|
||||
sub #2 ; 4
|
||||
sta c_sp ; 3
|
||||
sta c_sp ; 3
|
||||
bcs @L1 ; 3(+1)
|
||||
dec c_sp+1 ; (5)
|
||||
@L1: lda (c_sp),y ; 5 =16
|
||||
dec c_sp+1 ; (5)
|
||||
@L1: lda (c_sp),y ; 5 =16
|
||||
tax ; 2
|
||||
dey ; 2
|
||||
lda (c_sp),y ; 5
|
||||
lda (c_sp),y ; 5
|
||||
ldy #$00 ; 2
|
||||
sta (c_sp),y ; 5
|
||||
sta (c_sp),y ; 5
|
||||
iny ; 2
|
||||
txa ; 2
|
||||
sta (c_sp),y ; 5
|
||||
sta (c_sp),y ; 5
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
sta tmp1 ; Store count
|
||||
@L1: lda regbank,x ; Get old value
|
||||
pha ; Save it
|
||||
lda (c_sp),y ; Get stack loc
|
||||
lda (c_sp),y ; Get stack loc
|
||||
sta regbank,x ; Store new value
|
||||
pla
|
||||
sta (c_sp),y ; Store old value
|
||||
sta (c_sp),y ; Store old value
|
||||
inx
|
||||
iny
|
||||
dec tmp1
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
lda regbank,x ; Get old value
|
||||
pha ; Save it
|
||||
lda (c_sp),y ; Get stack loc
|
||||
lda (c_sp),y ; Get stack loc
|
||||
sta regbank,x ; Store new value
|
||||
pla
|
||||
sta (c_sp),y ; Store old value
|
||||
sta (c_sp),y ; Store old value
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
|
||||
lda regbank,x ; Get old value
|
||||
pha ; Save it
|
||||
lda (c_sp),y ; Get stack loc
|
||||
lda (c_sp),y ; Get stack loc
|
||||
sta regbank,x ; Store new value
|
||||
pla
|
||||
sta (c_sp),y ; Store old value
|
||||
sta (c_sp),y ; Store old value
|
||||
|
||||
; Second byte
|
||||
|
||||
iny
|
||||
lda regbank+1,x ; Get old value
|
||||
pha ; Save it
|
||||
lda (c_sp),y ; Get stack loc
|
||||
lda (c_sp),y ; Get stack loc
|
||||
sta regbank+1,x ; Store new value
|
||||
pla
|
||||
sta (c_sp),y ; Store old value
|
||||
sta (c_sp),y ; Store old value
|
||||
|
||||
rts
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ tosrsubax:
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
sbc (c_sp),y ; lo byte
|
||||
sbc (c_sp),y ; lo byte
|
||||
iny
|
||||
.endif
|
||||
sta tmp1 ; save lo byte
|
||||
txa
|
||||
sbc (c_sp),y ; hi byte
|
||||
sbc (c_sp),y ; hi byte
|
||||
tax
|
||||
lda tmp1
|
||||
jmp addysp1 ; drop TOS, set condition codes
|
||||
|
||||
@@ -22,13 +22,13 @@ tossubax:
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
adc (c_sp),y ; Subtract low byte
|
||||
adc (c_sp),y ; Subtract low byte
|
||||
iny
|
||||
.endif
|
||||
pha ; Save high byte
|
||||
txa
|
||||
eor #$FF
|
||||
adc (c_sp),y ; Subtract high byte
|
||||
adc (c_sp),y ; Subtract high byte
|
||||
tax ; High byte into X
|
||||
pla ; Restore low byte
|
||||
jmp addysp1 ; drop TOS
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
lda (c_sp)
|
||||
.else
|
||||
ldy #0
|
||||
lda (c_sp),y ; c_sp+1
|
||||
lda (c_sp),y ; c_sp+1
|
||||
.endif
|
||||
ldy #2
|
||||
sta (c_sp),y
|
||||
|
||||
@@ -18,7 +18,7 @@ tosulong:
|
||||
ldy #2
|
||||
lda (c_sp),y
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
sta (c_sp) ; 65C02 version
|
||||
sta (c_sp) ; 65C02 version
|
||||
iny ; Y = 3
|
||||
.else
|
||||
ldy #0
|
||||
@@ -44,7 +44,7 @@ toslong:
|
||||
ldy #2
|
||||
lda (c_sp),y
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
sta (c_sp) ; 65C02 version
|
||||
sta (c_sp) ; 65C02 version
|
||||
iny ; Y = 3
|
||||
.else
|
||||
ldy #0
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
.zeropage
|
||||
|
||||
c_sp: .res 2 ; Stack pointer
|
||||
c_sp: .res 2 ; Stack pointer
|
||||
sreg: .res 2 ; Secondary register/high 16 bit for longs
|
||||
regsave: .res 4 ; Slot to save/restore (E)AX into
|
||||
ptr1: .res 2
|
||||
|
||||
Reference in New Issue
Block a user