few 6502 and some 65SC02 optimizations
This commit is contained in:
parent
0ec4534bd6
commit
0de44517ac
23 changed files with 272 additions and 78 deletions
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, spend two bytes for one cycle, improved 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: add ints
|
||||
;
|
||||
|
@ -8,32 +9,46 @@
|
|||
; called a lot!
|
||||
|
||||
.export tosadda0, tosaddax
|
||||
.importzp sp
|
||||
.importzp sp, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosadda0:
|
||||
ldx #0
|
||||
tosaddax:
|
||||
clc
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
adc (sp) ; 65SC02 version - saves 2 cycles
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
adc (sp),y ; lo byte
|
||||
iny
|
||||
.endif
|
||||
pha ; save it
|
||||
txa
|
||||
adc (sp),y ; hi byte
|
||||
tax
|
||||
clc
|
||||
lda sp
|
||||
adc #2
|
||||
sta sp
|
||||
bcc L1
|
||||
inc sp+1
|
||||
L1: pla ; Restore low byte
|
||||
rts
|
||||
clc ; (2)
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
|
||||
adc (sp) ; (7)
|
||||
tay ; (9)
|
||||
inc sp ; (14)
|
||||
bne hiadd ; (17)
|
||||
inc sp+1 ; (-1+5)
|
||||
hiadd: txa ; (19)
|
||||
adc (sp) ; (24)
|
||||
tax ; (26)
|
||||
inc sp ; (31)
|
||||
bne done ; (34)
|
||||
inc sp+1 ; (-1+5)
|
||||
done: tya ; (36)
|
||||
|
||||
.else
|
||||
|
||||
ldy #0 ; (4)
|
||||
adc (sp),y ; (9) lo byte
|
||||
iny ; (11)
|
||||
sta tmp1 ; (14) save it
|
||||
txa ; (16)
|
||||
adc (sp),y ; (21) hi byte
|
||||
tax ; (23)
|
||||
clc ; (25)
|
||||
lda sp ; (28)
|
||||
adc #2 ; (30)
|
||||
sta sp ; (33)
|
||||
bcc L1 ; (36)
|
||||
inc sp+1 ; (-1+5)
|
||||
L1: lda tmp1 ; (39) restore low byte
|
||||
|
||||
.endif
|
||||
rts ; (6502: 45 cycles, 26 bytes <-> 65SC02: 42 cycles, 22 bytes )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 23.11.2002
|
||||
; Christian Krueger, 11-Mar-2017, saved 5 bytes
|
||||
;
|
||||
; CC65 runtime: Convert char in ax into a long
|
||||
;
|
||||
|
@ -9,16 +10,12 @@
|
|||
|
||||
; Convert A from char to long in EAX
|
||||
|
||||
along: ldx #$ff
|
||||
cmp #$80 ; Positive?
|
||||
bcs store ; no, apply $FF
|
||||
|
||||
aulong: ldx #0
|
||||
stx sreg
|
||||
store: stx sreg
|
||||
stx sreg+1
|
||||
rts
|
||||
|
||||
along: cmp #$80 ; Positive?
|
||||
bcc aulong ; Yes, handle like unsigned type
|
||||
ldx #$ff
|
||||
stx sreg
|
||||
stx sreg+1
|
||||
rts
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 07.04.2000
|
||||
; Christian Krueger, 12-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: += operator
|
||||
;
|
||||
|
@ -10,6 +11,7 @@
|
|||
.export laddeq1, laddeqa, laddeq
|
||||
.importzp sreg, ptr1, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
laddeq1:
|
||||
lda #$01
|
||||
|
@ -20,14 +22,20 @@ laddeqa:
|
|||
stx sreg+1
|
||||
|
||||
laddeq: sty ptr1+1 ; Store high byte of address
|
||||
ldy #$00 ; Address low byte
|
||||
clc
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
adc (ptr1)
|
||||
sta (ptr1)
|
||||
ldy #$01 ; Address byte 1
|
||||
.else
|
||||
ldy #$00 ; Address low byte
|
||||
adc (ptr1),y
|
||||
sta (ptr1),y
|
||||
iny ; Address byte 1
|
||||
.endif
|
||||
pha ; Save byte 0 of result for later
|
||||
|
||||
iny ; Address byte 1
|
||||
txa
|
||||
adc (ptr1),y ; Load byte 1
|
||||
sta (ptr1),y
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: and on longs
|
||||
;
|
||||
|
@ -8,17 +9,28 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosand0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosandeax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
and (sp) ; byte 0
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
and (sp),y ; byte 0
|
||||
sta tmp1
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
and (sp),y ; byte 1
|
||||
tax
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: function epilogue
|
||||
;
|
||||
|
@ -13,6 +14,8 @@
|
|||
.import addysp
|
||||
.importzp sp
|
||||
|
||||
.macpack cpu
|
||||
|
||||
leave00:
|
||||
lda #0
|
||||
leave0: ldx #0
|
||||
|
@ -24,6 +27,20 @@ leavey0:
|
|||
ldx #0 ; return < 256
|
||||
leavey:
|
||||
jsr addysp ; drop stack frame
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
|
||||
leave: tay ; save A a sec
|
||||
lda (sp) ; that's the pushed arg size
|
||||
sec ; Count the byte, the count's stored in
|
||||
adc sp
|
||||
sta sp
|
||||
bcc L1
|
||||
inc sp+1
|
||||
L1: tya ; Get return value back
|
||||
|
||||
.else
|
||||
|
||||
leave: pha ; save A a sec
|
||||
ldy #0
|
||||
lda (sp),y ; that's the pushed arg size
|
||||
|
@ -33,5 +50,7 @@ leave: pha ; save A a sec
|
|||
bcc L1
|
||||
inc sp+1
|
||||
L1: pla ; Get return value back
|
||||
|
||||
.endif
|
||||
rts
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 07.08.1998
|
||||
;
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
; CC65 runtime: modulo operation for long signed ints
|
||||
;
|
||||
|
||||
|
@ -11,10 +11,17 @@
|
|||
.import poplsargs, udiv32, negeax
|
||||
.importzp sreg, ptr1, ptr2, tmp1, tmp3, tmp4
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosmod0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosmodeax:
|
||||
jsr poplsargs ; Get arguments from stack, adjust sign
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 13.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: multiplication for long (unsigned) ints
|
||||
;
|
||||
|
@ -8,20 +9,32 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosmul0ax:
|
||||
tosumul0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosmuleax:
|
||||
tosumuleax:
|
||||
mul32: sta ptr1
|
||||
stx ptr1+1 ; op2 now in ptr1/sreg
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
lda (sp),y
|
||||
sta ptr3
|
||||
iny
|
||||
.endif
|
||||
sta ptr3
|
||||
lda (sp),y
|
||||
sta ptr3+1
|
||||
iny
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: or on longs
|
||||
;
|
||||
|
@ -8,17 +9,28 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosor0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosoreax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
ora (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
ora (sp),y ; byte 0
|
||||
sta tmp1
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
ora (sp),y ; byte 1
|
||||
tax
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 29.12.1999
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: long pop
|
||||
;
|
||||
|
@ -8,6 +9,7 @@
|
|||
.import incsp4
|
||||
.importzp sp, sreg
|
||||
|
||||
.macpack cpu
|
||||
|
||||
popeax: ldy #3
|
||||
lda (sp),y
|
||||
|
@ -18,8 +20,12 @@ popeax: ldy #3
|
|||
dey
|
||||
lda (sp),y
|
||||
tax
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
.else
|
||||
dey
|
||||
lda (sp),y
|
||||
.endif
|
||||
jmp incsp4
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: long push
|
||||
;
|
||||
|
@ -11,13 +12,20 @@
|
|||
.import decsp4
|
||||
.importzp sp, sreg
|
||||
|
||||
.macpack cpu
|
||||
|
||||
pushl0:
|
||||
lda #0
|
||||
tax
|
||||
push0ax:
|
||||
ldy #0
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
pusheax:
|
||||
pha ; decsp will destroy A (but not X)
|
||||
jsr decsp4
|
||||
|
@ -30,8 +38,12 @@ pusheax:
|
|||
dey
|
||||
txa
|
||||
sta (sp),y
|
||||
dey
|
||||
pla
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
sta (sp)
|
||||
.else
|
||||
dey
|
||||
sta (sp),y
|
||||
.endif
|
||||
rts
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: long sub reversed
|
||||
;
|
||||
|
@ -11,18 +12,30 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosrsub0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosrsubeax:
|
||||
ldy #0
|
||||
tosrsubeax:
|
||||
sec
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
sbc (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
sbc (sp),y ; byte 0
|
||||
iny
|
||||
.endif
|
||||
sta tmp1 ; use as temp storage
|
||||
txa
|
||||
iny
|
||||
sbc (sp),y ; byte 1
|
||||
tax
|
||||
iny
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, optimization
|
||||
;
|
||||
; CC65 runtime: save ax into temp storage/restore ax from temp storage
|
||||
;
|
||||
|
@ -10,11 +11,10 @@
|
|||
saveeax:
|
||||
sta regsave
|
||||
stx regsave+1
|
||||
lda sreg
|
||||
sta regsave+2
|
||||
lda sreg+1
|
||||
sta regsave+3
|
||||
lda regsave
|
||||
ldy sreg
|
||||
sty regsave+2
|
||||
ldy sreg+1
|
||||
sty regsave+3
|
||||
rts
|
||||
|
||||
resteax:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
;
|
||||
; Christian Krueger, 11-Mar-2017, ímproved 65SC02 optimization
|
||||
; CC65 runtime: long sub
|
||||
;
|
||||
|
||||
|
@ -14,14 +14,19 @@
|
|||
.macpack cpu
|
||||
|
||||
tossub0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tossubeax:
|
||||
sec
|
||||
eor #$FF
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
adc (sp) ; 65SC02 version - saves 2 cycles
|
||||
ldy #1
|
||||
.else
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 07.04.2000
|
||||
; Christian Krueger, 12-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: -= operator
|
||||
;
|
||||
|
@ -10,6 +11,7 @@
|
|||
.export lsubeq1, lsubeqa, lsubeq
|
||||
.importzp sreg, ptr1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
lsubeq1:
|
||||
lda #$01
|
||||
|
@ -20,15 +22,20 @@ lsubeqa:
|
|||
stx sreg+1
|
||||
|
||||
lsubeq: sty ptr1+1 ; Store high byte of address
|
||||
ldy #$00 ; Address low byte
|
||||
|
||||
sec
|
||||
|
||||
eor #$FF
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
adc (ptr1) ; Subtract byte 0
|
||||
sta (ptr1)
|
||||
ldy #$01 ; Address byte 1
|
||||
.else
|
||||
ldy #$00 ; Address low byte
|
||||
adc (ptr1),y ; Subtract byte 0
|
||||
sta (ptr1),y
|
||||
iny ; Address byte 1
|
||||
.endif
|
||||
pha ; Save byte 0 of result for later
|
||||
|
||||
iny ; Address byte 1
|
||||
txa
|
||||
eor #$FF
|
||||
adc (ptr1),y ; Subtract byte 1
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 17.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: division for long unsigned ints
|
||||
;
|
||||
|
@ -8,10 +9,17 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosudiv0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosudiveax:
|
||||
jsr getlop ; Get the paramameters
|
||||
|
@ -30,10 +38,15 @@ getlop: sta ptr3 ; Put right operand in place
|
|||
lda sreg+1
|
||||
sta ptr4+1
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0 ; Put left operand in place
|
||||
lda (sp),y
|
||||
sta ptr1
|
||||
iny
|
||||
.endif
|
||||
sta ptr1
|
||||
lda (sp),y
|
||||
sta ptr1+1
|
||||
iny
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 27.09.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: modulo operation for long unsigned ints
|
||||
;
|
||||
|
@ -8,10 +9,17 @@
|
|||
.import getlop, udiv32
|
||||
.importzp sreg, tmp3, tmp4, ptr2
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosumod0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosumodeax:
|
||||
jsr getlop ; Get the paramameters
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: xor on longs
|
||||
;
|
||||
|
@ -8,16 +9,28 @@
|
|||
.import addysp1
|
||||
.importzp sp, sreg, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosxor0ax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
stz sreg
|
||||
stz sreg+1
|
||||
.else
|
||||
ldy #$00
|
||||
sty sreg
|
||||
sty sreg+1
|
||||
.endif
|
||||
|
||||
tosxoreax:
|
||||
tosxoreax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
eor (sp) ; byte 0
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
eor (sp),y ; byte 0
|
||||
sta tmp1
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
eor (sp),y ; byte 1
|
||||
tax
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.10.1998
|
||||
; Christian Krueger, 11-Mar-2017, optimization
|
||||
;
|
||||
; CC65 runtime: Make boolean according to flags
|
||||
;
|
||||
|
@ -9,14 +10,14 @@
|
|||
|
||||
|
||||
boolne: bne ret1
|
||||
ldx #$00
|
||||
ret0: ldx #$00
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
booleq: beq ret1
|
||||
ldx #$00
|
||||
txa
|
||||
booleq: bne ret0
|
||||
ret1: ldx #$00
|
||||
lda #$01
|
||||
rts
|
||||
|
||||
|
||||
|
@ -44,17 +45,9 @@ boolult:
|
|||
|
||||
|
||||
boolugt:
|
||||
beq L1
|
||||
beq ret0
|
||||
booluge:
|
||||
bcs ret1
|
||||
L1: ldx #$00
|
||||
ldx #$00
|
||||
txa
|
||||
rol a
|
||||
rts
|
||||
|
||||
|
||||
ret1: ldx #$00
|
||||
lda #$01
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: or on ints
|
||||
;
|
||||
|
@ -8,13 +9,20 @@
|
|||
.import addysp1
|
||||
.importzp sp, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosora0:
|
||||
ldx #$00
|
||||
tosorax:
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
ora (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
ora (sp),y
|
||||
sta tmp1
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
ora (sp),y
|
||||
tax
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: sub ints reversed
|
||||
;
|
||||
|
@ -8,6 +9,8 @@
|
|||
.import addysp1
|
||||
.importzp sp, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
;
|
||||
; AX = AX - TOS
|
||||
;
|
||||
|
@ -15,12 +18,17 @@
|
|||
tosrsuba0:
|
||||
ldx #0
|
||||
tosrsubax:
|
||||
ldy #0
|
||||
sec
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
sbc (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
sbc (sp),y ; lo byte
|
||||
iny
|
||||
.endif
|
||||
sta tmp1 ; save lo byte
|
||||
txa
|
||||
iny
|
||||
sbc (sp),y ; hi byte
|
||||
tax
|
||||
lda tmp1
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
; Christian Krueger, 12-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: Store a/x indirect into address at top of stack with index
|
||||
;
|
||||
|
@ -8,6 +9,8 @@
|
|||
.import incsp2
|
||||
.importzp sp, tmp1, ptr1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
.proc staxspidx
|
||||
|
||||
sty tmp1 ; Save Y
|
||||
|
@ -15,8 +18,12 @@
|
|||
ldy #1
|
||||
lda (sp),y
|
||||
sta ptr1+1
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
.else
|
||||
dey
|
||||
lda (sp),y
|
||||
.endif
|
||||
sta ptr1 ; Address now in ptr1
|
||||
ldy tmp1 ; Restore Y
|
||||
iny ; Address high byte
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: swap ax with TOS
|
||||
;
|
||||
|
@ -7,6 +8,8 @@
|
|||
.export swapstk
|
||||
.importzp sp, ptr4
|
||||
|
||||
.macpack cpu
|
||||
|
||||
swapstk:
|
||||
sta ptr4
|
||||
stx ptr4+1
|
||||
|
@ -15,11 +18,18 @@ swapstk:
|
|||
tax
|
||||
lda ptr4+1
|
||||
sta (sp),y
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
tay
|
||||
lda ptr4
|
||||
sta (sp)
|
||||
tya
|
||||
.else
|
||||
dey
|
||||
lda (sp),y
|
||||
pha
|
||||
lda ptr4
|
||||
sta (sp),y
|
||||
pla
|
||||
.endif
|
||||
rts ; whew!
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
|
||||
;
|
||||
; CC65 runtime: xor on ints
|
||||
;
|
||||
|
@ -8,13 +9,20 @@
|
|||
.import addysp1
|
||||
.importzp sp, tmp1
|
||||
|
||||
.macpack cpu
|
||||
|
||||
tosxora0:
|
||||
ldx #$00
|
||||
tosxorax:
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
eor (sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
eor (sp),y
|
||||
sta tmp1
|
||||
iny
|
||||
.endif
|
||||
sta tmp1
|
||||
txa
|
||||
eor (sp),y
|
||||
tax
|
||||
|
|
Loading…
Add table
Reference in a new issue