News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Mapper Conversions Issues Question [SOLVED]  (Read 1531 times)

Dracula X

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • My YouTube Page for ROM hacking
Mapper Conversions Issues Question [SOLVED]
« on: October 16, 2017, 10:29:48 am »
While converting to a different mapper, have anyone ran into a glitch when something thats not supposed to happened?

The Guardian Legend for example:
In flying mode, the player jumps to the top of the screen. This happened's on corridor 16 and the green commet diddn't appear from the start and the commet generator didn't appear. This happened's on corridor 0. This happened on mapper MMC3 and MMC5.

This might happens on other games too and for MMC5, it won't work on most emulators as well. Do we have to reprogram some of the codes to fix this issue?
« Last Edit: November 08, 2017, 02:37:42 pm by Dracula X »
Learning how bankswitching works is completed.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6861
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Mapper Conversions Issues Question
« Reply #1 on: October 16, 2017, 01:54:31 pm »
Guardian Legend is an UNROM game. MMC3 and MMC5 are far more complex mappers, so yes you do need to reprogram code to keep the extra functionality of the mapper from interfering with the game. (possibly IRQ is the issue?)
"My watch says 30 chickens" Google, 2018

Disch

  • Hero Member
  • *****
  • Posts: 2713
  • NES Junkie
    • View Profile
Re: Mapper Conversions Issues Question
« Reply #2 on: October 16, 2017, 04:11:21 pm »
You must have messed something up in the conversion.

UNROM in particular, since swaps are so simple (just a single write), many games will just do the STA directly in the code rather than JSR-ing to a swap subroutine.

Try setting a breakpoint on all writes to $8000-FFFF.  In an MMC5 converted game, the game should never write to those addresses.  If it is, that's the game trying to swap.  You'll need to replace the write with a JSR to a swap routine.

Dracula X

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • My YouTube Page for ROM hacking
Re: Mapper Conversions Issues Question
« Reply #3 on: October 16, 2017, 06:30:07 pm »
I think I found it while doing a breakpoint on all writes to $8000-FFFF!

Code: [Select]
;-------------------------------------------------------------------------------
__d705:     sta $04            ; $d705: 85 04     
            tya                ; $d707: 98       
            pha                ; $d708: 48       
            ldy $04            ; $d709: a4 04     
            lda __fff2,y       ; $d70b: b9 f2 ff 
            sta __fff2,y       ; $d70e: 99 f2 ff 
            pla                ; $d711: 68       
            tay                ; $d712: a8       
            rts                ; $d713: 60       

;-------------------------------------------------------------------------------
__d714:     pha                ; $d714: 48       
            lda #$00           ; $d715: a9 00     
            sta $04            ; $d717: 85 04     
            lda __fff2         ; $d719: ad f2 ff 
            sta __fff2         ; $d71c: 8d f2 ff 
            pla                ; $d71f: 68       
            rts                ; $d720: 60       

;-------------------------------------------------------------------------------
            pha                ; $d721: 48       
            lda #$01           ; $d722: a9 01     
            sta $04            ; $d724: 85 04     
            lda __fff3         ; $d726: ad f3 ff 
            sta __fff3         ; $d729: 8d f3 ff 
            pla                ; $d72c: 68       
            rts                ; $d72d: 60       

;-------------------------------------------------------------------------------
            pha                ; $d72e: 48       
            lda #$02           ; $d72f: a9 02     
            sta $04            ; $d731: 85 04     
            lda __fff4         ; $d733: ad f4 ff 
            sta __fff4         ; $d736: 8d f4 ff 
            pla                ; $d739: 68       
            rts                ; $d73a: 60       

;-------------------------------------------------------------------------------
__d73b:     pha                ; $d73b: 48       
            lda #$03           ; $d73c: a9 03     
            sta $04            ; $d73e: 85 04     
            lda __fff5         ; $d740: ad f5 ff 
            sta __fff5         ; $d743: 8d f5 ff 
            pla                ; $d746: 68       
            rts                ; $d747: 60       

;-------------------------------------------------------------------------------
__d748:     pha                ; $d748: 48       
            lda #$04           ; $d749: a9 04     
            sta $04            ; $d74b: 85 04     
            lda __fff6         ; $d74d: ad f6 ff 
            sta __fff6         ; $d750: 8d f6 ff 
            pla                ; $d753: 68       
            rts                ; $d754: 60       

;-------------------------------------------------------------------------------
__d755:     pha                ; $d755: 48       
            lda #$05           ; $d756: a9 05     
            sta $04            ; $d758: 85 04     
            lda __fff7         ; $d75a: ad f7 ff 
            sta __fff7         ; $d75d: 8d f7 ff 
            pla                ; $d760: 68       
            rts                ; $d761: 60       

