I know that games swap parts of the character table by bankswitching. But I want to only replace a few tiles in my code. Is this possible?
I'm hacking a menu rom that I have, so it's hard to show all the code. But this is what I came up with which does not seem to do the trick:
what I'm trying to do here is
- check if $0653 has changed
- If changed, then Copy 256 bytes from $8100 to tile 68+ in table 1
Right now it does do something, but it messes up stuff and the result is not right.
(btw, I know I could count down and leave away the cmp, but this is only dummy code to get things working)
I'm hacking a menu rom that I have, so it's hard to show all the code. But this is what I came up with which does not seem to do the trick:
Code:
PHA
TYA
PHA
TXA
PHA
LDA $0653
CMP $0C00
BEQ NoChange
STA $0C00
LDA $2002
LDA #$06
STA $2006
LDA #$7F
STA $2006
LDX #$00
MoreBytes:
LDA $8100,X
STA $2007
INX
CPX #$00
BNE MoreBytes
NoChange:
PLA
TAX
PLA
TAY
PLA
TYA
PHA
TXA
PHA
LDA $0653
CMP $0C00
BEQ NoChange
STA $0C00
LDA $2002
LDA #$06
STA $2006
LDA #$7F
STA $2006
LDX #$00
MoreBytes:
LDA $8100,X
STA $2007
INX
CPX #$00
BNE MoreBytes
NoChange:
PLA
TAX
PLA
TAY
PLA
what I'm trying to do here is
- check if $0653 has changed
- If changed, then Copy 256 bytes from $8100 to tile 68+ in table 1
Right now it does do something, but it messes up stuff and the result is not right.
(btw, I know I could count down and leave away the cmp, but this is only dummy code to get things working)