A-code documentation

I could be wrong, but I rather doubt implementing a switch statement would save much in the way of memory use. These days, I tend to trust compilers to be pretty good at optimising machine code. OTOH you’d certainly find the old paging mechanism useful or, failing that, just reading game texts from the data file, instead of loading any of them into memory. I used to build Adv660 for machines with 48K of memory, but one constraint you should be aware of… In the current version, when restoring from a saved file, the game will double its data array in order to verify its integrity before replacing the old array with the new one. To give you an idea of the size, for my Adv350 A- code implementation, it is an array of 997 ints. For Platt’s original Adv550 it is 1251 ints. If that turns out to be a problem, I could easily add an ability just to read in the new data array without integrity checks.

The derived C code uses numerical refnos (offsets int the data array) for game entities and in that respect it is not human friendly. But acdc can generate cross-reference files tying refnos to entity names as well as listing entity uses in the A-code source. The C source also does not bother with block offsetting. Otherwise, though, it is not particularly difficult to follow. But I would advise against fixing things on the C level – I’d much rather fix acdc to produce the desired code. If you do hit any problems, please shout and between us I expect we should be able to find and implement a proper fix.

I haven’t tested A-code yet, so I may be worrying needlessly. When looking at ways to save memory in general programming languages it seemed more efficient to have a case statement for each location description that defined the (reusable) text strings for it, rather than storing everything in arrays.

I am hoping to target tape based systems, so loading data files wouldn’t be my first choice.

That reminds me, I didn’t see any mention of whether there are RAM save and restore options for players. They were especially useful if you didn’t own a disk drive.

I don’t mind reference numbers being used in the source code, but having a load of structs to print strings (as Nim does) would be hard to follow.

The main reason I might need to adjust the C code is that I would like to target a large number of 8-bit computers. I’m not sure it would be possible to produce code that would run on every system that z88dk supports without at least some tweaking.

It will depend on how flexible the (z88dk) compiler configuration files and switches are.

We are getting rather beyond the scope of this topic, so I’ll reply separately.