Saga20101212 - simondotm/stardot-wiki GitHub Wiki

12/12/2010: Tidying up

Unfortunately I didn't have as much time over the weekend as I'd wanted. I'd wanted to rewrite the system message code to allow insertable parameters, using the spare ASCII codes 1 - 31 but after some basic testing I had to go back to rethink what I was doing. The plan is to allow the message to control the semantics of the content, rather than the positioning, so the output code can then place it, or colour it appropriately to its meaning. I will need some codes to include contents from the game, e.g. current noun, current verb, counter state etc. Also I'll need some to mark an object, room description etc.

What I did manage to do was to do some code reduction and clean up the start and end code. The code reduction has mainly being about code reuse and altering loops so that they count down, which usually saves 2 bytes.

One advantage of code reuse has been in my osfile call for save and load, even though the procedure only does:

ldx #osfileblock MOD 256

ldy #osfileblock DIV 256

jmp osfile

This saves me one byte for the two places it's called; but, I found out on testing that OSFILE uses the block as working area, meaning I ought to form it properly each time, which means more bytes saved on creating the block.

Anyway, new code has been to handle LOADs (I'd already implemented SAVEs) and QUITs and to make sure it exits semi-gracefully on a QUIT or end of game - this is done by simply saving the stack pointer at engineinit and then retrieving it at the end!

Comments

⚠️ **GitHub.com Fallback** ⚠️