I have previously done chr switching using MMC1 mapper and it worked well and good .....here I was using 32 kb switching mode (but I never switched)
But now I want to use 16kb prg bank switching ...
for that, the changes I have made to the previous code [the code in which chr switching is working fine] are :
1)I have generated a .lst file and seen where the first 16 kb of code ends...
then I have cut and pasted the next 16 kb code into other .asm file (two.asm) and the first 16 kb as(one.asm)
2)next I added the bank with the following code and in the first 16 kb file(one.asm)...
Quote:
.base $C000
.incbin "two.asm"
.org $ffff
3)in the mapper initialization I changed to the following :
Quote:
LDX #%00010011
jsr initMMC1Mapper
initMMC1Mapper:
LDA #$80
STA $8000
TXA
JSR setMMC1ControlMode
LDA #$00
JSR setCHRPage0000
LDA #$01
JSR setCHRPage1000
LDA #$01
JSR setPRGBank
RTS
the subroutines writes to the registers.....
3)when I compiled I am getting weird results...
value out of range in the 3rd line of the following added code:
.base $C000
.incbin "two.asm"
.org $ffff
So, please can you say me when does bank actually gets switched for first time ...?? like before the first pass after second...??
please can any one help me regarding the mentioned error...???
thanks in advance..
out of range error in MMC1 prg switching code...
Moderator: Moderators
-
vishu_supreme
- Posts: 13
- Joined: Mon May 24, 2010 4:20 pm
You do a "jsr initMMC1Mapper" which is immediately followed by the initMMC1Mapper routine itself... so it will call the routine TWICE (it will call it with the jsr, and then return in the routine itself and execute a second time). You probably don't want that to happen, so you'd want to fix hat.LDX #%00010011
jsr initMMC1Mapper
initMMC1Mapper:
LDA #$80
STA $8000
TXA
JSR setMMC1ControlMode
LDA #$00
JSR setCHRPage0000
LDA #$01
JSR setCHRPage1000
LDA #$01
JSR setPRGBank
RTS
Then you have to change the value you write to control register...
Here you write #%00010011 (on the first call) which sets the MMC1 in 32k switching mode, but you say in your post you want to do 16k switching. So you probably want to write #$1f (#%00011111) instead.
This should fix your program I think (assuming the set**** routines are correct, and do 5 writes to MMC1 regs).
Useless, lumbering half-wits don't scare us.
-
vishu_supreme
- Posts: 13
- Joined: Mon May 24, 2010 4:20 pm
-
doppelganger
- Posts: 183
- Joined: Tue Apr 05, 2005 7:30 pm