Hacking Classic NES Sleepmode working on EZ FLASH IV

themojius

Member
OP
Newcomer
Joined
Jun 12, 2015
Messages
7
Trophies
0
Age
28
XP
83
Country
United States
There may still be some of you out there who still, after all this time, prefer flashing the Classic NES GBA games to pocketnes or HVCA. Personally, I prefer the official series because it seems to be the only way to run the Japanese Mario 2 with good audio on an EZ FLASH IV. I think for a long time it wasn't even a viable option to run the series because of the intense copy protection and finally the inability for there to be a sleep mode. Today, that's pretty much all taken care of, though.

I found kuwanger's info in this thread a while ago, explaining what to look for when manually editing out the sleep interrupt using VBA's disassembler to find where to change a value in hex.
This is actually really useful on its own as a tool to fix games like Yoshi's Island which have a built-in sleepmode that doesn't work on flashcarts.

It turns out this method doesn't ordinarily work for the Classic NES games, as the line of code you end up with when putting the games into sleep mode doesn't have the code pattern you're looking to locate and edit around!
...Or does it? B-) Here's what you need to do to get sleep working on your Classic NES game of choice, courtesy of kuwanger's instructions that I heavily modified:



1. Run an affected rom under VBA (in this day and age, VBA-M-WX or whatever.) Make sure it isn't yet patched with those helpful patches lying around that let you run Classic NES games and Famicom Minis on your flashcart, because the roms give a cartridge error in the emulator if they're patched already.
2. Open the disassembler (under Tools) and set it to "automatic update." but keep a close eye on it during the rest of the process.
3. Pause the rom and enter sleepmode in the L+R menu by holding the enter button while hitting CTRL-N once.
4. Keep pressing CTRL-N until the code jumps to an area with lines like this:
Code:
080fb8e8  0189

That is to say, an area with the first block starting with 08 and the second block being only 4 characters long.
5. Scroll down or up around 25ish lines until you see something like this (the first line, mainly.

Code:
0800045c  21c0 mov r1, #0xc0
0800045e  0189 lsl r1, r1, #0x06
08000460  1c08 add r0, r1, #0x0
08000462  3a02 sub r2, #0x2
08000464  8010 strh r0, [r2, #0x0]

6. Make note of the address where that first line is (0800045c into hex is 0x00045c) and go there using a hex editor to open the rom. Overwrite (do not add to the rom) the C0 you find there with a 40.

tl;dr to get sleep mode on classic nes games, use frame-by-frame when going into sleepmode for when it jumps to the 08000000 0000 area. find and replace the C0 at (21c0 mov r1, #0xc0) with a 40 in a hex editor. When you patch it and send the game to your cart its built-in sleep mode will work.

tl;drII use pocketnes.



Edit: There are a lot of values for the North American and even Japanese Classic NES games down there, provided by Gyron generously, along with improved hex edits for some regular GBA games. Enjoy!!
 
Last edited by themojius,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,348
Country
United Kingdom
Nice work. I always opted for the other emulators because of the features and alternative approaches to scaling but I must admit I never tried Japanese Mario 2 to see what goes with audio.
 

Gyron_Oldvic

Well-Known Member
Member
Joined
Dec 10, 2014
Messages
302
Trophies
0
XP
784
Country
United Kingdom
I did these plus a few of the Famicom Mini's a while back for my 3in1. I have a couple more too not on the wiki page. Also, the Super Mario Advance 3 and 4 entries were incomplete. There was an additional area to patch for 'easy and auto sleep' to work correctly. Below are the addresses to patch.

Change the hex digits 'C0' to '40' at the following offsets to disable the interrupt:

Super Mario Advance 3 - Yoshi's Island (U)
0x0FB8E6 (for in-game sleep)
0x002978 (for easy + auto sleep)

Super Mario Advance 4 - Super Mario Bros. 3 (U) (v1.1 aka Rev 1)
0x0B68A0 (for in-game sleep)
0x00056E (for easy + auto sleep)

Golden Sun (U)
0x5EC4E0

Classic NES - Bomberman (UE)
0x0003C6

Classic NES - Castlevania (UE)
0x0003F0

Classic NES - Donkey Kong (UE)
0x000458

Classic NES - Dr. Mario (UE)
0x00046A

Classic NES - Excitebike (UE)
0x0003BE

Classic NES - Ice Climber (UE)
0x00045C

Classic NES - Legend of Zelda (UE)
0x0003C6

Classic NES - Metroid (UE)
0x0003D8

Classic NES - Pac-Man (UE)
0x000466

Classic NES - Super Mario Bros. (UE)
0x00045C

Classic NES - Xevious (UE)
0x00046A

Classic NES - Zelda II The Adventure of Link (UE)
0x0003D2

Famicom Mini - Adventure Island (J)
0x0003DC

Famicom Mini - Ghosts n Goblins(J)
0x000472

Famicom Mini - Mario Bros. (J)
0x00046E

Famicom Mini - Super Mario Bros. 2 (J)
0x0003AA
 
Last edited by Gyron_Oldvic,

themojius

Member
OP
Newcomer
Joined
Jun 12, 2015
Messages
7
Trophies
0
Age
28
XP
83
Country
United States
Oof! Just saw this right after I did the process for the whole US library. Thank you though!! This saves me the trouble of posting in the original thread, and the ezflash wiki page isn't editable right now anyway. I'd love if you edited your post to give the other values. I'll edit the post to clue people in.
 
Last edited by themojius,

Gyron_Oldvic

Well-Known Member
Member
Joined
Dec 10, 2014
Messages
302
Trophies
0
XP
784
Country
United Kingdom
Oof! Just saw this right after I did the process for the whole US library. Thank you though!! This saves me the trouble of posting in the original thread, and the ezflash wiki page isn't editable right now anyway. I'd love if you edited your post to give the other values. I'll edit the post to clue people in.

Sorry you had to go through that. I should have posted them at the time really, but I went back to using my M3 which is unaffected by the EZ interrupt issue and forgot about them. I've cleaned up my post to make it clearer. I'll probably do the rest of the Famicom Mini's. I only did them four as they were all I had on my memory card at the time. I think I'll do some patches for those Classics for the EZ flash cards as they need patching in multiple places for Sram too.
 
Last edited by Gyron_Oldvic,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtu.be/shdHKa4iBbE?si=Vnb_FMMV54y2aarW lol Mario give me cancer