Save off 2 bytes for zp version

This commit is contained in:
Michaelangel007 2017-07-06 15:54:01 -07:00
parent 8b95ff7cf9
commit 381b9d7912
3 changed files with 12 additions and 14 deletions

View File

@ -6,7 +6,7 @@ Features:
* Highly optimized for space
* 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
* Only 2 ROM entry points used: PRHEXZ, SCRN2
* Includes 7 byte demo
@ -35,15 +35,15 @@ With-Zero-Page version:
```asm
0900:A9 12 A2 34 4C 07 09 86
0908:FC 48 A0 00 84 FD 84 FE
0910:84 FF A0 10 F8 06 FC 68
0918:2A 48 A2 FD B5 00 75 00
0920:95 00 E8 D0 F7 88 D0 ED
0928:68 D8 A0 03 B9 FC 00 20
0930:39 09 88 D0 F7 8A F0 0E
0938:60 48 20 7B F8 20 43 09
0940:68 29 0F D0 01 CA E8 F0
0948:EF 4C E5 FD
0908:FC A0 00 84 FD 84 FE 84
0910:FF A0 10 F8 06 FC 2A 48
0918:A2 FD B5 00 75 00 95 00
0920:E8 D0 F7 68 88 D0 ED D8
0928:A0 03 B9 FC 00 20 37 09
0930:88 D0 F7 8A F0 0E 60 48
0938:20 7B F8 20 41 09 68 29
0940:0F D0 01 CA E8 F0 EF 4C
0948:E5 FD
```
With-Stack-Page version:

Binary file not shown.

View File

@ -25,7 +25,6 @@ _bcd = $fd ; NOTE: MUST be at $FD for ZP,X addressing in _DoubleDabble
; ======================================================================
PrintUint16
STX _temp
PHA ; Optimized: STA _temp+1
LDY #0
STY _bcd+0
@ -39,9 +38,8 @@ _Dec2BCD ; https://en.wikipedia.org/wiki/Double_dabble
ASL _temp+0 ; abcd efgh | ijkl mnop |
; ROL _temp+1 ; C=a bcde fghi | jklm nop0 |
; ; Bit 7654_3210 | 7654_3210 |
PLA
ROL
PHA
PHA ; Optimized: STA _temp+1
LDX #$FD ; $00-$FD=-3 bcd[0] bcd[1] bcd[2] bcd[3]
_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
INX
BNE _DoubleDabble
PLA ; keep stack
DEY
BNE _Dec2BCD
PLA ; keep stack
CLD ; X=0 = output length
DecWidth