Fast HUD via kan
This commit is contained in:
@@ -562,102 +562,6 @@ SkipDrawEOR:
|
||||
.normal
|
||||
LDA.b ($08), Y : EOR.w Scrap04 ; thing we wrote over
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; HexToDec
|
||||
; in: A(w) - Word to Convert
|
||||
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
|
||||
;--------------------------------------------------------------------------------
|
||||
HexToDec:
|
||||
PHA
|
||||
PHA
|
||||
LDA.w #$9090
|
||||
STA.b Scrap04 : STA.b Scrap06 ; temporarily store our decimal values here for speed
|
||||
PLA
|
||||
-
|
||||
CMP.w #1000 : !BLT +
|
||||
INC.b Scrap04
|
||||
!SUB.w #1000 : BRA -
|
||||
+ -
|
||||
CMP.w #100 : !BLT +
|
||||
INC.b Scrap05
|
||||
!SUB.w #100 : BRA -
|
||||
+ -
|
||||
CMP.w #10 : !BLT +
|
||||
INC.b Scrap06
|
||||
!SUB.w #10 : BRA -
|
||||
+ -
|
||||
CMP.w #1 : !BLT +
|
||||
INC.b Scrap07
|
||||
!SUB.w #1 : BRA -
|
||||
+
|
||||
LDA.b Scrap04 : STA.l HexToDecDigit2 ; move to digit storage
|
||||
LDA.b Scrap06 : STA.l HexToDecDigit4
|
||||
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:
|
||||
; PHX
|
||||
; TAX ; Save a copy of value
|
||||
; LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||
; PHA ; And save <7:4> in Stack
|
||||
; TXA ; Recover value
|
||||
; AND.b #$07 ; Put out <2:0> in X
|
||||
; TAX ; And save in X
|
||||
; LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
|
||||
; PLX ; get <7:4>
|
||||
; ADC.l NybbleBitCounts, X ; Add count for S & C
|
||||
; PLX
|
||||
;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
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; HexToDec
|
||||
; in: A(w) - Word to Convert
|
||||
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
|
||||
;--------------------------------------------------------------------------------
|
||||
;HexToDec:
|
||||
; PHA
|
||||
; PHA
|
||||
; LDA.w #$9090
|
||||
; STA.l HexToDecDigit1 : STA.l HexToDecDigit3 : STA.l HexToDecDigit4 ; clear digit storage
|
||||
; PLA
|
||||
; -
|
||||
; CMP.w #10000 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit1 : INC : STA.l HexToDecDigit1 : REP #$20 : PLA
|
||||
; !SUB.w #10000 : BRA -
|
||||
; + -
|
||||
; CMP.w #1000 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit2 : INC : STA.l HexToDecDigit2 : REP #$20 : PLA
|
||||
; !SUB.w #1000 : BRA -
|
||||
; + -
|
||||
; CMP.w #100 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit3 : INC : STA.l HexToDecDigit3 : REP #$20 : PLA
|
||||
; !SUB.w #100 : BRA -
|
||||
; + -
|
||||
; CMP.w #10 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit4 : INC : STA.l HexToDecDigit4 : REP #$20 : PLA
|
||||
; !SUB.w #10 : BRA -
|
||||
; + -
|
||||
; CMP.w #1 : !BLT +
|
||||
; PHA : SEP #$20 : LDA.l HexToDecDigit5 : INC : STA.l HexToDecDigit5 : REP #$20 : PLA
|
||||
; !SUB.w #1 : BRA -
|
||||
; +
|
||||
; PLA
|
||||
;RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
; WriteVRAMStripe
|
||||
|
||||
Reference in New Issue
Block a user