+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Using Mapper 1 to expand SMB1
Pages: [1]
Author Topic: Using Mapper 1 to expand SMB1  (Read 2 times)
frantik
Guest
« on: February 02, 2008, 08:36:40 pm »

Ok so I hit on the idea of using mapper 1 to expand SMB because you can swap in whole 32k banks of code, so it would be easy to basically switch between two different SMB roms.

I've got this code, but at start up the sprite tiles are loaded into both sides of the PPU and also the palette is all messed up.  the palette fixes itself once you start the game but the tiles are still only the sprites on both sides.  Also i'm setting the iNes header byte 0x0006 to $11 (or $12, not sure which is correct, both cause the same issue)

Code:
InitMMC:
                LDA #080h                 ;  reset mapper
                STA $FFFF                 ;                 
                lda #$00                  ;  init mapper register 3 with $00
                ldx #$E0
                jsr UpdateMMC
                ldx #$A0                  ;  init mapper register 1 with $00
                jsr UpdateMMC
                lda #%00000110            ;  init mapper register 0 with $06
                ldx #$80
                jsr UpdateMMC
                jmp $8000

;  UpdateMMC subroutine
;  Expects:
;   A = control value
;   X =
;       $80 - mapper control
;       $A0 - chr bank 1 control
;       $C0 - chr bank 2 control
;       $E0 - prg bank control
;  Uses:
;   $00 - LSB for mapper control addr
;   $01 - MSB "   "      "       "

UpdateMMC:
                stx $01                  ;   write MSB to mem addr
                ldy #$00                 ;   set y to 00
                sty $00                  ;   write y to LSB
                ldx #$05                 ;   counter = 5
loop:                                    ; start loop:
                sta ($00),y              ;   store bit into mapper
                lsr a                    ;   right shift acc
                dex                      ;   decrease counter
                bne loop:                ;   if counter != 0 goto loop:               
                rts


Quote from: Disch on February 02, 2008, 06:51:42 pm
you're not using my mapper docs?  ;_;

hehe, just teasing.  Kevtris' docs are great.

i'm using both but his was a little more verbose on the area i was asking about Wink  i used your docs to pick the mapper though hehe
Disch
Guest
« Reply #1 on: February 02, 2008, 09:13:03 pm »

I don't see anything wrong with that code you linked.

Sprites on both sides of the pattern table means you're in 4K CHR mode.  Either the code you pasted isn't executing, or you're changing $8000 somewhere else in the program.  Try setting write breakpoints on $8000-9FFF to see which is going on.
frantik
Guest
« Reply #2 on: February 02, 2008, 09:36:20 pm »

never mind it looks like it was some problem with the assembled coded.. i used x816 but it didn't put the correct indirect address for the loop address for some reason.  It looks like it's working correctly, or at least initialized correctly Smiley  btw which is the correct iNes header value?  11 or 12?  it seems like it should be 11 right?  now i gotta work on actually expanding it  Shocked
KingMike
Guest
« Reply #3 on: February 02, 2008, 09:39:16 pm »

Possibly remove the : in "bne loop:"?
Disch
Guest
« Reply #4 on: February 02, 2008, 09:53:10 pm »

Quote from: frantik on February 02, 2008, 09:36:20 pm
btw which is the correct iNes header value?  11 or 12?  it seems like it should be 11 right?


$10 or $11 .. they're both the same here.  The low bit is mirroring, but since the mirroring is mapper controlled on mapper 1 it's ignored.

$12 (or $13) will create an SRAM .sav file.
Lenophis
Guest
« Reply #5 on: February 02, 2008, 10:36:48 pm »

Ahem... :angel:
frantik
Guest
« Reply #6 on: February 03, 2008, 08:06:11 am »

^ nifty lil program.. thanks i used it to help get the animation going (in combination with modified code Disch gave me for CNROM animation Cheesy  now i just need to figure out how to do the prg switching.  switching the chr pages was tricky cause you have to shift the page number to the left before sending (where it's then shifted right a whole bunch lol)

KingMike yeah i think that was the problem.. thanks Cheesy
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC