mirror of
https://github.com/irmen/prog8.git
synced 2024-07-10 23:29:02 +00:00
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:
parent
e86246a985
commit
e08871c637
@ -12,14 +12,14 @@ conv {
|
|||||||
asmsub str_ub0 (ubyte value @ A) clobbers(A,Y) {
|
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)
|
; ---- convert the ubyte in A in decimal string form, with left padding 0s (3 positions total)
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
jsr conv.ubyte2decimal
|
jsr conv.ubyte2decimal
|
||||||
sty string_out
|
sty string_out
|
||||||
sta string_out+1
|
sta string_out+1
|
||||||
stx string_out+2
|
stx string_out+2
|
||||||
lda #0
|
lda #0
|
||||||
sta string_out+3
|
sta string_out+3
|
||||||
plx
|
ldx P8ZP_SCRATCH_REG
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ asmsub str_ub0 (ubyte value @ A) clobbers(A,Y) {
|
|||||||
asmsub str_ub (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
|
; ---- convert the ubyte in A in decimal string form, without left padding 0s
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
ldy #0
|
ldy #0
|
||||||
sty P8ZP_SCRATCH_B1
|
sty P8ZP_SCRATCH_B1
|
||||||
jsr conv.ubyte2decimal
|
jsr conv.ubyte2decimal
|
||||||
@ -53,7 +53,7 @@ _output_byte_digits
|
|||||||
iny
|
iny
|
||||||
lda #0
|
lda #0
|
||||||
sta string_out,y
|
sta string_out,y
|
||||||
plx
|
ldx P8ZP_SCRATCH_REG
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ _output_byte_digits
|
|||||||
asmsub str_b (byte value @ A) clobbers(A,Y) {
|
asmsub str_b (byte value @ A) clobbers(A,Y) {
|
||||||
; ---- convert the byte in A in decimal string form, without left padding 0s
|
; ---- convert the byte in A in decimal string form, without left padding 0s
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
ldy #0
|
ldy #0
|
||||||
sty P8ZP_SCRATCH_B1
|
sty P8ZP_SCRATCH_B1
|
||||||
cmp #0
|
cmp #0
|
||||||
@ -149,7 +149,7 @@ asmsub str_uwhex (uword value @ AY) clobbers(A,Y) {
|
|||||||
asmsub str_uw0 (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)
|
; ---- convert the uword in A/Y in decimal string form, with left padding 0s (5 positions total)
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
jsr conv.uword2decimal
|
jsr conv.uword2decimal
|
||||||
ldy #0
|
ldy #0
|
||||||
- lda conv.uword2decimal.decTenThousands,y
|
- lda conv.uword2decimal.decTenThousands,y
|
||||||
@ -157,7 +157,7 @@ asmsub str_uw0 (uword value @ AY) clobbers(A,Y) {
|
|||||||
beq +
|
beq +
|
||||||
iny
|
iny
|
||||||
bne -
|
bne -
|
||||||
+ plx
|
+ ldx P8ZP_SCRATCH_REG
|
||||||
rts
|
rts
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ asmsub str_uw0 (uword value @ AY) clobbers(A,Y) {
|
|||||||
asmsub str_uw (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
|
; ---- convert the uword in A/Y in decimal string form, without left padding 0s
|
||||||
%asm {{
|
%asm {{
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
jsr conv.uword2decimal
|
jsr conv.uword2decimal
|
||||||
ldx #0
|
ldx #0
|
||||||
_output_digits
|
_output_digits
|
||||||
@ -183,7 +183,7 @@ _gotdigit sta string_out,x
|
|||||||
bne _gotdigit
|
bne _gotdigit
|
||||||
_end lda #0
|
_end lda #0
|
||||||
sta string_out,x
|
sta string_out,x
|
||||||
plx
|
ldx P8ZP_SCRATCH_REG
|
||||||
rts
|
rts
|
||||||
|
|
||||||
_allzero lda #'0'
|
_allzero lda #'0'
|
||||||
@ -198,7 +198,7 @@ asmsub str_w (word value @ AY) clobbers(A,Y) {
|
|||||||
%asm {{
|
%asm {{
|
||||||
cpy #0
|
cpy #0
|
||||||
bpl str_uw
|
bpl str_uw
|
||||||
phx
|
stx P8ZP_SCRATCH_REG
|
||||||
pha
|
pha
|
||||||
lda #'-'
|
lda #'-'
|
||||||
sta string_out
|
sta string_out
|
||||||
|
Loading…
Reference in New Issue
Block a user