mirror of
https://github.com/Michaelangel007/apple2_print_uint16.git
synced 2024-12-28 13:30:55 +00:00
Save off 2 bytes for zp version
This commit is contained in:
parent
8b95ff7cf9
commit
381b9d7912
20
README.md
20
README.md
@ -6,7 +6,7 @@ Features:
|
|||||||
|
|
||||||
* Highly optimized for space
|
* Highly optimized for space
|
||||||
* No zero-page usage [version](print_uint16.s) 79 ($4F) bytes
|
* No zero-page usage [version](print_uint16.s) 79 ($4F) bytes
|
||||||
* With zero-page usage [version](print_uint16_zp.s) 69 ($45) bytes
|
* With zero-page usage [version](print_uint16_zp.s) 67 ($43) bytes
|
||||||
* With stack var usage [version](print_uint16_sp.s) 83 ($53) bytes
|
* With stack var usage [version](print_uint16_sp.s) 83 ($53) bytes
|
||||||
* Only 2 ROM entry points used: PRHEXZ, SCRN2
|
* Only 2 ROM entry points used: PRHEXZ, SCRN2
|
||||||
* Includes 7 byte demo
|
* Includes 7 byte demo
|
||||||
@ -35,15 +35,15 @@ With-Zero-Page version:
|
|||||||
|
|
||||||
```asm
|
```asm
|
||||||
0900:A9 12 A2 34 4C 07 09 86
|
0900:A9 12 A2 34 4C 07 09 86
|
||||||
0908:FC 48 A0 00 84 FD 84 FE
|
0908:FC A0 00 84 FD 84 FE 84
|
||||||
0910:84 FF A0 10 F8 06 FC 68
|
0910:FF A0 10 F8 06 FC 2A 48
|
||||||
0918:2A 48 A2 FD B5 00 75 00
|
0918:A2 FD B5 00 75 00 95 00
|
||||||
0920:95 00 E8 D0 F7 88 D0 ED
|
0920:E8 D0 F7 68 88 D0 ED D8
|
||||||
0928:68 D8 A0 03 B9 FC 00 20
|
0928:A0 03 B9 FC 00 20 37 09
|
||||||
0930:39 09 88 D0 F7 8A F0 0E
|
0930:88 D0 F7 8A F0 0E 60 48
|
||||||
0938:60 48 20 7B F8 20 43 09
|
0938:20 7B F8 20 41 09 68 29
|
||||||
0940:68 29 0F D0 01 CA E8 F0
|
0940:0F D0 01 CA E8 F0 EF 4C
|
||||||
0948:EF 4C E5 FD
|
0948:E5 FD
|
||||||
```
|
```
|
||||||
|
|
||||||
With-Stack-Page version:
|
With-Stack-Page version:
|
||||||
|
BIN
print_uint16_zp
BIN
print_uint16_zp
Binary file not shown.
@ -25,7 +25,6 @@ _bcd = $fd ; NOTE: MUST be at $FD for ZP,X addressing in _DoubleDabble
|
|||||||
; ======================================================================
|
; ======================================================================
|
||||||
PrintUint16
|
PrintUint16
|
||||||
STX _temp
|
STX _temp
|
||||||
PHA ; Optimized: STA _temp+1
|
|
||||||
|
|
||||||
LDY #0
|
LDY #0
|
||||||
STY _bcd+0
|
STY _bcd+0
|
||||||
@ -39,9 +38,8 @@ _Dec2BCD ; https://en.wikipedia.org/wiki/Double_dabble
|
|||||||
ASL _temp+0 ; abcd efgh | ijkl mnop |
|
ASL _temp+0 ; abcd efgh | ijkl mnop |
|
||||||
; ROL _temp+1 ; C=a bcde fghi | jklm nop0 |
|
; ROL _temp+1 ; C=a bcde fghi | jklm nop0 |
|
||||||
; ; Bit 7654_3210 | 7654_3210 |
|
; ; Bit 7654_3210 | 7654_3210 |
|
||||||
PLA
|
|
||||||
ROL
|
ROL
|
||||||
PHA
|
PHA ; Optimized: STA _temp+1
|
||||||
|
|
||||||
LDX #$FD ; $00-$FD=-3 bcd[0] bcd[1] bcd[2] bcd[3]
|
LDX #$FD ; $00-$FD=-3 bcd[0] bcd[1] bcd[2] bcd[3]
|
||||||
_DoubleDabble ; Y=FD Y=FE Y=FF Y=00
|
_DoubleDabble ; Y=FD Y=FE Y=FF Y=00
|
||||||
@ -50,10 +48,10 @@ _DoubleDabble ; Y=FD Y=FE Y=FF Y=00
|
|||||||
STA _bcd-$FD,X
|
STA _bcd-$FD,X
|
||||||
INX
|
INX
|
||||||
BNE _DoubleDabble
|
BNE _DoubleDabble
|
||||||
|
PLA ; keep stack
|
||||||
DEY
|
DEY
|
||||||
BNE _Dec2BCD
|
BNE _Dec2BCD
|
||||||
|
|
||||||
PLA ; keep stack
|
|
||||||
CLD ; X=0 = output length
|
CLD ; X=0 = output length
|
||||||
|
|
||||||
DecWidth
|
DecWidth
|
||||||
|
Loading…
Reference in New Issue
Block a user