mirror of
https://github.com/a2-4am/4cade.git
synced 2025-03-03 11:30:27 +00:00
inline HGR to DHGR bytes code
This commit is contained in:
parent
a872d708f6
commit
74041f9826
31
src/macros.a
31
src/macros.a
@ -148,6 +148,37 @@
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
|
!macro HGR_BYTE_TO_DHGR_BYTES {
|
||||||
|
;1GFEDCBA ->
|
||||||
|
;1GGFFEED (main) +
|
||||||
|
;1DCCBBAA (aux)
|
||||||
|
;
|
||||||
|
; in: A = HGR byte
|
||||||
|
; out: A = DHGR byte in mainmem
|
||||||
|
; X = DHGR byte in auxmem
|
||||||
|
; preserves Y
|
||||||
|
; clobbers zero page $00,$01,$02
|
||||||
|
sty $02
|
||||||
|
ldy #$02
|
||||||
|
-- stx $01
|
||||||
|
ldx #$04
|
||||||
|
- ror $00 ; duplicate previous bit
|
||||||
|
lsr ; fetch bit
|
||||||
|
php
|
||||||
|
ror $00 ; insert bit
|
||||||
|
plp
|
||||||
|
dex
|
||||||
|
bne -
|
||||||
|
ldx $00
|
||||||
|
dey
|
||||||
|
bne --
|
||||||
|
txa
|
||||||
|
sec
|
||||||
|
ror $01 ; set bit 7 explicitly on auxmem value
|
||||||
|
ldx $01
|
||||||
|
ldy $02
|
||||||
|
}
|
||||||
|
|
||||||
; these are mostly for prelaunchers -- code in the main program should keep track of which bank is active to minimize code size
|
; these are mostly for prelaunchers -- code in the main program should keep track of which bank is active to minimize code size
|
||||||
!macro ENABLE_ACCEL {
|
!macro ENABLE_ACCEL {
|
||||||
+READ_RAM2_NO_WRITE
|
+READ_RAM2_NO_WRITE
|
||||||
|
@ -264,63 +264,32 @@ DrawGameTitleInActionSlideshowHGR
|
|||||||
; (Draw40Chars, DrawCenteredString, DrawString, DrawBuffer)
|
; (Draw40Chars, DrawCenteredString, DrawString, DrawBuffer)
|
||||||
;
|
;
|
||||||
; in: gPathname contains number of bytes to transform
|
; in: gPathname contains number of bytes to transform
|
||||||
; DBIRow0 set (this will be true if you just called DrawBufferInternal
|
; DBIRow0/LC2 contains address of first byte of first row to transform
|
||||||
; or something that calls it, see above)
|
; (this will be true if you just called DrawBufferInternal or
|
||||||
; out: clobbers zero page $00,$01,$02,$03,SAVE,$FE,$FF
|
; something that calls it, see above)
|
||||||
|
; out: clobbers zero page $00,$01,$02,$26,$27,$F7
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
RedrawForDHGR
|
RedrawForDHGR
|
||||||
jsr SwitchToBank2
|
jsr SwitchToBank2
|
||||||
+LDAY DBIRow0+1
|
+LDAY DBIRow0+1
|
||||||
+STAY $FE
|
+STAY $26
|
||||||
lda #8
|
lda #8
|
||||||
sta i
|
sta i
|
||||||
-- ldy gPathname
|
-- ldy gPathname
|
||||||
dey
|
dey
|
||||||
- lda ($FE),y
|
- lda ($26),y
|
||||||
jsr HGRByteToDHGRBytes
|
+HGR_BYTE_TO_DHGR_BYTES
|
||||||
sta ($FE),y
|
sta ($26),y
|
||||||
txa
|
txa
|
||||||
sta WRITEAUXMEM
|
sta WRITEAUXMEM
|
||||||
sta ($FE),y
|
sta ($26),y
|
||||||
sta WRITEMAINMEM
|
sta WRITEMAINMEM
|
||||||
dey
|
dey
|
||||||
bpl -
|
bpl -
|
||||||
lda $FF
|
lda $27
|
||||||
clc
|
clc
|
||||||
adc #$04
|
adc #$04
|
||||||
sta $FF
|
sta $27
|
||||||
dec i
|
dec i
|
||||||
bne --
|
bne --
|
||||||
jmp SwitchToBank1
|
jmp SwitchToBank1
|
||||||
|
|
||||||
HGRByteToDHGRBytes
|
|
||||||
;1GFEDCBA ->
|
|
||||||
;1GGFFEED (main) +
|
|
||||||
;1DCCBBAA (aux)
|
|
||||||
;
|
|
||||||
; in: A = HGR byte
|
|
||||||
; out: A = DHGR byte in mainmem
|
|
||||||
; X = DHGR byte in auxmem
|
|
||||||
; preserves Y
|
|
||||||
; clobbers zero page $00,$01,$02
|
|
||||||
|
|
||||||
sty $02
|
|
||||||
ldy #$02
|
|
||||||
-- stx $01
|
|
||||||
ldx #$04
|
|
||||||
- ror $00 ; duplicate previous bit
|
|
||||||
lsr ; fetch bit
|
|
||||||
php
|
|
||||||
ror $00 ; insert bit
|
|
||||||
plp
|
|
||||||
dex
|
|
||||||
bne -
|
|
||||||
ldx $00
|
|
||||||
dey
|
|
||||||
bne --
|
|
||||||
txa
|
|
||||||
sec
|
|
||||||
ror $01 ; set bit 7 explicitly on auxmem value
|
|
||||||
ldx $01
|
|
||||||
ldy $02
|
|
||||||
rts
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user