Saturday 26 September 2015

Let the porting begin

I've begun my experiment - porting the mystery game to C on the PC. It's rendering text on the main menu and the call tree has been coded for the sprite rendering. Next task is to import all the sprite data/tables and implement the low-level rendering.

I'm keeping as close as possible to the structure of the original Z80 code; memory variables are defined as globals and register contents generally passed as parameters to functions. Variables and functions exist in the source in the same address order as the Z80 code, which I've always done in the past when porting regardless of target language.

I'm thinking of actually using the resultant C code as the reference for the 6809 port, rather than the Z80 code. The register set and, in some cases, the instructions are so different that I may ultimately produce cleaner code in doing so. Hence the reason I'm adhering to the original structure - it will still produce a faithful port if done right. It'll be interesting to see how this approach pans out.

I was going to release more clues as to the game's identity as I progressed but I can't really think of any cool way to do so that aligns nicely with my progress. So for now I will reveal, as someone has correctly speculated, that the game is indeed from the library of the Sinclair ZX Spectrum.

Meanwhile, I've been listening to quite a few episodes from a couple of Atari-centric podcasts, namely ANTIC and Player/Missile. I'm currently listening to episode #14 of the latter, in which a panel of 5 each choose 5 of their favourite 8-bit Atari games.

It occurred to me today that I should try to choose a seminal game from each platform to port to the Coco3. So far I've done Apple II (with a couple more in mind), I'm doing ZX Spectrum now, so perhaps I should attempt an Atari title next. Now I really, really do want to like the Atari but I'm having a hard time being impressed with any of the games. For example the praise for Jumpman was unanimously glowing on the above-mentioned podcast, but from what I've seen on YouTube, I'm thoroughly unimpressed - for example the animation of the player is absolutely horrid!

Hopefully I'll find one eventually... Cavelord looks interesting...


Monday 21 September 2015

Easier to C what's happening!

Still managing the odd hour here and there and starting to get a real feel for the structure of the code and how everything hangs together. It's a fine line between trying to get a good understanding, and not getting bogged down in low-level implementation details that can wait until porting is under way.

I'm considering a slightly different approach for this port. Because so much of the binary is actually data structures, and a fair amount of the same maintained in RAM, plus the fact that a lot of the code is concerned with rendering the screen, I'm actually toying with the idea of doing a complete port in C (on the PC) before tackling the 6809 translation.

The code itself looks quite well structured, with very little jumping around, which of course lends itself to a high-level implementation. And debugging C code to parse data structures and render graphics on the PC is a lot more attractive than debugging 6809 in the MESS debugger running a Coco emulator.

I think I've just made up my mind to start coding in C next session.

Wednesday 9 September 2015

Low hanging fruit

Steady but slow progress as time is in short supply; a major upheaval in my working life and plenty of things happening around the house in my private life. This probably won't change for a month or two yet either. Still, I try to grab an hour or so 'watching' TV with the wife or just before bed one or two nights per week.

I'm still getting a general feel for the code, jumping around and commenting sections that are easy to identify - low hanging fruit. I'll probably persist with this strategy until pickings become meagre.

The use of IX and IY registers appear to be limited to only a few data structures, so I'm feeling a bit more confident about a 6809 translation.

Not sure at this point when I'll revisit the rendering and/or code my first 6809 instruction for the port. I could write the main menu easily as it is now, but that's not very exciting at all.