Wednesday 28 October 2015

Going loopy!

Thought I'd post a quick update on the ZX Spectrum game reverse-engineering, since the last few posts have been off-topic and you'd be forgiven for thinking that I'd been irretrievably diverted from the task at hand.

Quite to the contrary I've done a few short sessions here-and-there and am progressing somewhat, chipping away at my understanding of the screen rendering and what is done where. This has, for the first time, involved running MESS and patching code. I think I've got a reasonable view of the code structure now - I've identified the main game (nested) loops and the purpose of most of the routines called from there - and it will probably be in the next session or two that I will have sufficient information to be able to return to the screen rendering in C.

The rendering code deals with all the major game data structures and whilst it means that there's a reasonable amount of work involved in re-implementing it, even in C, it of course implies that a lot of the game's core engine code will then be complete.

Once I have the rendering complete I'll post a brief description of the main engine structure because I think it's interesting, as well as the requisite eye candy.

From there the task gets a little harder as the remainder will involve the 'AI' aspects of the game and a multitude of specific-purpose variables and flags that are hard to deduce from the listing alone. This is generally where you have to start actually playing the game (more) and poking around in memory.

I've got two weeks overseas travel (USA) for work coming up this weekend, which will actually mean I'll get more time to work on this project (sad, lonely nights in a foreign motel room) so I'll ensure my laptop is up-to-date with the latest tools and source before I go.

I've also had an interesting idea about what could be done with this project once the reverse-engineering and/or porting is complete which I think will particularly interest Coco fans, but I'll save that for another post.

Monday 26 October 2015

Madness from my sick bed

Struck down with a stomach bug today, unable to sleep much and trying to keep my mind off my physical ailments, my thoughts turned - naturally - to porting projects.

Now I have to warn you that this idea was borne from a stomach ache and nausea-induced haze, so you'll have to forgive the madness.

Of course plenty of clones of arcade games were produced on all of the 8-bit microcomputers back in the day. But what if one were to take one of those clones, and port it back to the original arcade hardware!?!

 Why on Earth would you bother? I hear you ask. And as I sit here gradually recuperating after a couple of pieces of Vegemite toast and some paracetamol, even I must admit that the idea sounds sillier by the minute.

