restore comment alignment
This commit is contained in:
@@ -75,11 +75,11 @@ start:
|
||||
lda MEMTOP
|
||||
sbc #<__RESERVED_MEMORY__
|
||||
sta APPMHI ; initialize our APPMHI value
|
||||
sta c_sp ; set up runtime stack part 1
|
||||
sta c_sp ; set up runtime stack part 1
|
||||
lda MEMTOP+1
|
||||
sbc #>__RESERVED_MEMORY__
|
||||
sta APPMHI+1
|
||||
sta c_sp+1 ; set up runtime stack part 2
|
||||
sta c_sp+1 ; set up runtime stack part 2
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ freefnd:txa
|
||||
beq l2
|
||||
|
||||
l1: ldy #0
|
||||
lda (c_sp),y ; get device
|
||||
lda (c_sp),y ; get device
|
||||
l2: sta fd_table+ft_dev,x ; set device
|
||||
lda #1
|
||||
sta fd_table+ft_usa,x ; set usage counter
|
||||
|
||||
@@ -69,7 +69,7 @@ loop2: lda (ptr4),y
|
||||
cmp #'a'
|
||||
bcc L1 ; Not lowercase
|
||||
and #$DF ; make upper case char, assume ASCII chars
|
||||
sta (c_sp),y ; store back
|
||||
sta (c_sp),y ; store back
|
||||
L1:
|
||||
iny
|
||||
bpl loop2 ; bpl: this way we only support a max. length of 127
|
||||
@@ -93,7 +93,7 @@ copy_end:
|
||||
jsr subysp ; adjust stack pointer
|
||||
dey
|
||||
cpdev: lda __defdev,y
|
||||
sta (c_sp),y ; insert device name, number and ':'
|
||||
sta (c_sp),y ; insert device name, number and ':'
|
||||
dey
|
||||
bpl cpdev
|
||||
hasdev2:
|
||||
|
||||
@@ -28,7 +28,7 @@ start:
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ L1: lda c_sp,x
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ L1: lda c_sp,x
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ L1: lda c_sp,x
|
||||
ldy #$80
|
||||
ldx #$00
|
||||
MemOk: stx c_sp
|
||||
sty c_sp+1 ; set argument stack ptr
|
||||
sty c_sp+1 ; set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ L1: lda c_sp,x
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Switch to the second charset.
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
lda (c_sp),y
|
||||
sta ptr1+1
|
||||
adc #0
|
||||
sta (c_sp),y ; ptr1 = buf++;
|
||||
sta (c_sp),y ; ptr1 = buf++;
|
||||
|
||||
; Get the buffered character and place it as first character into the read
|
||||
; buffer.
|
||||
|
||||
@@ -74,6 +74,6 @@ memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0!
|
||||
tax
|
||||
stx ptr2+1 ; save high byte of ptr2
|
||||
dey ; Y = 0
|
||||
lda (c_sp),y ; Get ptr2 low
|
||||
lda (c_sp),y ; Get ptr2 low
|
||||
sta ptr2
|
||||
rts
|
||||
|
||||
@@ -39,7 +39,7 @@ common: ; Fill value is in X!
|
||||
lda (c_sp),y
|
||||
sta ptr1+1 ; save high byte of ptr
|
||||
dey ; Y = 0
|
||||
lda (c_sp),y ; Get ptr
|
||||
lda (c_sp),y ; Get ptr
|
||||
sta ptr1
|
||||
|
||||
lsr ptr3+1 ; divide number of
|
||||
|
||||
@@ -121,12 +121,12 @@ _vfprintf:
|
||||
; exactly as _printf expects it. Parameters will get dropped by _printf.
|
||||
|
||||
ldy #2
|
||||
lda (c_sp),y ; Low byte of f
|
||||
lda (c_sp),y ; Low byte of f
|
||||
sta ptr
|
||||
lda #<outdesc
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda (c_sp),y ; High byte of f
|
||||
lda (c_sp),y ; High byte of f
|
||||
sta ptr+1
|
||||
lda #>outdesc
|
||||
sta (c_sp),y
|
||||
|
||||
@@ -31,7 +31,7 @@ _vscanf:
|
||||
; Move the format down
|
||||
|
||||
ldy #2
|
||||
lda (c_sp),y ; Load byte of format
|
||||
lda (c_sp),y ; Load byte of format
|
||||
ldy #0
|
||||
sta (c_sp),y
|
||||
ldy #3
|
||||
|
||||
@@ -81,7 +81,7 @@ init:
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Switch to the lower/UPPER PetSCII charset.
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
|
||||
_DbgMemDump:
|
||||
ldy #0
|
||||
lda (c_sp),y ; Get length
|
||||
lda (c_sp),y ; Get length
|
||||
sta tmp4
|
||||
iny
|
||||
lda (c_sp),y ; Get the string buffer
|
||||
lda (c_sp),y ; Get the string buffer
|
||||
sta ptr3
|
||||
iny
|
||||
lda (c_sp),y
|
||||
sta ptr3+1
|
||||
iny
|
||||
lda (c_sp),y ; Get the address
|
||||
lda (c_sp),y ; Get the address
|
||||
sta ptr4
|
||||
iny
|
||||
lda (c_sp),y
|
||||
|
||||
@@ -108,7 +108,7 @@ start:
|
||||
lda #<(__SRAM_START__ + __SRAM_SIZE__)
|
||||
ldx #>(__SRAM_START__ + __SRAM_SIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -86,9 +86,9 @@ memcpy_getparams:
|
||||
; (Direct stack access is six cycles faster [total cycle count].)
|
||||
|
||||
iny ; (Y=0 by popptr1, need '1' here) save dest
|
||||
lda (c_sp),y ; get high byte
|
||||
lda (c_sp),y ; get high byte
|
||||
tax
|
||||
lda (c_sp) ; get low byte
|
||||
lda (c_sp) ; get low byte
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
rts ; return dest address (for memmove)
|
||||
|
||||
@@ -54,7 +54,7 @@ L1: lda c_sp,x
|
||||
lda MEMSIZE
|
||||
sta c_sp
|
||||
lda MEMSIZE+1
|
||||
sta c_sp+1 ; Set argument stack ptr
|
||||
sta c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
.else
|
||||
.error Unknown CPU type.
|
||||
.endif
|
||||
.byte c_sp ; c_sp address
|
||||
.byte c_sp ; c_sp address
|
||||
.addr __MAIN_START__ ; load address
|
||||
.addr startup ; reset address
|
||||
|
||||
@@ -34,7 +34,7 @@ reset:
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
jsr initlib
|
||||
jsr _main
|
||||
_exit: jsr donelib
|
||||
|
||||
@@ -75,7 +75,7 @@ L1: lda c_sp,x
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ L1: lda c_sp,x
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user