Original Post

The last few days I’ve been fooling around with the debug modes in a few Virtual Boy games.

The biggest discovery was that Vertical Force’s debug menu is fully accessible in the retail game without hacking. I was also able to make a tiny bit of progress getting SD Gundam’s debug menu up, and lastly I made a small custom patch to change how the Virtual Bowling debug menu is launched. I want to give Parasyte huge credit for the Vertical Force discovery and my little Bowling mod, as both relied heavily on that original hacking work done some 20 years ago.

Vertical Force
Notably, Parasyte predicted in the readme for the original debug mode hack that, given its high-quality presentation, the menu might be accessible in-game. Well, it’s nice to know that hunch was right, all these years later! To access the debug menu, open the Config menu then press the following sequence of buttons:

  • Left D-Pad Left
  • Left D-Pad Left
  • Right D-Pad Right
  • Right D-Pad Right
  • Left D-Pad Up
  • Right D-Pad Down
  • Left D-Pad Up
  • Right D-Pad Down
  • L
  • R
  • Right D-Pad Right
  • Right D-Pad Right
  • Left D-Pad Left
  • Left D-Pad Left
  • Right D-Pad Up
  • Left D-Pad Down
  • Right D-Pad Up
  • Left D-Pad Down
  • R
  • L

If you don’t want to remember all that, there’s obviously Parasyte’s existing hack here on virtual-boy.com, which forces the debug menu to load on startup. Alternatively, there’s now a patch on The Cutting Room Floor’s Vertical Force page which replaces this button sequence with a single press of Select on the Config screen.

SD Gundam: Dimension War
It’s been known that SD Gundam has some sort of stage select for a while now, but as far as I know nobody has managed to trigger it in-game. I wasn’t able to get the menu working, but I did manage to get it to at least load and display on-screen.

The function at 41EE8 in the ROM is responsible for the debug menu. I wasn’t able to find if there’s anywhere in code which jumps to this function, but I’m just goofing around in an emulator. Somebody more capable (and with access to a disassembler?) may very well be able to take this further and get the debug menu fully working.

That said, you can force the game to jump to this function to at least see the menu, albeit without it actually functioning. Editing offset 7FD0 in the ROM from 01 AC E4 FE (jal fff27eb4) to 03 AC 18 9F (jal fff41ee8) will replace the main menu screen with the “SELECT GAME MODE” menu. From here, you can’t really do anything. A/Start will boot the game, but it’s not otherwise possible to navigate the menu or do anything useful. I’ve attached a screenshot of this menu, since looking at a screenshot is about as good as doing it for real with this half-baked modification.

I haven’t bothered making an IPS patch for this change because it’s basically useless, but I think it’s very likely somebody knowledgeable could get it into a completely working state. Who knows, it could even be like Vertical Force where the debug mode is accessible without hacking but nobody’s figured out how to open it yet.

EDIT: I finally managed to figure out Bob Vanderclay’s V810 Disassembler and got SD Gundam disassembled. I can confirm that there are no jumps to the debug menu function anywhere in the game (unless they’re obfuscated, but I’ll get into why I think that’s unlikely). What there is, however, is a dummy function at 7B8C which immediately jmp [lp]s, i.e. calling the function simply returns. There are also 28 calls (!) of this function scattered throughout the game’s program, including in conspicuous places like the start of the main menu function. Every single one of them is additionally stepped over with a jr, so the dummy function itself is never actually called.

My supposition is that the central portion of the game’s debug code lived in this function, which was compiled out for retail. This function would have handled jumping off to the various debug functions based on what functionality was called for at any given point in execution. This means it’s substantially more difficult for debug to be re-enabled in the retail build, because whatever this function used to do is completely opaque to us from the perspective of the final build. Depending on how thoroughly the rest of the debug code was scrubbed, it could be theoretically possible to restore the functionality by reproducing this function blind, but that would be a huge undertaking and require somebody with much greater ability than I have. Sorry for the downer result!

Virtual Bowling
This one is probably the least interesting, but I made a small hack to adjust how the debug menu is launched in Virtual Bowling. Parasyte’s patch here on virtual-boy.com simply forces the debug menu to open on start-up. This sort of means you need to keep two separate Virtual Bowling ROMs around depending on whether you want debug today or not. My modified patch instead checks whether you’re holding the Select button on start-up. If you are, the debug menu is triggered, otherwise the game boots normally. You can download this modified patch from The Cutting Room Floor’s Virtual Bowling page.

  • This topic was modified 8 months, 2 weeks ago by Vague Rant.
Attachments:
85 Replies

Oh, that’s odd. It should be that if you hold Select while powering on the Virtual Boy, it prints “DEBUG” in the bottom right (screenshot attached) and you can use all the debug features documented in the Guides section here on virtual-boy.com. The easiest thing to check is that during gameplay, L + R together skips the current floor.

