Home
Memoirs of a Gamer
Movies I watched
Guidebook
Code Projects
Links
The heart of the Gorgon engine is it's custom scripting language. The language specified in the scripting tutorials is a slightly more human readable version of the actual byte code used by Gorgon's internal virtual machine.
The virtual machine itself is composed of 10 segments of code memory, a maximum of 256 16 bit word variables, a bit flag based inventory manager, several special system registers, and a 256 16 bit word stack. If this sounds like a lot, don't worry. The human friendly scripting language is designed to handle the trickier aspects of the VM's internal workings.
The game's byte code segments are divided by purpose to the core engine. The first segment is the GAME segment. This will always be the file "GAME.CNS", without which the engine will immediately crash out with an error message stating it could not locate "GAME.CNS".
The second code segment is the ROOM segment. This segment is loaded by calls to the "loadroom" command, which takes an integer value. This is translated into a file called "ROOM###.CNS" where ### is the room number formatted to 3 digits with leading zeros. This means a very enthusiastic designer could make a game with 1000 unique room scripts. I can't say I'd every want to do that myself, but it is technically possible.
The remaining byte code segments are referred to as Auxilliary 0 through 7. These are loaded dynamically by other script files using the "loadaux" command. As there are no concrete rules about loading auxilliary byte code files, these can be named anything the designer wants, provided the name fits within the DOS 8.3 file name schema.
Whenever a script is loaded into memory it will immediately execute the event tagged as the Start Event.
WARNING! There are going to be edge cases that I have not anticipated where it will be possible to load an Auxilliary script into a slot currently being executed. If anyone runs into any issues with this, please contact me! This is only a danger with the Auxilliary segments. The "loadroom" command will clear the current execution stack and start the new room script file from a blank slate.