oops! replace phx/plx 65C02 (cx16) instructions by 6502 (c64) compatible alternative.

Couldn't assemble code that used some of the routines in conv on c64 before...
This commit is contained in:
Irmen de Jong 2021-11-22 21:02:43 +01:00
parent e86246a985
commit e08871c637

View File

@ -12,14 +12,14 @@ conv {
asmsub str_ub0 (ubyte value @ A) clobbers(A,Y) {
; ---- convert the ubyte in A in decimal string form, with left padding 0s (3 positions total)
%asm {{
phx
stx P8ZP_SCRATCH_REG
jsr conv.ubyte2decimal
sty string_out
sta string_out+1
stx string_out+2
lda #0
sta string_out+3
plx
ldx P8ZP_SCRATCH_REG
rts
}}
}
@ -27,7 +27,7 @@ asmsub str_ub0 (ubyte value @ A) clobbers(A,Y) {
asmsub str_ub (ubyte value @ A) clobbers(A,Y) {
; ---- convert the ubyte in A in decimal string form, without left padding 0s
%asm {{
phx
stx P8ZP_SCRATCH_REG
ldy #0
sty P8ZP_SCRATCH_B1
jsr conv.ubyte2decimal
@ -53,7 +53,7 @@ _output_byte_digits
iny
lda #0
sta string_out,y
plx
ldx P8ZP_SCRATCH_REG
rts
}}
}
@ -61,7 +61,7 @@ _output_byte_digits
asmsub str_b (byte value @ A) clobbers(A,Y) {
; ---- convert the byte in A in decimal string form, without left padding 0s
%asm {{
phx
stx P8ZP_SCRATCH_REG
ldy #0
sty P8ZP_SCRATCH_B1
cmp #0
@ -149,7 +149,7 @@ asmsub str_uwhex (uword value @ AY) clobbers(A,Y) {
asmsub str_uw0 (uword value @ AY) clobbers(A,Y) {
; ---- convert the uword in A/Y in decimal string form, with left padding 0s (5 positions total)
%asm {{
phx
stx P8ZP_SCRATCH_REG
jsr conv.uword2decimal
ldy #0
- lda conv.uword2decimal.decTenThousands,y
@ -157,7 +157,7 @@ asmsub str_uw0 (uword value @ AY) clobbers(A,Y) {
beq +
iny
bne -
+ plx
+ ldx P8ZP_SCRATCH_REG
rts
}}
}
@ -165,7 +165,7 @@ asmsub str_uw0 (uword value @ AY) clobbers(A,Y) {
asmsub str_uw (uword value @ AY) clobbers(A,Y) {
; ---- convert the uword in A/Y in decimal string form, without left padding 0s
%asm {{
phx
stx P8ZP_SCRATCH_REG
jsr conv.uword2decimal
ldx #0
_output_digits
@ -183,7 +183,7 @@ _gotdigit sta string_out,x
bne _gotdigit
_end lda #0
sta string_out,x
plx
ldx P8ZP_SCRATCH_REG
rts
_allzero lda #'0'
@ -198,7 +198,7 @@ asmsub str_w (word value @ AY) clobbers(A,Y) {
%asm {{
cpy #0
bpl str_uw
phx
stx P8ZP_SCRATCH_REG
pha
lda #'-'
sta string_out