mirror of
https://github.com/Michaelangel007/apple2_print_uint16.git
synced 2024-12-29 04:29:16 +00:00
Optimized 95 bytes
This commit is contained in:
parent
f87a71a06d
commit
1ce8c90bde
20
README.md
20
README.md
@ -1,6 +1,6 @@
|
|||||||
# Print unsigned 16-bit
|
# Print unsigned 16-bit
|
||||||
|
|
||||||
6502 assembly code to print an unsigned 16-bit in 96 bytes ($60).
|
6502 assembly code to print an unsigned 16-bit in 95 bytes ($5F).
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
@ -14,18 +14,18 @@ Copy/Paste into your favorite emulator.
|
|||||||
|
|
||||||
```asm
|
```asm
|
||||||
0800:A9 12 A2 34 4C 07 08 8E
|
0800:A9 12 A2 34 4C 07 08 8E
|
||||||
0808:65 08 8D 66 08 A9 00 8D
|
0808:64 08 8D 65 08 A9 00 8D
|
||||||
0810:61 08 8D 62 08 8D 63 08
|
0810:60 08 8D 61 08 8D 62 08
|
||||||
0818:A2 10 F8 0E 65 08 2E 66
|
0818:A2 10 F8 0E 64 08 2E 65
|
||||||
0820:08 A0 FD B9 64 07 79 64
|
0820:08 A0 FD B9 63 07 79 63
|
||||||
0828:07 99 64 07 C8 D0 F4 CA
|
0828:07 99 63 07 C8 D0 F4 CA
|
||||||
0830:D0 E9 D8 A0 03 B9 60 08
|
0830:D0 E9 D8 A0 03 B9 5F 08
|
||||||
0838:20 44 08 88 D0 F7 8A E0
|
0838:20 44 08 88 D0 F7 8A E0
|
||||||
0840:00 F0 11 60 48 20 7B F8
|
0840:00 F0 11 60 48 20 7B F8
|
||||||
0848:20 4E 08 68 29 0F D0 04
|
0848:20 4E 08 68 29 0F D0 04
|
||||||
0850:E0 00 F0 0C C9 0A 90 02
|
0850:E0 00 F0 EF C9 0A 90 02
|
||||||
0858:69 06 69 B0 20 ED FD E8
|
0858:69 06 69 B0 E8 4C ED FD
|
||||||
0860:60 00 00 00 00 00 00
|
0860:00 00 00 00 00 00
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
BIN
print_uint16
BIN
print_uint16
Binary file not shown.
@ -71,7 +71,7 @@ HexA
|
|||||||
_HexNib
|
_HexNib
|
||||||
BNE _HaveLeadingDigit ; If have leading zero and no output yet ...
|
BNE _HaveLeadingDigit ; If have leading zero and no output yet ...
|
||||||
CPX #0 ; ... then skip storing it
|
CPX #0 ; ... then skip storing it
|
||||||
BEQ _HexAsciiDone
|
BEQ _PrintDone
|
||||||
|
|
||||||
_HaveLeadingDigit
|
_HaveLeadingDigit
|
||||||
CMP #$A ; n < 10 ?
|
CMP #$A ; n < 10 ?
|
||||||
@ -80,10 +80,8 @@ _HaveLeadingDigit
|
|||||||
_Hex2Asc
|
_Hex2Asc
|
||||||
ADC #'0' + $80 ; inverse=remove #$80
|
ADC #'0' + $80 ; inverse=remove #$80
|
||||||
PutChar
|
PutChar
|
||||||
JSR COUT
|
|
||||||
INX ; X = output string length
|
INX ; X = output string length
|
||||||
_HexAsciiDone
|
JMP COUT
|
||||||
RTS
|
|
||||||
|
|
||||||
_bcd ds 4 ; 6 chars for printing dec
|
_bcd ds 4 ; 6 chars for printing dec
|
||||||
_temp db 0,0
|
_temp db 0,0
|
||||||
|
Loading…
Reference in New Issue
Block a user