Assembler directivesSource files: Assembler directivesAssembler directives are instructions to the assembler itself. #target, #endAssembler directives: #target, #end#target [<pathandfilename>.]<extension> ... Assembler directives: #target, #end#end The Assembler directives: #target, #end#target and the Assembler directives: #target, #end#end Source files: Assembler directivesassembler directive are required for all kinds of Target filestarget files. The Assembler directives: #target, #end#target directive defines filename, extension and format of the Target filestarget file as discussed above in the chapter about Target filesdestination file formats. The Assembler directives: #target, #end#target directive is required. Best put it at the start of the source. the Assembler directives: #target, #end#target directive must be balanced with a final Assembler directives: #target, #end#end. Typically there is only one Assembler directives: #target, #end#target ... #end section per assembler source, but there may be more. In the latter case you probably must supply the full Target filestarget file names in the Assembler directives: #target, #end#target directives. (Full Target filestarget file name is not yet implemented. I'll do it if you need it.) <extension> is one of: Target files: #target binbin plain binary Pseudo instructions: datadata (core dump) Target files: #target romrom plain binary Pseudo instructions: datadata (Target files: #target romrom image) Target files: #target tapetap ZX Spectrum Target files: #target tapetape file Target files: #target snasna ZX Spectrum NMI snapshot Target files: #target z80z80 ZX Spectrum snapshot (not yet implemented) The Assembler directives: #target, #end#end directive tells the assembler that the end of a Assembler directives: #target, #end#target segment has been reached. The assembler writes the generated object code to the Target filestarget file and closes the file, so that it becomes usable. Example:Target files: #target rom#target rom ; Assembler directives: #code#code 0,4000h ; ; <-- your code goes here --> ; Assembler directives: #target, #end#end #headAssembler directives: #head#head <size>
The Assembler directives: #head#head segment is required for Target filestarget file formats which include registers, e.g. Target files: #target sna#target sna and Target files: #target z80#target z80. Target filesTarget files which store registers and similar information start with a Assembler directives: #head#head segment. To set the Pseudo instructions: datadata you can use Pseudo instructions: defb, dbdefb and similar Source files: Pseudo instructionspseudo instructions. If parts of the Assembler directives: #head#head segment are not set, default values will be filled in which vary depending on the omitted Pseudo instructions: datadata's purpose. Also, Pseudo instructions: defs, dsdefs fills the declared space with those default values. (except if a fill value is given.) Most of them, not all, are 0. Example:; ZX Spectrum NMI snapshot: ; Target files: #target sna#target sna ; Assembler directives: #head#head 27 ; ; <-- Target files: #target z80z80 registers --> ; Assembler directives: #code#code 4000h, 0C000h ; ; <-- your code goes here --> ; Assembler directives: #target, #end#end #codeAssembler directives: #code#code <start>,<size>
The Assembler directives: #code#code Source files: Assembler directivesassembler directive is required for all Target filestarget file formats. This defines a segment where the generated code should go. The <start> value defines the address origin associated with the code segment and the assembler reports an Listings and Errors: Errorserror if code generation exceeds the given <size>. At least one Assembler directives: #code#code segment is required. Multiple code segments are possible. <start> and <size> must be evaluatable in pass 1. Example:Assembler directives: #target, #end#target ram ; Assembler directives: #code#code $4000,$c000 ; ; <-- your code goes here --> ; Assembler directives: #target, #end#end #dataAssembler directives: #data#data <start>,<size>
This directive declares an area of ram to be used for variables etc. The Source files: Pseudo instructionspseudo instruction Pseudo instructions: datadata is used later-on to allocate space from this area and assign Source files: Label definitionslabel names to these variables. The assembler will report an Listings and Errors: Errorserror should allocation exceed the given <size>. You can not store initial Pseudo instructions: datadata in the Pseudo instructions: datadata segment. The Assembler directives: #data#data segment may be redefined as often as required. <start> and <size> must be evaluatable in pass 1. Example:... Assembler directives: #data#data $4000,$100 ... foo Pseudo instructions: datadata 4 bar Pseudo instructions: datadata 2 fuzzy Pseudo instructions: datadata $20 ... #if, #elif, #else, #endifAssembler directives: #if, #elif, #else, #endif#if <condition> ... Assembler directives: #if, #elif, #else, #endif#elif <condition> ... Assembler directives: #if, #elif, #else, #endif#else ... Assembler directives: #if, #elif, #else, #endif#endif Assembler directives: #if, #elif, #else, #endif#if starts a block of assembler instructions, which is only assembled if the given <condition> is true. The <condition> must be evaluatable in pass 1. Conditional assembly may be nested to any level. Any Source files: Assembler directivesassembler directive except pairing Assembler directives: #if, #elif, #else, #endif#else, Assembler directives: #if, #elif, #else, #endif#elif and Assembler directives: #if, #elif, #else, #endif#endif, and any assembler instruction or Source files: Pseudo instructionspseudo instruction is skipped if the <condition> is false. If the pairing Assembler directives: #if, #elif, #else, #endif#endif is not found until the end of file then a nesting Listings and Errors: Errorserror is assumed. Note, that Assembler directives: #include#include is also skipped if <condition> is false. After an Assembler directives: #if, #elif, #else, #endif#if directive where the <condition> was false, the Assembler directives: #if, #elif, #else, #endif#elif <condition> is checked and if it is true, the following block is assembled. if it is false, or if already a block was assembled within this Assembler directives: #if, #elif, #else, #endif#if ... Assembler directives: #if, #elif, #else, #endif#endif range, the following block is skipped. Assembler directives: #if, #elif, #else, #endif#elif is optional and may occur multiple times after Assembler directives: #if, #elif, #else, #endif#if. After an Assembler directives: #if, #elif, #else, #endif#if directive, Assembler directives: #if, #elif, #else, #endif#else negates the <condition>. If it was false it becomes true and the following assembler instructions are assembled. If it was true it becomes false and the following assembler instructions are skipped. Assembler directives: #if, #elif, #else, #endif#else is optional and should only occur once before the Assembler directives: #if, #elif, #else, #endif#endif Source files: Assembler directivesassembler directive. If Assembler directives: #if, #elif, #else, #endif#else occurs after some Assembler directives: #if, #elif, #else, #endif#elif directives, then the Assembler directives: #if, #elif, #else, #endif#else part is a final 'catch all'. The Assembler directives: #if, #elif, #else, #endif#endif directive finishes conditional assembly as started with the Assembler directives: #if, #elif, #else, #endif#if directive. #includeAssembler directives: #include#include <filename>
Includes a Source filessource file. The file name must be given relatively to the main Source filessource file's directory. The included source is assembled as if it was in the main Source filessource file itself. Source filesSource file inclusion may be nested to almost any level. Examples:Assembler directives: #include#include "utils.ass" ; file in same directory Assembler directives: #include#include "./utils.ass" ; file in same directory Assembler directives: #include#include "utils/u1.ass" ; file in subdirectory "utils/" #insertAssembler directives: #insert#insert <filename>
Inserts a General rules: Binary filesbinary file. The file name must be given relatively to the main Source filessource file's directory. The file's contents are just copied into the code segment verbatim. Examples:Assembler directives: #insert#insert "image.gif" ; file in same directory Assembler directives: #insert#insert "./image.gif" ; file in same directory Assembler directives: #insert#insert "pics/g1.gif" ; file in subdirectory "pics/" #macro, #endmacroAssembler directives: #macro, #endmacro#macro <name>(<parameterlist>)
Not yet implemented Macro definition. #local, #endlocalNot yet implemented This defines all Source files: Label definitionslabel definitions in the following block as local. That means: all Source files: Label definitionslabels defined after Assembler directives: #local, #endlocal#local will be forgotten after the pairing Assembler directives: #local, #endlocal#endlocal. For all those people who like to name their looping points p1, p2, etc. |