initial commit

* the cut scene for 1 and 0 crystals is wrong, it always shows minimum
of 2 right now
* pretty sure the AGA door check will blow up
This commit is contained in:
sporchia
2018-09-25 22:13:35 -04:00
parent 7a204a0fb4
commit 1a6478aa27
6 changed files with 70 additions and 3 deletions

View File

@@ -593,6 +593,29 @@ HexToDec:
PLA
RTL
;--------------------------------------------------------------------------------
; CountBits
; in: A(b) - Byte to count bits in
; out: A(b) - sum of bits
; caller is responsible for setting 8-bit mode and preserving X and Y
;--------------------------------------------------------------------------------
CountBits:
PHB : PHK : PLB
TAX ; Save a copy of value
LSR #4 ; Shift down hi nybble, Leave <3> in C
TAY ; And save <7:4> in Y
TXA ; Recover value
AND #$07 ; Put out <2:0> in X
TAX ; And save in X
LDA NybbleBitCounts, Y ; Fetch count for Y
ADC NybbleBitCounts, X ; Add count for X & C
PLB
RTL
; Look up table of bit counts in the values $00-$0F
NybbleBitCounts:
db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #04
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------