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

Author Topic: Bankswitching in UNROM  (Read 1319 times)

Dracula X

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • My YouTube Page for ROM hacking
Bankswitching in UNROM
« on: August 26, 2016, 10:19:40 pm »
So I finally know how to bankswitch in UNROM but the tricky part is where to put the code in a new location. It could be reprogram the whole code or some. How I found out where to put the new code is to use the code/data/logger to find out where to put the code at that's highlited in "Dark-yellow - the byte is code" in Hex Viewer while the code is finished logging.
I might go back to Thunder Force II hacking again.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7042
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Bankswitching in UNROM
« Reply #1 on: August 26, 2016, 11:02:30 pm »
So you know about the "bus conflicts" thing?
Where you must always write the ROM bank to a ROM address with the same value you want to write?
"My watch says 30 chickens" Google, 2018

Dracula X

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • My YouTube Page for ROM hacking
Re: Bankswitching in UNROM
« Reply #2 on: August 26, 2016, 11:31:16 pm »
Not yet but I'll give it a try!

I'm using this methood: http://wiki.nesdev.com/w/index.php/Programming_UNROM
I had the ROM expanded to 256kb.
I might go back to Thunder Force II hacking again.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7042
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Bankswitching in UNROM
« Reply #3 on: August 27, 2016, 11:37:47 am »
Yeah, typically games would do something like putting a list of bank numbers (00, 01, 02, etc.) at, say $C000.

Then a bankswap function would be like
(say A was the desired bank number)
TAY
LDA $C000,Y
STA $C000,Y
"My watch says 30 chickens" Google, 2018

Dracula X

  • Full Member
  • ***
  • Posts: 130
    • View Profile
    • My YouTube Page for ROM hacking
Re: Bankswitching in UNROM
« Reply #4 on: August 28, 2016, 01:31:33 pm »
OK! Now I understand how this works! I use Bus Conflict this time and now I know where to put the new code.

Example:

Code: [Select]
$9000 ; Bank 03
Test:
        lda #$07
        jsr bankswitch
------------------------------------------------------
$9005 ; Bank 07
newcode:
        ldy #51
        newcode2,y
------------------------------------------------------
.org $8000 ; Bank 07
 newcode2:
        .byte $03,$03
------------------------------------------------------
That's it!

The code is from "The Guardian Legend".
I might go back to Thunder Force II hacking again.