Text adventures in Sinclair BASIC usually need this trick to fit in 16K.
This is also useful for small tape loaders. Making them smaller allows setting RAMTOP to a lower address, so you can have more available space to load a code block.
Text adventures in Sinclair BASIC usually need this trick to fit in 16K.
D’oh. Right you are!Einar Saukas wrote: ↑Thu May 24, 2018 3:15 pmPlus one byte for control code 14 that prefixes the number representation IIRC.Ast A. Moore wrote: ↑Thu May 24, 2018 3:07 pm Mmm . . . A zero is one byte, plus 5 bytes of the BASIC’s number representation. That’s six bytes. NOT PI is two bytes. Six minus two is four.
Yes, NOT PI is the way to go. Honestly, when it comes to loaders, I prefer using machine code inside BASIC.djnzx48 wrote: ↑Fri May 25, 2018 8:46 am Hmm, it looks like I was mistaken about BIN using fewer bytes. I just checked the memory of a BASIC program and it turns out that even if you have no digits after the BIN, it still uses 5 extra bytes to store the value and so uses exactly the same amount of memory as the number 0.
Sure. That’s trivial, though, particularly if you’re using a ROM-based loader. A custom loader would have to be relocated to non-contended memory anyway, so if you’re using calls within it, the addresses must be pre-calculated in relation to the execution location. Incidentally, I use both a ROM-based and a custom turbo loader in Yankee. Enable, say, Interface 1 in your emulator, initialize it by typing CAT 1 in BASIC, and then load each version of the game. They’ll both work.