It works on emulators, but maybe the Virtual Boy doesn’t start registering input until after I do my startup check?

Ah I see.
No, I hold the select-button from before turning on the VB until I am in the title screen and no “debug” message in the lower right corner.

Intriguing, thank you. I don’t really properly understand how the Game Pad works, but the Tech Scroll says all kinds of stuff about latch signals and things that need to be set to receive input values. I don’t know anything about that stuff and just reading the input registers works at any time in emulators, but it seems like there’s supposed to be some setup that comes first on hardware.

I’ve just made a couple of changes which try to copy what Jack Bros. does natively to initialize the Game Pad, so if you wouldn’t mind I’d love to hear if either of them makes a difference. TEST-2 goes a bit further and is probably more likely to work on real hardware if either of them do.

Oh, and the Select button check happens before anything is even on-screen at all, so as soon as you can see the warning screen you can release Select and it will have either worked or not worked, regardless.

I have tested both of them and unfortunately neither worked.

Bummer, but thanks for testing.

I’ve attached another version if you wouldn’t mind; I’m taking a different approach this time. I’m still reading input right at the start before the warnings have shown, but I’m running my check after what I think is the game initializing the input registers, so this should be like reading input at any other time during the game. It works fine in emulation!

Thanks again for your patience in helping resolve these bugs.

Okay, I will try this this evening after work.

Can confirm that the v1.3_hardware-test-3.ips works! Debug mode is shown in the tite screen and when pressing L+R you just fall down to the next floor.

Excellent, very glad to hear that. Much kudos to you for helping to get that resolved.

GitHub has been updated with the Jack Bros. v1.3 patch (identical to hardware-test-3, no need to patch again!) as well as new patches for Vertical Force (both regions) and Waterworld. If we include the six games that already had saving support from the factory, this brings us to more than half of the officially released Virtual Boy games:

3-D Tetris, Galactic Pinball, SD Gundam, Teleroboxer, Virtual Boy Wario Land and Virtual Fishing with official saves, plus Golf, Jack Bros., Mario Clash, Red Alarm, Vertical Force and Waterworld via hacking. 12/22 games!

Which reminds me …

PS: are there any other games where save features could be included?

I forgot to answer this the other day. While I’m absolutely not guaranteeing anything since I haven’t so much as looked at their code yet, the games I’m personally most interested in looking at from the remaining titles are Space Squash and V-Tetris.

Space Squash looks like it will probably be somewhat difficult. From what I’ve seen, there’s not any kind of built in menu where you can manage progression like Mario Clash already had, so I’m not sure how continuing a saved game would even work, assuming I can figure out saving progress in the first place. I’m definitely less confident I’ll be able to do anything for that one. On the other hand, V-Tetris shouldn’t be too complicated, since it already has high scores and a place on the screen to display them. In that case, it just needs the ability to store and retrieve those scores from SRAM.

I did briefly look at Space Invaders, but that game’s code was such a mess I decided to move on to other games. I might come back to it eventually, but I only really looked into it at first because it seemed simple. Looks can be deceiving! It’s difficult to follow the program flow. Instead of calling functions “normally”, the next address in code gets stored on the stack (a part of memory that’s always shifting and changing) then pulled in by another function whose job it is to jump to it. Tracing things backward to find how a function came to be the one that’s running is really confusing.

Beyond that, the other games with password save support (Insmouth no Yakata, Panic Bomber and Virtual Bowling) all seem like they would be possible to adjust to at least save your current password, like the Jack Bros. patch used to before the save menu was added. I don’t now how bothersome the passwords are in any of those games though, so I’m not sure whether I’ll get to them currently.

Somebody asked me about Teleroboxer, but that game has battery saves already, so I’m not sure what I could add there.

This leaves a few games I don’t really have much interest in looking at: Mario’s Tennis, Nester’s Funky Bowling, Virtual Lab and Virtual League Baseball. That last one technically is another password-save game, but I personally find it one of the least enjoyable games on the platform, so it’s tough to get motivated to look at it. The rest, I don’t think would really benefit that much from saving, since they don’t really have much to save or progress through. I’m not ruling any of them out, they’re just at the bottom of my list currently.

Thanks for the comprehensive answer!

I have to thank you for all those incredible patches.

This puts me really into a dilemma, because except of Waterworld I already have all the games and now I want them with the save features 😉

Speaking of further games:
I just cleared Space Squash yesterday and yes, a save feature would be great, but I assume this will only be highscore saving, and not progress?

V-Tetris would be cool with highscore save support, I totally agree.

