-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the KickAss_hla wiki!
I prefer some structure in my code, but the KickAssembler doesn't seem to have anything that will provide that structure for assembly code, so I have added the infrastructure to support this, and to allow for future expansion.
Details of how to configure KickAss to use the HLA files can be found on the KickAss Configuration page.
You can find details of what is provided and some implementation details in the following links:
- hla.inc - the main HLA file.
- hla_controller.inc - macros and structured commands for accessing the keyboard and joystick controllers.
KickAss has a built-in phobia against overwriting memory locations it has already assembled bytes to. Even if you set the options for KickAss to allow overwriting, it will issue warnings.
In addition, it does not seem to be possible to create a label dynamically, so you can't insert a JMP or branch opcode with a label that will be defined later. Not all of the jump locations are known when a structured instruction is reached - for example the 'if' statements do not know the location of their matching 'else' or 'endif' statements.
The mechanism I used to avoid this restriction is to record the current PC location, skip the PC forward the appropriate amount for the expected instruction, and then to continue with assembly. Later statements will then use that recorded location to reset the PC back to that point, assemble the instruction with the appropriate jump address, then restore the PC to continue assembling.
For example, if an 'else' is encountered after an 'if', it is the responsibility of the 'else' to patch in the assembly code for the 'if' statement. The 'endif' is then responsible for patching in the assembly code for the 'else', if there is one, or for the 'if' otherwise.
One thing that I tried to do is to include an actual label in each of the routines anyway as a debugging aid. KickAss very kindly makes each of these labels unique by appending a numeric value and will provide these to the VICE monitor if you set KickASS options appropriately. The labels are visible in the ByteDump.txt if you also have this enabled.
Inspired by Garth Wilson - http://wilsonminesco.com