Thursday, 3 July 2025

Why did the frog cross the road?

Managed to fix the never-ending frogs left display; from memory (I've forgotten already) it was a flag/timer that was never updated in what I had transcoded, so it was forever decrementing a frog.

I also managed to get the player inputs working, after implementing another cascading execution flow of arbitrary flags and counters. Ironed out a few bugs in the input routines in the process and can now hop around the screen within the confines of the coded limits.

Hopping across the road in game mode

On that note, I had never realised you could jump down below the starting row, and over the timer bar. But I did subsequently confirm this on the emulated Frogger in MAME. You also can't jump left/right from the uppermost ('home') row, but that's a moot point because hitting that row you're either home or dead.

So with nothing to kill the frog, the time runs down until "TIME OVER" is displayed and then it just sits there. I'll now look at finishing off the logic that will properly end the game and re-enter attract mode. Besides a few bits that I've purposefully skipped - like high score table update - that'll be everything outside the gameplay mechanics of moving the objects and killing the frog.

I figure (roughly) that the transcode is now 30% done.

Wednesday, 2 July 2025

My frog still won't budge

I've been working towards getting the gameplay to a point where I can control the frog. Given that it hops around in attract mode, I figured the mechanics at least were there. But it has been a bit of a slog to get to the point where it will actually move, and I'm still not there yet.

The transcode is approximately 30% complete now, and during that time I've made very little progress on the RE side of things. I've named a few timers here and there but that's about it.

[rant]

I can't hold back any longer; this really is crappy code. For the amount of time I've spent on RE and transcode with this project, I can't believe I still don't have a clear picture in my head about the overall program structure. It's a tangled mess of spaghetti code with execution paths that just meander through the memory space, duplicated functionality in the code, functions that call seemingly unrelated subroutines, duplicated variables (as far as I can tell) and a plethora of flags and timers that defy a precise description of function. I can't even partition the code in my head between NMI (which is triggered by VBLANK and must run FAR longer) and main execution, they both seem to be doing a little bit of everything. This had to be written by an intern at Konami.

[/rant]

Anyway, the lack of structure makes it very difficult to work out which parts of the code I need to implement to get the player controlling the frog. You just need one timer to not be ticking, or one flag to not be set, and the whole execution flow breaks down. In my handful of transcodes thus far, I've never had this problem. It's going to be painful.

So the plan forward is to continue on with the transcode, and do what little RE I can in the process. I'm aiming to get the frog moving without any of the traffic or logs, turtles etc. in the picture but, given what I've seen so far, I wouldn't be surprised if the timer used (and updated in) the diving turtles routine also handles player inputs! OK, maybe not that bad, but it's a challenge.

I'll leave you with a screenshot of what I see after coining up and starting a game. Currently the code is continually incrementing and printing the number of frogs, and I'm not sure why yet. Maybe I need to look at the bonus frog logic...


It keeps incrementing the number of frogs...

UPDATE: It's actually calling decrement frogs continually...

Friday, 27 June 2025

Frogger

It's been a long time since I posted anything on this blog, and that's because I haven't done anything retro-porting related in all that time. I had started on a now-stalled project creating a new core for the MiSTer hardware, but even that was probably a year ago now.

In recent weeks I decided it was time to work on another port. To be honest, I struggled to find a candidate that I was both interested in personally, and could run on the Neo Geo - my favourite retro platform for porting. I was really looking for a horizontal title, but finally settled on Frogger thinking it would be relatively simple. After all, I had done Galaxian and it is essentially the same hardware.

I'm now a few weeks into the RE - I'd estimate about 65% done - and have actually started on the 68K implementation before finishing the RE. Initially the decision to start on the implementation was more due to impatience than anything else, but I've actually found it helps with the RE.

Not surprisingly, I was able to create the Neo Geo assets for Frogger using the same tools I built for Galaxian, almost without any changes. Ditto for the Neo Geo code itself. I'll have to keep this in mind for any future projects on the same hardware, and there were quite a lot of games on Galaxian hardware, even if some were bootlegs.

So, right now the attract screens - title, points table, high score, insert coin - have all been implemented. The static elements of the gameplay screen are drawn in attract mode, and the frog happily leaps across an otherwise empty screen as the time bar counts down. You can also coin up and start a game, though visually it appears to just hang on the start screen. A crude comparison of the Z80 and 68K assembler listings would suggest the transcode is about 21% done.

A few screenshots of  Neo Geo Frogger in action.

The frog hops around in the attract mode gameplay

The next step is adding gameplay elements. This will be a process of RE and transcoding in parallel.

Monday, 6 November 2023

And that's probably it for Vulgus!

I've decided to put Vulgus to bed.

After a fruitless session, I've exhausted my interest in finishing the RE. Given that I don't have plans to transcode it at all, the ROI for the remining sections is miniscule.

The few remaining 'free-standing' variables are flags and timers for spawning various alien types. I could probably stare at it long enough to come up with some sort of meaningful name for them, but I'm not going to.

The various alien object tables have indeterminate member variables that are almost certainly related to movement, whether they be timers, velocities and/or accelerations, or movement table pointers. I've spent some time trying to nail them down, but the different object table structures for different aliens makes it a nightmare.

Finally, the data structure used to generate and keep track of the background map is missing a whole heap of values, including pointers and offsets into various tables of meta-data, tile codes and colour palettes. I've tried a few times now to decypher it all, but it just leaves me with a headache.

I've thought of simple patching/lifting the source for the purpose of generating the full map, but even that seems overwhelming atm. I think I've simply burnt out on Vulgus.

That's it for Vulgus... for now at least.

I will continue to play it and hopefully (finally) see the titular Vulgus for myself. Part of the quandary I have is that I have no idea how the elements of the final boss look or behave, which makes it difficult to RE the code related to it, and I don't want to spoil the game for myself by cheating or watching a YouTube video.

Let's see what takes my fancy next...

You'll want to collect 'E' as well!

Another session, another few variables decoded (RE'd). Most of the 'free standing' variables have either been decoded, or I have at least some idea of what they do - just not the specifics. A surprising number of seemingly unused variables in the code; initialised but no cross-references to code that reads them. Setting watchpoints in MAME tends to confirm too.

There is a timer for spawning the non-firing or 'kamikaze' aliens in the game (spinning star-discs, black blocks etc) which is initialised after every spawning. However the value from which it is initialised is itself never initialised, other than being zeroed at program initialisation time. As a result, the non-firing aliens tend to come thick and fast in the game!

Related to this; formations (worth big points) consist of either 5 or 6 aliens as specified in a table entry. However the game will 'give up' waiting for 5/6 free slots in the object table after while and just spawn as many aliens as it can given the free slots - which means you may have to kill less aliens to get the bonus formation points! After all these years playing it, I never noticed this!!! 😶

I've finally detailed the result of missing the letter 'E'. Again, the manual suggests an immediate effect when it appears, however it is when you fail to collect it that something happens. In the case of the letter 'E', without going into excruciating detail because it is a little complicated, missing it increases the frequency for spawning of firing aliens (only). Not that it would be possible to increase the frequency of the non-firing aliens because of the abovementioned feature/bug. And like the letter 'D', at some later stage it becomes a moot point because the area will start with maximum frequency anyway. It has no effect on the big/mega aliens either.

Nothing to do with 'E', just eye candy for attention

Aside from the handful of 'free standing' variables mentioned above, it's mostly variables in the map and object tables that haven't yet been fully RE'd. And these of course relate to the two outstanding areas I mentioned in the last post, namely map generation and alien movement.

TBH I'm at the stage now where I just want to be finished - I'm thinking too much about the next project. However I think if I tackle the alien movement next it'll unlock a lot of the outstanding object variables, if not all. That'll leave just mostly map generation. And it would be nice to write something to display the entire map...

Thursday, 2 November 2023

Parallax Scrolling!?!

Another quickie; cracked a few more variables in the last session which revealed an interesting if subtle detail to the game.

I had previously deduced the meaning of one variable to be the amount by which the background had scrolled left/right (dy), so it could be used to update, for example, the map and objects superimposed on it. Turns out that whilst I was close, I wasn't quite right.

There are actually two (2) variables updated when the ship is moved left/right; the abovementioned and another variable, updated by a slightly different amount. The other variable is actually dy for the background and ground-based objects and the first variable is dy for airborne objects, such as bullets and aliens.

What this means is there is a subtle parallax scrolling effect when moving the ship left/right! It is hard to notice when playing, but the effect is that your bullets (and certain aliens) will move left/right slightly less than the background moves.

[I should note that I use dy for left/right movement rather than dx because the screen is rotated, and the offset is made to the sprite register that is documented as the 'Y' register. Ultimately it's less confusing to reference the hardware than the physical orientation of the monitor, especially if the hardware is used for multiple games, some horizontal!]

It is getting harder and harder to progress, but I'm yet to finish a session without making at least some progress. A few variables seem to be initialised but never used (like the letter 'S'), but it's not straightforward to prove they're never used. In some cases the best you can do is set a watchpoint in MAME and play the game...

Here are the areas I have visited but have yet to complete:

  • Background map generation/rendering; the data appears to be packed into blocks of meta-data
  • Alien movement; alien movement is all table-driven
  • Planet/Area data that affect difficulty; some of them are simple spawn timers or alien types but I haven't decoded every single parameter as of yet
I think that's about it.

Monday, 30 October 2023

'S' is for... nothing!

Just a quick one... still progressing on Vulgus, chipping away at the unknown variables.

Indications are that the letter 'S' does... ABSOLUTELY NOTHING! I can't find any cross-references to it in the code, other than initialisation and updating a counter (max=4) when one disappears off-screen. A watchpoint in the MAME debugger doesn't reveal any accesses to the variable either.

Somewhat puzzling given that the other two letters do affect game play.

Random Vulgus picture for attention

I've been working on ROMSET #2 in MAME, so I decided to load up ROMSET #1 and see if that had any references to the variable. Took quite some time (two sessions) to get to the point where I could analyse the code in some detail - because of all the jump tables used in the game - but couldn't find any other references. Similarly playing the game didn't trigger the watchpoint.

I did however notice one difference in game play logic, and there are more. Interestingly ROMSET #1 allows 10-character names in the high score list, whilst #2 is only 3 characters. When I've finished the RE I will go back and analyse the differences in detail.