;-------------------------------------------------------------------------------
__d762:     pha                ; $d762: 48       
            lda #$06           ; $d763: a9 06     
            sta $04            ; $d765: 85 04     
            lda __fff8         ; $d767: ad f8 ff 
            sta __fff8         ; $d76a: 8d f8 ff 
            pla                ; $d76d: 68       
            rts                ; $d76e: 60       

;-------------------------------------------------------------------------------
__d76f:     sta $10            ; $d76f: 85 10     
            sty $11            ; $d771: 84 11     
            pla                ; $d773: 68       
            sta $12            ; $d774: 85 12     
            clc                ; $d776: 18       
            adc #$03           ; $d777: 69 03     
            tay                ; $d779: a8       
            pla                ; $d77a: 68       
            sta $13            ; $d77b: 85 13     
            adc #$00           ; $d77d: 69 00     
            pha                ; $d77f: 48       
            tya                ; $d780: 98       
            pha                ; $d781: 48       
            lda $04            ; $d782: a5 04     
            pha                ; $d784: 48       
            jsr __d790         ; $d785: 20 90 d7 
            sta $10            ; $d788: 85 10     
            sty $11            ; $d78a: 84 11     
            pla                ; $d78c: 68       
            jmp __d79c         ; $d78d: 4c 9c d7 

;-------------------------------------------------------------------------------
__d790:     ldy #$03           ; $d790: a0 03     
            lda ($12),y        ; $d792: b1 12     
            pha                ; $d794: 48       
            dey                ; $d795: 88       
            lda ($12),y        ; $d796: b1 12     
            pha                ; $d798: 48       
            dey                ; $d799: 88       
            lda ($12),y        ; $d79a: b1 12     
__d79c:     sta $04            ; $d79c: 85 04     
            tay                ; $d79e: a8       
            lda __fff2,y       ; $d79f: b9 f2 ff 
            sta __fff2,y       ; $d7a2: 99 f2 ff 
            lda $10            ; $d7a5: a5 10     
            ldy $11            ; $d7a7: a4 11     
            rts                ; $d7a9: 60       
Learning how bankswitching works is completed.

Disch

  • Hero Member
  • *****
  • Posts: 2713
  • NES Junkie
    • View Profile
Re: Mapper Conversions Issues Question
« Reply #4 on: October 16, 2017, 09:57:33 pm »
Yes, there are several swap routines in there.  A lot of that will need to be rewritten.

Dracula X

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • My YouTube Page for ROM hacking
Re: Mapper Conversions Issues Question
« Reply #5 on: November 03, 2017, 01:41:07 am »
Sorry about the bump! I know what the problem was!

It was the bankswitch code itself and I was able to fix the problem so here's what I did:

In the bankswitch code for MMC5, only need to change two things.

Change:

1.PHA to PHP
2.PLA to PLP

That's it!

The rest of the code is fine in MMC5 bankswitch code.
« Last Edit: November 03, 2017, 01:47:41 am by Dracula X »
Learning how bankswitching works is completed.

Disch

  • Hero Member
  • *****
  • Posts: 2713
  • NES Junkie
    • View Profile
Re: Mapper Conversions Issues Question
« Reply #6 on: November 03, 2017, 11:05:47 am »
Eeehhhh?  That seems dubious.  Can you post the bankswitch code you're talking about?

Dracula X

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • My YouTube Page for ROM hacking
Re: Mapper Conversions Issues Question
« Reply #7 on: November 03, 2017, 12:16:05 pm »
Sure!

Code: [Select]
bankswitch:
php
asl
adc #$80 ;ADC or ORA
sta $5115
plp
rts

I tested the whole gameplay and haven't ran into any problems.
Learning how bankswitching works is completed.

Disch

  • Hero Member
  • *****
  • Posts: 2713
  • NES Junkie
    • View Profile
Re: Mapper Conversions Issues Question
« Reply #8 on: November 03, 2017, 08:52:47 pm »
ADC here makes no sense --- that REALLY should be ORA.  But ADC will have the same effect since C is getting cleared by the ASL.  Still -- I'd use ORA anyway.

Other than that I got this confused with Final Fantasy when I made my earlier comment.  Yeah PHP/PLP there is fine.

Dracula X

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
    • My YouTube Page for ROM hacking
Re: Mapper Conversions Issues Question
« Reply #9 on: November 03, 2017, 09:26:05 pm »
I'll use ORA then.

Code: [Select]
bankswitch:
php
asl
ora #$80
sta $5115
plp
rts



Thanks for all the help!

Btw, try to correct this in your MMC5 hacks as well.
« Last Edit: November 08, 2017, 02:38:43 pm by Dracula X »
Learning how bankswitching works is completed.