Romhacking.net

Romhacking => ROM Hacking Discussion => Topic started by: Dracula X on April 19, 2021, 09:30:37 pm

Title: Super Mario Bros Mapper Conversion Help
Post by: Dracula X on April 19, 2021, 09:30:37 pm
I think I'm almost finished converting the game to another mapper, but I think something is wrong. Might be the bankswitch code or something.

C065:
Code: [Select]
Bankswitch:
PHP
ASL A
ORA #$80
STA $5115
PLP
RTS

And I put this code in bank 4
Code: [Select]
ExecGameLoopback2:
      lda Player_PageLoc        ;send player back four pages
      sec
      sbc #$04
      sta Player_PageLoc
      lda CurrentPageLoc        ;send current page back four pages
      sec
      sbc #$04
      sta CurrentPageLoc
      lda ScreenLeft_PageLoc    ;subtract four from page location
      sec                       ;of screen's left border
      sbc #$04
      sta ScreenLeft_PageLoc
      lda ScreenRight_PageLoc   ;do the same for the page location
      sec                       ;of screen's right border
      sbc #$04
      sta ScreenRight_PageLoc
      lda AreaObjectPageLoc     ;subtract four from page control
      sec                       ;for area objects
      sbc #$04
      sta AreaObjectPageLoc
      lda #$00                  ;initialize page select for both
      sta EnemyObjectPageSel    ;area and enemy objects
      sta AreaObjectPageSel
      sta EnemyDataOffset       ;initialize enemy object data offset
      sta EnemyObjectPageLoc    ;and enemy object page control
      lda AreaDataOfsLoopback,y ;adjust area object offset based on
      sta AreaDataOffset        ;which loop command we encountered
      rts

When the code bankswitch to another bank, the game freezes or reset the game.
Title: Re: Super Mario Bros Mapper Conversion Help
Post by: frantik on April 20, 2021, 02:44:56 pm
what mapper are you using?

are you changing the bank where the program counter is currently pointing to?  if so you need to make sure the code in the new bank picks up exactly where it left off in the old bank
Title: Re: Super Mario Bros Mapper Conversion Help
Post by: Dracula X on April 20, 2021, 06:49:44 pm
MMC5! This hack will be release soon! Just need to test some things out and then release it.