From a2f25bbee856842a2a0af5639505c203fcd2c95c Mon Sep 17 00:00:00 2001 From: Michaelangel007 Date: Sat, 20 Feb 2016 09:05:00 -0800 Subject: [PATCH] Ver 27 --- printm.s | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/printm.s b/printm.s index 5c44d4a..1e6feed 100644 --- a/printm.s +++ b/printm.s @@ -5,7 +5,7 @@ .feature leading_dot_in_identifiers .PC02 ; 65C02 -/* Version 26 +/* Version 27 printm - a modular micro printf replacement for 65C02 Michael Pohoreski Copyleft {c} Feb, 2016 @@ -716,7 +716,7 @@ PrintDec LDX #5 ; was Y DEY ; $FF - $FD = 2 -@_BCD2Char: ; NOTE: Digits are reversed! +@BCD2Char: ; NOTE: Digits are reversed! LDA _bcd-$FD,Y ; __c??? _b_?XX a_YYXX LSR LSR @@ -733,7 +733,7 @@ PrintDec JSR COUT DEY DEX - BPL @_BCD2Char + BPL @BCD2Char RTS ; NOTE: Can't use printm PrintStr*() as it may not be enabled/available @@ -1192,9 +1192,13 @@ DEBUG .sprintf( "PrintDec2() @ %X", * ) BNE @Dec2BCD CLD +NEW_PRINT_DEC = 0 +.if NEW_PRINT_DEC + DecWidth: +.endif LDX #5 ; was Y DEY ; $FF - $FD = 2 - @_BCD2Char: ; NOTE: Digits are reversed! + @BCD2Char: ; NOTE: Digits are reversed! LDA _bcd-$FD,Y ; __c??? _b_?XX a_YYXX LSR LSR @@ -1202,21 +1206,35 @@ DEBUG .sprintf( "PrintDec2() @ %X", * ) LSR CLC ADC #'0'+$80 +.if NEW_PRINT_DEC + JSR PutChar +.else STA _bcd,X ; __c??X _b_YXX aZYYXX +.endif DEX ; was Y - +.if NEW_PRINT_DEC + BMI NextFormat +.endif LDA _bcd-$FD,Y ; __c??X _b_YXX aZYYXX AND #$F CLC ADC #'0'+$80 +.if NEW_PRINT_DEC + JSR PutChar +.else STA _bcd,X ; __c?XX _bYYXX ZZYYXX +.endif DEY DEX - BPL @_BCD2Char + BPL @BCD2Char +.if NEW_PRINT_DEC + BMI NextFormat ; always +.else DecWidth: LDX #0 ; _nDecDigits NOTE: self-modifying! JMP PrintReverseBCD +.endif .endif ; ENABLE_DEC ; ______________________________________________________________________