Refactored gamma.

This commit is contained in:
Martin Haye 2017-01-15 15:19:22 -08:00
parent 22e4b4b681
commit 5a9f8f749b

View File

@ -137,17 +137,25 @@ decomp !zone {
bcc - ; always taken bcc - ; always taken
; Read an Elias Gamma value into A. Destroys X. Sets carry. ; Read an Elias Gamma value into A. Destroys X. Sets carry.
.gamma tya ; Y=0, so now A=0 .gamma lda #1
.glup rol
asl bits asl bits
beq .gmor1 bcc .gbit0
.gles1 bcs .ret beq .gamma2
rts
; intended split here (macro above, code below)
.gamma2 ;bcc .gbit0
.gfill1 jsr .getbts
.glup bcc .gbit0
rts
.gbit0 asl bits
beq .gfill2
.gshift rol
asl bits asl bits
bne .glup bne .glup
jsr .getbts beq .gfill1
bne .glup ; always taken .gfill2 jsr .getbts
.gmor1 jsr .getbts bne .gshift ; always taken
bne .gles1 ; always taken
; Get another 8 bits into our bit buffer. Destroys X. Preserves A. Requires Y=0. ; Get another 8 bits into our bit buffer. Destroys X. Preserves A. Requires Y=0.
.getbts tax .getbts tax
@ -159,16 +167,15 @@ decomp !zone {
rol rol
sta bits sta bits
txa txa
.ret rts rts
} ; end of zone } ; end of zone
!ifdef PASS2 { !ifdef PASS2 {
!warn "decomp spare: ", $E000 - * !warn "decomp spare: ", $E000 - *
!if * > $DFFF { !if * > $E000 {
!error "Decomp grew too large." !warn "Decomp grew too large."
} }
} else { ;PASS2 } else { ;PASS2
!set PASS2=1 !set PASS2=1
} }