I can´t speak of Virtual League Baseball, I don´t have this game, but I think it would be nice to have a save-feature when playing a season (if the game is enjoyable enough and you want to do this 😉 ).

Nester´s Funky Bowling would be cool, but I think after a while you only see your name in the highscore list…

One side-note: if you combine your Red Alarm Save Patch with the Single Press Debug Menu patch the debug menu does not work.

I just cleared Space Squash yesterday and yes, a save feature would be great, but I assume this will only be highscore saving, and not progress?

Both, actually. I have a test build currently that I think is probably ready to go on GitHub, it might be up there already by the time you read this, but if not, here’s the latest: Space Squash saving test

Each time you beat an Area, it saves your game, so if you run out of retries or shut off the console at that point, you can pick up again from the start of the area. This does make the game quite a bit easier since Retries only need to get you to the next Area instead of all the way through the game, but it was the compromise I arrived at between convenience and making the game too easy by e.g. saving every time you beat a single level, which would make the game trivial.

One side-note: if you combine your Red Alarm Save Patch with the Single Press Debug Menu patch the debug menu does not work.

That’s interesting. I did look at HorvatM’s patch and we never touched the same areas of ROM, so I just assumed it would be fine. Testing out both patches running together in Mednafen, I can still pull up the debug menu without issue with L + R + Select + A during gameplay. The one issue that will definitely occur is that my hack disables high score saving while debug mode is active (so you can play around in debug mode without wrecking your “real” high score) but my check relies on the original unmodified behavior, so it won’t work with HorvatM’s patch (i.e. debug high scores will save over your real score). But that’s pretty secondary if the debug menu isn’t working at all on real hardware. I can’t really imagine what would cause that since I didn’t change the debug menu in any way in my hack. I have been meaning to go back to Red Alarm to make the score-protection feature handle HorvatM’s change, but it might need more work if there’s a bigger issue at play here.

EDIT: Just for a bit more info, in in terms of the debug menu not working, does the explosion sound effect play on the title screen to indicate that you’ve enabled the debug mode, or is there no response whatsoever when you press Select?

Crazy, just crazy what you are capable of!
I will try Space Squash as soon as possible.
And again, if this works (and I assume that), I also want this as reprocard. But at least I think I can sell it easier than other games, since there is a higher demand for this game. I paid quite a bit of money for this Japanese exclusive.

Regarding Red Alarm: the explosion sound appears on the title screen, but during play the debug menu just won´t show up when pressing L+R+Select+A.

Good to know, thanks. Do you know if it’s definitely the combination of both patches together that breaks it? I can’t find any way that HorvatM’s and my patches interact, but perhaps I broke it in my patch even without HorvatM’s?

I will try to get in the debug menu with your save patch applied only.

Can confirm that the debug menu in Red Alarm works when only your save patch applied. Must be in combination with HorvatM’s patch that it will break.

EDIT: Tried your Save Squash patch: it saves the progress, but not the high scores.

  • This reply was modified 7 months, 3 weeks ago by abarth.

Thanks yet again for all your testing. Really odd the issue with mine and HorvatM’s patches in conjunction. I’ll have to look into it some more. For now, I’ve published the next set of updates for Red Alarm, Space Squash (same as the version in this thread) and V-Tetris.

Ironically, the Red Alarm patch is aimed at handling the “high score protection” feature I was talking about earlier when used in conjunction with HorvatM’s patch, but it doesn’t (or at least shouldn’t!) do anything to fix their actual incompatibility. In older versions of my patch, I was checking if the user had pressed Select 60 times, the same way the base game detects that debug mode is active. Now, I’m specifically reading the byte that says how many times you need to press Select, so even if that value is hacked to 15 or 90, it should still work. But again, this doesn’t resolve whatever is going wrong in terms of them actually working together.

Re: Space Squash, which high scores are you looking at specifically? I deliberately don’t save your current score when saving and continuing because that would be easy to abuse to get a much higher score than you actually earned. Instead, scores only get saved when you game over (or finish the game) and enter your initials. The high score table shows up if you sit on the title screen for a few seconds looking something like this:

When you Continue a game from the main menu, your score will always be zero. I’m open to changing that in an update, though. The problem is that allowing you to keep your score when Continuing would basically make all scores meaningless. Did you achieve that by never losing, or by losing a bunch of times and continuing over and over until you did well? Maybe there’s a decent compromise solution here, like your score gets dropped to zero if you run out of Retries, but otherwise it carries across the save? People could still exploit it by just shutting off the game before running out of Retries, but it’s a single-player game so it doesn’t really matter if people want to cheat their high scores.

Yes, I mean the highscore after you loose a game, exactly the same screen you show in your screenshot.
I played until the second area to see if the continue works, and then lost the game by purpose. I then entered my three letters in the highscore list, turned off the system and restarted it and the high score was gone.

  • This reply was modified 7 months, 3 weeks ago by abarth.

