mirror of
https://github.com/Michaelangel007/apple2_printm.git
synced 2024-06-10 07:29:32 +00:00
Ver 7
This commit is contained in:
parent
ea442989bf
commit
eaac2a54e8
50
printm.s
50
printm.s
|
@ -1,4 +1,4 @@
|
||||||
; Version 0.4
|
; Version 0.7
|
||||||
|
|
||||||
; ca65
|
; ca65
|
||||||
.feature c_comments
|
.feature c_comments
|
||||||
|
@ -165,7 +165,7 @@ a 16-bit address for the assembler
|
||||||
_nHexNibbles = HexNibbles+1
|
_nHexNibbles = HexNibbles+1
|
||||||
|
|
||||||
; printm( format, args, ... )
|
; printm( format, args, ... )
|
||||||
; =-=-=-=-=-=-=-=-=-=-
|
;========================================================================
|
||||||
PrintM
|
PrintM
|
||||||
STX _pArg+0
|
STX _pArg+0
|
||||||
STY _pArg+1
|
STY _pArg+1
|
||||||
|
@ -219,13 +219,11 @@ _Hex2Asc
|
||||||
|
|
||||||
INX
|
INX
|
||||||
HexNibbles
|
HexNibbles
|
||||||
CPX #0 ; _nHexNibbles NOTE: self-modifying!
|
CPX #0 ; _nHexNibbles NOTE: self-modifying!
|
||||||
BNE _HexDigit
|
BNE _HexDigit
|
||||||
|
; Intentional fall into reverse BCD
|
||||||
|
|
||||||
; PHX
|
;========================================================================
|
||||||
; PLY
|
|
||||||
; Intentional fall into reverse BCD
|
|
||||||
|
|
||||||
PrintReverseBCD
|
PrintReverseBCD
|
||||||
DEX
|
DEX
|
||||||
BMI NextFormat
|
BMI NextFormat
|
||||||
|
@ -245,9 +243,6 @@ _PrintPtr
|
||||||
STA _nHexNibbles
|
STA _nHexNibbles
|
||||||
JSR NxtArgXY
|
JSR NxtArgXY
|
||||||
|
|
||||||
;STX $500
|
|
||||||
;STY $501
|
|
||||||
|
|
||||||
STX $01
|
STX $01
|
||||||
STY $02
|
STY $02
|
||||||
LDY #$0
|
LDY #$0
|
||||||
|
@ -256,11 +251,9 @@ _PrintPtr
|
||||||
INY
|
INY
|
||||||
LDA ($01),Y
|
LDA ($01),Y
|
||||||
TAY
|
TAY
|
||||||
|
|
||||||
;STX $502
|
|
||||||
;STY $503
|
|
||||||
BRA _PrintHexXY ; always
|
BRA _PrintHexXY ; always
|
||||||
|
|
||||||
|
;========================================================================
|
||||||
Print
|
Print
|
||||||
JSR PutChar
|
JSR PutChar
|
||||||
|
|
||||||
|
@ -294,8 +287,14 @@ _Done
|
||||||
; d Dec 2 Byte (max 3 digits)
|
; d Dec 2 Byte (max 3 digits)
|
||||||
; u Dec 2 Byte (max 5 digits)
|
; u Dec 2 Byte (max 5 digits)
|
||||||
;========================================================================
|
;========================================================================
|
||||||
|
PrintDec5
|
||||||
|
LDA #5
|
||||||
|
BNE _PrintDec ; always
|
||||||
|
PrintDec3
|
||||||
|
LDA #3
|
||||||
|
BNE _PrintDec ; always
|
||||||
PrintDec2
|
PrintDec2
|
||||||
LDA #2 ; skip first 2 digits
|
LDA #2 ; 2 digits
|
||||||
_PrintDec
|
_PrintDec
|
||||||
STA DecDigits+1
|
STA DecDigits+1
|
||||||
JSR NxtArgXY
|
JSR NxtArgXY
|
||||||
|
@ -357,9 +356,6 @@ DecDigits
|
||||||
LDX #0 ; _DecDigits
|
LDX #0 ; _DecDigits
|
||||||
JMP PrintReverseBCD
|
JMP PrintReverseBCD
|
||||||
|
|
||||||
PrintDec4
|
|
||||||
LDA #4 ; skip 0 digits
|
|
||||||
BNE _PrintDec ; always
|
|
||||||
|
|
||||||
; % Bin 1 Byte normal 1
|
; % Bin 1 Byte normal 1
|
||||||
; d Bin 1 Byte inverse 1
|
; d Bin 1 Byte inverse 1
|
||||||
|
@ -399,18 +395,8 @@ _JumpNextFormat
|
||||||
JSR PrintBuf
|
JSR PrintBuf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
; ___ Utility ___
|
||||||
;DEBUG
|
|
||||||
;LDX _bcd+0
|
|
||||||
;LDY _bcd+1
|
|
||||||
;LDA _bcd+2
|
|
||||||
;STX $600
|
|
||||||
;STY $601
|
|
||||||
;STA $602
|
|
||||||
;RTS
|
|
||||||
; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
||||||
|
|
||||||
; === Utility ===
|
|
||||||
/*
|
/*
|
||||||
_CmpMeta = CmpMeta+1
|
_CmpMeta = CmpMeta+1
|
||||||
|
|
||||||
|
@ -466,7 +452,7 @@ NxtArgXY
|
||||||
TAY
|
TAY
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
; Hex2/Hex4 temp
|
; Hex2/Hex4 temp
|
||||||
_bcd ds 6 ; 6 chars for printing dec
|
_bcd ds 6 ; 6 chars for printing dec
|
||||||
_val dw 0
|
_val dw 0
|
||||||
|
|
||||||
|
@ -475,7 +461,8 @@ MetaChar
|
||||||
db '@' ; PrintPtr2
|
db '@' ; PrintPtr2
|
||||||
db '?' ; PrintBinInv
|
db '?' ; PrintBinInv
|
||||||
db '%' ; PrintBinAsc
|
db '%' ; PrintBinAsc
|
||||||
db 'd' ; PrintDec4
|
db 'u' ; PrintDec5
|
||||||
|
db 'd' ; PrintDec3
|
||||||
db '#' ; PrintDec2
|
db '#' ; PrintDec2
|
||||||
db '$' ; PrintHex2
|
db '$' ; PrintHex2
|
||||||
db 'x' ; PrintHex4
|
db 'x' ; PrintHex4
|
||||||
|
@ -488,7 +475,8 @@ MetaFunc
|
||||||
dw PrintPtr2
|
dw PrintPtr2
|
||||||
dw PrintBinInv
|
dw PrintBinInv
|
||||||
dw PrintBinAsc
|
dw PrintBinAsc
|
||||||
dw PrintDec4
|
dw PrintDec5
|
||||||
|
dw PrintDec3
|
||||||
dw PrintDec2
|
dw PrintDec2
|
||||||
dw PrintHex2
|
dw PrintHex2
|
||||||
dw PrintHex4
|
dw PrintHex4
|
||||||
|
|
Loading…
Reference in New Issue
Block a user