Pages

Saturday, 17 April 2021

Land(scape) ahoy!

Now up to the demo proper. The initial landscape is drawn (hard-coded routine, not part of the landscape data), the stage indicator on the head-up display is rendered, and things are about to start moving! As I suspected, the demo will comprise much of the remainder of the code, which is a good thing.

The demo is about to start...

At this stage there's still lots of variables being added as I go and a little re-architecting as I learn how the variables are accessed, keeping in mind that in some cases the type of variable is optimised for the C code if it does not appreciably affect the code. Scott has defined structures in his disassembly and I'm staying true to his design as far as possible. It helps self-document the code and also helps the transcode which, I must say, has been going particularly smoothly.

A note on the structure of the Scramble code as a whole:

The main routine is a busy loop that waits for tasks to be written onto a circular queue by the NMI routine. If there is nothing on the queue, it will periodically call a few non-time-critical routines, such as blinking text, drawing the fuel gauge, drawing a column of landscape that is just about to be scrolled onto the screen etc.

The NMI, 60Hz driven off the vertical blanking interrupt, does all the heaving lifting. It's one big state machine that Scott refers to as 'scripts' that control high level program flow and subsequently the low level mechanics of the game logic, controller inputs, and video hardware updates.

Quite a neat design, and one that could be applied to any number of early arcade games. Scott has mentioned that Galaxian is very similar, and I'm hoping that's the case as it would make a transcode similarly straightforward, especially as it's running on the same hardware.

Things should really start to get interesting now. Without <F10> I'm going to have to patch the code to run the demo immediately after start-up so I don't have to sit through the attract mode every time...


No comments:

Post a Comment