diff --git a/compiler/res/prog8lib/conv.p8 b/compiler/res/prog8lib/conv.p8 index f9ed355bf..86a2752b6 100644 --- a/compiler/res/prog8lib/conv.p8 +++ b/compiler/res/prog8lib/conv.p8 @@ -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