minor optimizations

This commit is contained in:
sejo 2021-07-14 13:53:49 -05:00
parent fc060b34b5
commit 5ec1853300
2 changed files with 7 additions and 6 deletions

View File

@ -361,23 +361,24 @@ RTN
,&start JMP
&num $1
&start
#00
.ptr-register-nibbles LDZ ( get register address )
#01 SFT #00 SWP ;registers ADD2 ( calculate register address+offset )
#01 SFT ;registers ADD2 ( calculate register address+offset )
STH2k ( store and keep address+offset )
LDA ( get register contents )
DUP ( duplicate byte )
#04 SFT #0f AND .high-nibble STZ ( store high nibble )
#04 SFT .high-nibble STZ ( store high nibble )
#0f AND .low-nibble STZ ( store low nibble )
.ptr-register-nibbles LDZ
#01 AND ( are we in high 1 or low 0 nibble? )
,&inc-high-nibble JCN
&inc-low-nibble
.low-nibble LDZ ,&num LDR ADD #0f AND ( increment and mask low nibble )
.low-nibble STZ
.low-nibble STHk LDZ ,&num LDR ADD #0f AND ( increment and mask low nibble )
STHr STZ
,&finish JMP
&inc-high-nibble
.high-nibble LDZ ,&num LDR ADD #0f AND ( increment and mask low nibble )
.high-nibble STZ
.high-nibble STHk LDZ ,&num LDR ADD #0f AND ( increment and mask low nibble )
STHr STZ
&finish
.high-nibble LDZ #40 SFT .low-nibble LDZ ORA ( reassemble byte )
STH2r ( recover byte address )

Binary file not shown.