Oh I see, very interesting. I don’t really know how flash carts work, is it possible for you to share your save file? It would be useful to be able to see if the scores are there in the save but just not showing up in the game, or if they’re wrong in the save as well.

EDIT: I also just noticed a bug in saving the Area/Stage where a score was achieved which I’ve fixed on GitHub, but this shouldn’t be relevant to whatever made your score vanish entirely.

yes, save file attached.

  • This reply was modified 7 months, 3 weeks ago by abarth.

With apologies, I’m mostly thinking out loud in this post.

I’m learning two things from this. For one, many of the unused bytes in your save are FF, when the first thing I do upon boot is clear out SRAM by replacing it all with 00. My original method of clearing out SRAM was to write “four” (but two on Virtual Boy) bytes at a time using a st.w (store word) instruction, but it looks like that’s not actually clearing out the SRAM as intended on real hardware. I’m guessing that every byte needs to be written out individually, using a st.b (store byte) instruction. That said, this doesn’t explain your score not writing out successfully, since those are written with st.b.

Secondly, your save is definitely completely missing your high score, as if it was never written out at all, or else was replaced with the original score after the fact. The only intended way for scores to be erased is with the L + R + Left D-Pad Down + Right D-Pad Down combo on the title screen, which should erase the entire SRAM back to 00 before starting over (writing all of the default scores and config settings back into SRAM again) but as discussed may have been failing on real hardware due to use of st.w.

This is definitely a tough one. In writing out the scores, I’m making certain to store them at 2-byte intervals per the limitations of Virtual Boy SRAM. But the high score table is completely untouched in your save, it’s identical to the one that gets loaded in on first boot with all of the pre-loaded default scores/initials. The fact that these are unmodified but your game progress is still visible (I can see you beat one Area then chose the bottom path and picked up Speed, Power and Health upgrades along the way) seems to indicate that the new initials, score and area/level were never written out to SRAM at all. Obviously this works fine in emulation; I even tried to simulate your situation as closely as possible by matching your exact score so that I got the 9th slot, etc.

The way the game works, the different score bytes are actually written out at slightly different times: when you Game Over, the game writes your new score into the table and moves the other entries down the list, then writes the Area where you hit Game Over and moves the other areas down the list, then writes the specific Stage where you hit Game Over (and does not move the previous Stages down the list, this is an original game bug from 1995 that’s fixed in my patch), then it writes three blank spaces (literally the normal ASCII space character like the several hundred in this post) into the high score table. Then, once the game moves to the high score screen, it finally writes out your initials as you enter them over the space characters that were previously written out.

In your save, none of this has worked: the score, Area, Stage, blank initials and real initials have not been written out to the save at all. So not just one thing has gone wrong, but five things. Perhaps there’s some situation where the score is written out via a different code path than the one I’m modifying to write saves into SRAM, so the new scores write out to RAM but my changes to copy them to SRAM are never reached. But looking at the full disassembly, there’s only two places where the high score addresses get written out: when you get a new high score, and when the game is shifting the old scores down the table to accommodate your new score and I’m patching both of those to write to SRAM. Certainly, a matter that requires more investigation.

For now, I’m attaching new patch versions for all eight games I implemented saving for (i.e. no Golf, since I really just restored T&E Soft’s save support–none of the actual save reading/writing there is mine). Really the only thing that these do differently is to initialize (i.e. erase) saves in a way that I hope is more agreeable on real hardware. There shouldn’t be any noticeable differences in terms of bug fixes barring some edge cases, e.g. Vertical Force might have been bugged on real hardware due to the way I was setting the default best scores/times, but you have to beat the entire game to see the high scores, so it’s a pretty difficult one to test even via emulation.

Obviously I don’t expect you to test all eight of these patches; like I said, there should be no difference for most of them. If you wouldn’t mind though, I’d be interested to see a fresh save from any one of them, though. By fresh save, I mean deleting any older save either via whatever mechanism is available on flash carts, or the L + R + Left D-Pad Down + Right D-Pad Down combo included in most of the hacks–Jack Bros. doesn’t have it, so not that game. That would allow me to confirm that saves are at least being initialized correctly, but for now that won’t necessarily bring me any closer to figuring out what’s going wrong with high score saving in Space Squash.

Speaking of Space Squash, I’ve also attached a cheat patch here just in case it’s useful to you in testing. It’s what I’ve been using during development and makes all matches start with a 2-0 lead and all enemies (including bosses) start with only 1 HP, so with a bit of luck, you can make your way through the stages a bit quicker.

 

Write a reply

You must be logged in to reply to this topic.