Regardless, I did try to entertain the idea briefly. And I was thinking a good candidate would be one that came from the same CPU - to greatly reduce the effort required - and obviously similar hardware architecture. The only one that sprung easily to mind was a couple of rather decent Joust ports on the Coco; Lancer and Buzzard Bait (I did have a preference back in the day, but can't recall which).

Both the arcade and Coco are 6809 machines with a bit-mapped display, although the pixel mapping differs somewhat. I would imagine there's sufficient ROM and RAM space on the arcade platform. So not too far-fetched; it's worth noting that the arcade Tutankham didn't require a lot of patching to run on the Coco3! What it would require though is a pretty comprehensive reverse-engineering of the Coco code in order to account for the pixel mapping differences.

Maybe one day someone will pay me to complete absolutely pointless ports?

Thursday 22 October 2015

Project List

I was looking for a way to include links on the sidebar of this blog and stumbled across the mechanism for adding pages! So you'll note in the sidebar to the right is a link to the 'Project List' which, as you would suspect, is a list of my past and current porting projects.

Monday 19 October 2015

Apple II Lode Runner for the Coco3 - recap

Just tonight listening to The CoCo Crew Podcast Episode #3 I heard myself get a mention in relation to my Lode Runner port for the Coco3, which was both flattering (thanks John & Neil) and embarrassing (thanks John & Neil). So I thought I'd give an update on the status of the project.

The port itself is all-but-complete and, for those that missed the announcement, a playable demo version is available for download. FTR I have done one (cosmetic) fix since that release. The only issues remaining are that the data for all 150 levels does not fit in the non-banked 64K address space, and there is no mechanism for loading/saving high scores. I do, however, have plans to overcome these - in time.

My intention is to release a cartridge version of the port initially, for which I plan to design my own flash-based cartridge, with a few extra features - including the ability to save high scores. Although the cartridge will be made available with Lode Runner (and Championship Lode Runner) installed, it will also be able to be programmed by the end user for their own (additional) cartridge images. There will be a limited run with a case and a printed sticker for those that wish to have a physical copy of the game. More on this when the time comes.

Sometime after the cartridge release, I plan on releasing the disk version - which will be freeware.

The question on everyone's lips is, of course, when will this happen? Right now, it's difficult to say. I am in the middle of a rather significant upheaval in my working life; the plan was to actually reduce my working hours and free up some more time for family and hobbies, however somehow I've managed to do the exact opposite - for the next 5-6 months at least. But at least it's all part of the process in setting myself up later for less work and more play.

Hope that clears things up for now. As was also alluded to in the podcast, and of course documented right here in this blog, I am working on another game port to the Coco3; I should explain that pure software work is a lot more conducive to "casual efforts" and of course does not require any capital outlay. So whilst I don't have the resources to dedicate to the flash cartridge design at this point, I can sometimes find the time to do a bit of reverse-engineering.

C9

No feedback thus far from the Microbee Volcano Hunter port, so in the mean time I've resisted other temptations and RETURNED to the ZX Spectrum game. I've got some additional annotation for the listing courtesy of George but failing any further developments, I'll wrap Volcano Hunter up soon and send the final source listing back to David Smith to do with as he pleases.

After a few more casual scans of the (aforementioned ZX Spectrum game) listing, I've deduced that the 'easy' bits are done and the remaining reverse-engineering is going to take some effort.

The next task is to definitively identify the top-level routine that renders the game play area of the screen and comment that as I translate it to C. Once that is complete, I have a feeling that more of the code will fall into place, as a lot of the data structures are related to the rendering. I'll also post some eye candy at that point and thus reveal the identity of the game.

Thursday 15 October 2015

Trying to ignore other ideas

The Microbee port of Volcano Hunter is complete, pending exhaustive testing. In the end the changes were almost trivial, for the most part cut-and-paste from my previous Microbee port, Donut Dilemma. In the end all that was required, aside from the usual preamble to initialise the Microbee PCG, was modifying hard-coded references/offsets to video memory with a .define'd constant, patching the keyboard and sound routines, and modifying the (one-and-only) delay routine to cater for a faster Z80. Almost too easy.

And of course immersing oneself in such a port - however briefly - and interacting with the enthusiast community, inevitably some suggestion or idea pops up from nowhere. Somehow the suggestion to port the MSX version of Lode Runner to the Microbee popped into my head; after doing the TRS-80 version I've little doubt it can be done; it's just a matter of whether the pixel-addressable graphics mode on the Microbee has sufficient bandwidth.

Then I started thinking about an enhanced port of Volcano Hunter, with a scrolling background (as opposed to the original flip-screen) on a (slightly) more capable platform - I'm thinking SNES or Amiga for example. Or maybe even Neo Geo... arrghh!!

And during discussions of the port with a friend, the topic turned to Prince Of Persia... I've had plans on that for quite a while now, only I'd forgotten that the source code is freely available. Ports are soooo much easier with the source... also trying to convince said friend to reverse-engineer DKJr; would be awesome to release a physical Neo Geo cartridge with ports of the arcade version of both Donkey Kong and Donkey Kong Jr!

But I need to ignore these for now and get back to my ZX Spectrum port before I forget how it all works. It may even be possible to port that to the Microbee - at least it's already Z80!

Friday 9 October 2015

Short diversion

I mentioned Volcano Hunter in my previous post; I've contacted the game's author David Smith and he has sent me his original source listing - in the form of iPhone photos of fan-fold paper sheets!

Starting with a known-good TRS-80 CMD file (game executable) I've completed annotating the disassembly with all of David's labels and comments and I've even preserved the radixes of all his numeric literals! The ASM file now assembles and produces a byte-for-byte copy of the original CMD file - and is also fully relocatable!

Now that David has an electronic copy of his original source listing that assembles on a freely-available, modern cross-assembler (ASZ80), I'm going to start on the Microbee port!

Then it's back to the ZX Spectrum game, where things are starting to look interesting!

Monday 5 October 2015

Status Update

Nothing ground-breaking yet but I am working on getting the Status portion of the screen rendered, which is done every iteration of the main game loop.

The main reason for this update though is to mention a recent discovery and the idea for a port that it subsequently spawned. Volcano Hunter was a TRS-80 Model I game that I played for many, many hours back in the day, even writing a utility to facilitate printing the game map - over 200 screens - on our Epson MX80 printer. The author had a web page about it quite a few years ago, but he never responded to my email and it subsequently disappeared.

Whilst browsing the AtariAge forums yesterday though, I came across a post about it and whilst Googling it, I discovered the author has - in 2011 - created a Facebook page for it. Not only that, but he seems to still be quite fond of the game, creating a playable online version, and printing themed T-shirts and keyrings.

That got me thinking again about an idea I've had for a while, namely porting a TRS-80 game to another machine besides the Microbee. Sure, the Coco would be nice, if possible, but what would really be cool in my opinion would be a very unlikely target - the Neo Geo! I'd dismissed the idea in the past as being not practical, but lately I've done some more thinking about it and I'm sure it can be done.

Anyway, whilst Volcano Hunter is out of the question for now, I've thought about doing a quick proof-of-concept port just for fun; something quite small, and ideally something I already have the source code for. Right now I'm thinking Tandy Invaders would be a good candidate!