Aside from a couple of bugs in my transcode which prevented more than the first line of logs to be displayed, it was trivial to add the other 9 rows of scrolling objects.
![]() |
No scrolling yet... |
Now to get them scrolling!
This blog chronicles my progress porting various retro games to other retro platforms. The goal in each project - at least when targeting a new CPU - is to effectively replicate the original graphics and the original code line-by-line, to produce a 100% accurate port of the original game.
Very quick update; I've done some RE on the code to display the scrolling content and transcoded the top row of logs.
![]() |
I've transcoded just the top row of logs so far, the rest will be a doddle. |
In the process I came across what is possibly the worst piece of code I've seen in an arcade video game. I spent at least an hour to work out what it was doing; 20 lines of Z80 with a 6-iteration loop, only to replace it with quite literally two (2) 68K instructions (no looping). Pretty sure I could also re-implement it in Z80 in about 6 instructions, no looping. I might post more on this later...
Some RE tonight and a bit of a breakthrough.
Firstly, I have worked out one of the variables, which I thought more-or-less duplicated another, has a different meaning altogether. Certain things then started to make a lot more sense, and it meant a bit of maintenance on the existing RE. All done now.
Secondly, and this followed on from the abovementioned variable, I've RE'd a bit more of the data structures that define the layout for each of the levels. Still a bit of work to do, but knowing now what it is doing will make finishing this part a lot easier.
I'm almost embarrassed to admit that I wasn't (currently) aware of the fact that each row on the screen only contains a single object type; 4-tile logs, turtle duos, 6-tile logs, 3-tile logs, turtle trios, trucks, cars (type 1), cars (type 2), tractors & cars (type 3) - in that order. I probably did notice at one stage, but it only hit home tonight.
And AFAICT now, the game cycles through only 5 different layouts. Other 'random' factors to mix things up a bit include speed, diving turtles, alligators and seals/otters (whatever they are).
I probably have a few more RE sessions to complete the logic for the scrolling objects, and then I can look at continuing the transcode - row by row by the looks of it.
Haven't done a lot of work on Frogger lately, due in part to TdF and visiting family.
I did hit a patch in the transcode where I really need to progress on the RE, or I'm blindly coding unnamed variables and routines, and there's enough of them in there already.
Tonight I have identified the jump table that handles all the scrolling objects, and by extension, the area of RAM that holds the data associated with them as the game progresses. I discovered something surprising about it, but I'll leave it until I've confirmed it, which shouldn't take too long.
This has just opened up a the opportunity to RE a new set of routines and memory variables, so I'm hoping to make progress on those in subsequent sessions. Only then will I switch back to transcoding.
As a result, no new eye candy in this post, sadly.
Still plugging away at Frogger as time allows.
I've been working through the high-level foreground/background (depending on your nomenclature preference) and NMI code, ensuring I've transcoded everything that is not in a subroutine. Along the way I've managed to name a few more variables, mostly simple flags, but also decided others have multiple purposes (the classic 'temp' variable). Ugh. Work that had to be done, but resulted in no tangible difference on the screen.
My next thought was to implement the code that handles when your frog gets 'home' - that's quite brain-dead and clearly identified in my RE. Alas, it's not actually possible to get home without scrolling logs to position you in the center of each home. So back to the drawing board.
Next idea was to handle the (seemingly) random appearance of the fly in the frog's homes. There wasn't a great deal of code, and the timers involved were all ticking over already, so it didn't take a great deal of effort to see it working.
![]() |
A fly appears briefly! |
Now it's crunch time; no choice but to tackle the scrolling cars and logs, turtles, alligators etc. This involves diving into code that I haven't fully RE'd. Some of it I have a high level understanding of what it is doing, but don't understand any of the detail. For example there are tables of bytes that are copied into RAM that comprise logic & data for the scrolling entities, and calculations that are done on some of that data which escape my understanding atm.
But at the same time, there are aspects of the code that do offer good hints, like it seems there's a routine to construct/update each of the scrolling rows explicitly. So for example, I believe that I can transcode the routines to update, say, just the bottom row of vehicles on the road.
For now though, I'm in the middle of wrapping my head around a routine that I guess calculates where to start drawing the log on one of the rows. It works backwards from the VRAM address and a few bytes that would indicate some sort of scroll position maybe? Not the sort of routine that translates well from Z80 to 68K either, so understanding what it's doing is definitely going to be more beneficial than a brute-force transcode.
By my crude calculation, the transcode is now 39% done.
Turns out the 'freezing' of the game after GAME OVER was due to a simple bug in the transcode. It was trashing a whole bunch of variables from which it never recovered.
Now it runs back through the attract mode screens as it should.
I also transcoded the routine that updates the high score table after a game. It hasn't been tested yet as I am unable to score more than 300 pts, but at least it no longer highlights any of the scores after the game (it highlights the scores on the high score list - if any - from the last game).
I have the estimated transcode at 34% done, so now "officially" one-third done!
No eye candy today.
Not much time to work on Frogger now that it's school holidays AND Tour de France time... but I did get the score updated whenever the frog hops forward.
![]() |
Getting a frog to the top of the screen will earn you 100 pts. |
Not that I went looking to do this, but a side-effect of trying to stop the game freezing after GAME OVER rather than cycle through the attract mode screens again.