diff --git a/doc/asm/db.htm b/doc/asm/db.htm index 45e5c0de..59a019cd 100644 --- a/doc/asm/db.htm +++ b/doc/asm/db.htm @@ -1,37 +1,26 @@ - - -
-DB defines a list of bytes that will be stored in the final image. Ideal for tables and text.
+DB 1,2,3,4,"This is a string"+
Alternatively you can use DW to store a list of words. Strings are not allowed as arguments to DW.
+You can also use DB and DW without arguments. This works exactly like “DS 1” and “DS 2” respectively. Consequently DB and DW can be used in a BSS/HRAM/VRAM section.
+DB defines a list of bytes that will be stored in the final image. Ideal for tables and text.
-
-
-DB 1,2,3,4,"This is a string"- |
-
Alternatively you can use DW to store a list of words. Strings are not allowed as arguments to DW. -
You can also use DB and DW without arguments. This works exactly like "DS 1" and "DS 2" respectively. Consequently DB and -DW can be used in a BSS/HRAM/VRAM section. -
Last updated 02 July 1997 by Carsten Sorensen
+Last updated 02 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/ds.htm b/doc/asm/ds.htm index 8de7bf2c..ce0610a8 100644 --- a/doc/asm/ds.htm +++ b/doc/asm/ds.htm @@ -1,31 +1,20 @@ - - - -DS allocates a number of bytes. The content is undefined. This is the preferred method of allocationg space in a BSS section. You can however also use DB and DW without any arguments.
-
-
-DS str_SIZEOF ;allocate str_SIZEOF bytes- |
-
Last updated 02 July 1997 by Carsten Sorensen
+ + +DS allocates a number of bytes. The content is undefined. This is the preferred method of allocationg space in a BSS section. You can however also use DB and DW without any arguments.
+DS str_SIZEOF ;allocate str_SIZEOF bytes+
Last updated 02 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/equ.htm b/doc/asm/equ.htm index 9dd7a07d..bd88e6d1 100644 --- a/doc/asm/equ.htm +++ b/doc/asm/equ.htm @@ -1,30 +1,21 @@ - - - -EQUates are constant symbols. They can for example be used for things such as bit-definitions of hardware-registers.
-
-
-DONUT_ISGOOD EQU $01 -DONUT_ISBAD EQU $02- |
-
Note that a colon (:) following the label-name is not allowed. EQUates can be exported and imported. They don't change their value during the link process.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+ + +EQUates are constant symbols. They can for example be used for things such as bit-definitions of hardware-registers.
+DONUT_ISGOOD EQU $01 +DONUT_ISBAD EQU $02+
Note that a colon (:) following the label-name is not allowed. EQUates can be exported and imported. They don't change their value during the link process.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/equs.htm b/doc/asm/equs.htm index 2cad356b..5209bf34 100644 --- a/doc/asm/equs.htm +++ b/doc/asm/equs.htm @@ -1,49 +1,27 @@ - - - -EQUS is used to define string-symbols. Wherever the assembler meets a string symbol its name is replaced with its value. If you are familiar with C you can think of it as the same as #define.
-
-
-COUNTREG EQUS "[hl+]" + + + |
-
(Note that : following the label-name is not allowed.)
-
This will be interpreted as:
-
-ld a,[hl+]- |
-
String-symbols can also be used to define small one-line macros:
-
-PUSHA EQUS "push af\npush bc\npush de\npush hl\n"- |
-
Note that a colon (:) following the label-name is not allowed. String equates can't be exported or imported.
-
-
Last updated 21 June 1997 by Carsten Sorensen
- + ld a,COUNTREG +(Note that : following the label-name is not allowed.)
+This will be interpreted as:
+ld a,[hl+]+
String-symbols can also be used to define small one-line macros:
+PUSHA EQUS "push af\npush bc\npush de\npush hl\n"+
Note that a colon (:) following the label-name is not allowed. String equates can't be exported or imported.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/export.htm b/doc/asm/export.htm index c01a95b8..07a987f0 100644 --- a/doc/asm/export.htm +++ b/doc/asm/export.htm @@ -1,42 +1,35 @@ - - - -Importing and exporting of symbols is a feature that is very useful when your project spans many source-files and for example you
-need to jump to a routine defined in another file.
-
-
| Command | -Meaning | -
| IMPORT (or XREF) label[,label,...] | -This instructs the assembler to define label as if it were present - in the current file but leave the address calculation to the linker. | -
| EXPORT (or XDEF) label[,label,...] | -The assembler will make label accessible to - other files during the link process. | -
| GLOBAL label[,label,...] | -If label is defined during the assembly it will be exported, - if not it will be imported. Handy (very!) for include-files. | -
Last updated 21 June 1997 by Carsten Sorensen
+ + +Importing and exporting of symbols is a feature that is very useful when your project spans many source-files and for example you need to jump to a routine defined in another file.
+| Command | +Meaning | +
|---|---|
| IMPORT (or XREF) label[,label,...] | +This instructs the assembler to define label as if it were present + in the current file but leave the address calculation to the linker. | +
| EXPORT (or XDEF) label[,label,...] | +The assembler will make label accessible to other files during the link process. | +
| GLOBAL label[,label,...] | +If label is defined during the assembly it will be exported, if not it will be imported. Handy (very!) for include-files. | +
Last updated 21 June 1997 by Carsten Sorensen
+ diff --git a/doc/asm/expr_fix.htm b/doc/asm/expr_fix.htm index 153b5f6d..bede2bac 100644 --- a/doc/asm/expr_fix.htm +++ b/doc/asm/expr_fix.htm @@ -1,86 +1,76 @@ - - - -Fixed point constants are basically normal 32-bit constants where the upper 16 bits are used for the integer part and the lower 16 bits are used for the fraction (65536ths). This means that you can use them in normal integer expression and indeed some integer operators like plus and minus don't care whether the operands are integer or fixed-point. You can easily convert a fixed-point number to an integer by shifting it right 16 bits. It follows that you can convert an integer to a fixed-point number by shifting it left.
+Some things are different for fixed-point math though. Which is why you have the following functions to use:
- -Fixed point constants are basically normal 32-bit constants where the upper 16 bits are used for the integer part and the lower 16 bits are used for the fraction (65536ths). This means that you can use them in normal integer expression and indeed some integer operators like plus and minus don't care whether the operands are integer or fixed-point. You can easily convert a fixed-point number to an integer by shifting it right 16 bits. It follows that you can convert an integer to a fixed-point number by shifting it left. -
Some things are different for fixed-point math though. Which is why you have the following functions to use: - -
| Name | -Operation | -
| DIV(x,y) | -x/y | -
| MUL(x,y) | -x*y | -
| SIN(x) | -sin(x) | -
| COS(x) | -cos(x) | -
| TAN(x) | -tan(x) | -
| ASIN(x) | -sin-1(x) | -
| ACOS(x) | -cos-1(x) | -
| ATAN(x) | -tan-1(x) | -
| ATAN2(x,y) | -(x,y) angle | -
These functions are extremely useful for automatic generation of various tables. A circle has 65536.0
-degrees. Sine values are between [-1.0;1.0]
-
-
-; -- +
These functions are extremely useful for automatic generation of various tables. A circle has 65536.0 degrees. Sine values are between [-1.0;1.0] +; --
; -- Generate a 256 byte sine table with values between 0 and 128
; --
ANGLE SET 0.0
REPT 256
DB (MUL(64.0,SIN(ANGLE))+64.0)>>16
ANGLE SET ANGLE+256.0
- ENDR
- |
-
Last updated 21 June 1997 by Carsten Sorensen
+ ENDR +Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/expr_int.htm b/doc/asm/expr_int.htm index 6286a376..4e6579af 100644 --- a/doc/asm/expr_int.htm +++ b/doc/asm/expr_int.htm @@ -1,104 +1,92 @@ - - - -An expression can be composed of many things. Expressions are always evaluated using signed 32-bit math.
+The most basic expression is just a single number.
+xAsm has a number of numeric formats.
+The last one, Gameboy graphics, is quite interesting and useful. The values are actually pixel values and it converts the “chunky” data to “planar” data as used in the Gameboy.
+DW `01012323+
Admittedly an expression with just a single number is quite boring. To spice things up a bit there’s a few operators you can use to perform calculations between numbers.
+A great number of operators you can use in expressions are available (listed in order of precedence):
+| Operator | +Meaning | +
|---|---|
| ( ) | +Precedence override | +
| FUNC() | +Functioncall | +
| ~ + - | +Unary not/plus/minus | +
| * / % | +Multiply/divide/modulo | +
| << >> | +Shift left/right | +
| & | ^ | +Binary and/or/xor | +
| + - | +Add/subtract | +
| != == <= >= < > | +Boolean comparison | +
| && || | +Boolean and/or | +
| ! | +Unary Boolean not | +
The result of the boolean operators is zero if when FALSE and non-zero when TRUE. Thus it is legal to use an integer as the condition for IF blocks. You can use symbols instead of numbers in your expression if you wish.
-An expression can be composed of many things. Expressions are always evaluated using signed 32-bit math. -
The most basic expression is just a single number. -
xAsm has a number of numeric formats. -
The last one, Gameboy graphics, is quite interesting and useful. The values are actually pixel values and it converts
-the "chunky" data to "planar" data as used in the Gameboy.
-
-
-DW `01012323- |
-
An expression is said to be constant when it doesn't change its value during linking. This basically means that you can't use labels in those expressions. The instructions in the macro-language all require expressions that are constant.
+A great number of operators you can use in expressions are available (listed in order of precedence): -
| Operator | -Meaning | -
| ( ) | -Precedence override | -
| FUNC() | -Functioncall | -
| ~ + - | -Unary not/plus/minus | -
| * / % | -Multiply/divide/modulo | -
| << >> | -Shift left/right | -
| & | ^ | -Binary and/or/xor | -
| + - | -Add/subtract | -
| != == <= >= < > | -Boolean comparison | -
| && || | -Boolean and/or | -
| ! | -Unary Boolean not | -
The result of the boolean operators is zero if when FALSE and non-zero when TRUE. Thus it is legal to use an integer as the condition for IF blocks. You can use symbols instead of numbers in your expression if you wish. - -
An expression is said to be constant when it doesn't change its value during linking. This basically means that you can't use labels in those expressions. The instructions in the macro-language all require expressions that are constant
-
-
Last updated 21 June 1997 by Carsten Sorensen
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/expr_str.htm b/doc/asm/expr_str.htm index 3ac84e44..d35abf2a 100644 --- a/doc/asm/expr_str.htm +++ b/doc/asm/expr_str.htm @@ -1,118 +1,114 @@ - - - -The most basic string expression is any number of characters contained in double quotes ("for instance"). As in C the escape character is \ and there is a number of commands you can use within a string:
+| Character sequence | +Meaning | +Notes | +
|---|---|---|
| \\ | +Backslash | ++ |
| \" | +Double-quote | ++ |
| \{ | +Curly bracket left | ++ |
| \} | +Curly bracket right | ++ |
| \n | +Newline ($0A) | ++ |
| \t | +Tab ($09) | ++ |
| \1-\9 | +Macroargument | +Only in macros | +
| \@ | +Labelname suffix | +Only in macros and repts | +
A funky feature is {symbol} withing a string. This will examine the type of the symbol and insert its value accordingly. If symbol is a string symbol the symbols value is simply copied. If it's a numeric symbol the value is converted to hexadecimal notation and inserted as a string.
+HINT: The {symbol} construct can also be used outside strings. The symbols value is again inserted as a string. This is just a short way of doing "{symbol}".
+Whenever the macro-language expects a string you can actually use a string expression. This consists of one or more of these function. Yes, you can nest them. Note that some of these functions actually return an integer and can be used as part of an integer expression!
+| Name | +Operation | +
|---|---|
| STRLEN(stringexpr) | +Returns the number of characters in string | +
| STRCAT(stringexpr1,stringexpr2) | +Appends stringexpr2 to stringexpr1. | +
| STRCMP(stringexpr1,stringexpr2) | +Returns negative if stringexpr1 is alphabetically less than stringexpr2 Zero if they match Positive if greater than |
+
| STRIN(haystack,needle) | +Returns needles position within haystack or zero if it's not present | +
| STRSUB(stringexpr,pos,count) | +Returns a substring of stringexpr starting at pos (first character is position 1) and with count characters | +
| STRUPR(stringexpr) | +Converts all characters in string to capitals and returns the new string | +
| STRLWR(string) | +Converts all characters in string to lower case and returns the new string | +
The most basic string expression is any number of characters contained in double quotes ("for instance"). As in C the escape
-character is \ and there is a number of commands you can use within a string:
-
-
| Character sequence | -Meaning | -Notes | -
| \\ | -Backslash | -- |
| \" | -Double-quote | -- |
| \{ | -Curly bracket left | -- |
| \} | -Curly bracket right | -- |
| \n | -Newline ($0A) | -- |
| \t | -Tab ($09) | -- |
| \1-\9 | -Macroargument | -Only in macros | -
| \@ | -Labelname suffix | -Only in macros and repts | -
A funky feature is {symbol} withing a string. This will examine the type of the symbol and insert its -value accordingly. If symbol is a string symbol the symbols value is simply copied. If it's a numeric symbol the value is converted -to hexadecimal notation and inserted as a string. -
HINT: The {symbol} construct can also be used outside strings. The symbols value is again inserted as a
-string. This is just a short way of doing "{symbol}".
-
-Whenever the macro-language expects a string you can actually use a string expression. This consists of one or more of these function. Yes, you can nest them. Note that some of these functions actually return an integer and can be used as part of an integer expression!
-
| Name | -Operation | -
| STRLEN(stringexpr) | -Returns the number of characters in string | -
| STRCAT(stringexpr1,stringexpr2) | -Appends stringexpr2 to stringexpr1. | -
| STRCMP(stringexpr1,stringexpr2) | -Returns negative if stringexpr1 is alphabetically less than stringexpr2 Zero if they match Positive if greater than |
-
| STRIN(haystack,needle) | -Returns needles position within haystack or zero if it's not present | -
| STRSUB(stringexpr,pos,count) | -Returns a substring of stringexpr starting at pos (first character is position 1) and with count characters | -
| STRUPR(stringexpr) | -Converts all characters in string to capitals and returns the new string | -
| STRLWR(string) | -Converts all characters in string to lower case and returns the new string | -
Last updated 21 June 1997 by Carsten Sorensen
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/fail.htm b/doc/asm/fail.htm index f201d5ce..93a347e7 100644 --- a/doc/asm/fail.htm +++ b/doc/asm/fail.htm @@ -1,25 +1,20 @@ - - - -FAIL and WARN can be used to terminate the assembling process if you wish to do so. This is especially useful for macros that get an invalid argument. FAIL and WARN take a string as the only argument and they will print this string out as a normal error with a linenumber.
+FAIL stops assembling immediately while WARN continues after printing the errormessage.
- -FAIL and WARN can be used to terminate the assembling process if you wish to do so. This is especially useful for -macros that get an invalid argument. FAIL and WARN take a string as the only argument and they will print this string out as a normal error with a linenumber. -
FAIL stops assembling immediatly while WARN continues after printing the errormessage. - -
Last updated 21 June 1997 by Carsten Sorensen
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/history.htm b/doc/asm/history.htm index 36bb6022..ecfde119 100644 --- a/doc/asm/history.htm +++ b/doc/asm/history.htm @@ -1,97 +1,103 @@ - - - -| Version | -Dated | -Release notes | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.0 | -1 Oct. 96 | -First release | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.01 | -1 Dec. 96 | -Fixed bug in INCBIN (sometimes reported the section full) - Added DEF() function |
-||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.02 | -12 Feb. 97 | -Added STRLEN(), STRCAT(), STRIN(), STRCMP(), STRSUB(), STRUPR() and STRLWR() functions - IMPORT/EXPORT/GLOBAL takes multiple arguments now - HRAM sectiontype added - ORG like features added to SECTION - LDIO mnemonic added |
-||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.03 | -23 Mar. 97 | -The HRAM section was 128 bytes long instead of 127. potentially thrashing the interrupt enable register if you filled the HRAM. - The BANK() function, when used on a symbol defined in the current sourcefile, returned the wrong bank ID. (reported by Harry P. Mulder) - The BANK() function didn't check whether the argument was a properly defined symbol. (reported by Harry P. Mulder) - Completely new lexical analyser module. This fixed several linenumber bugs and other macro/if/rept related bugs. Also fixed a bug which made it possible to have equated symbols with the same name as a reserved keyword (if you get a "parse error" with this release on some of your sources, this is probably what is going on) - FAIL and WARN commands. - __LINE__, __FILE__, __TIME__, __DATE__ predefined symbols added. - |
-||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.04 | -03 July 1997 | -First ASMotor release -__TIME__ and __DATE__ give todays date instead of when the assembler was compiled. -Sometimes the first line of a file wouldn't assemble correctly. Reported by Jeff Frohwein. -Unrolling multiline string symbols left the linecounter in a sorry state. Jeff Frohwein again. -DB and DW can now (officially ;-) be used in BSS/HRAM/VRAM sections without any arguments to reserve a byte or a word respectively. Reported/suggested/inspired by Mr. Frohwein. -The character # can now be used as part of a symbol name. Jeff.... -The RS counter "_RS" is now defined from the very start of the assembly process instead of after the first RSSET or RSRESET. -Bug fixed: You couldn't use \0-\9 and \@ in {} constructs -PURGE pseudo-op added. Purges a symbol from the symboltable and memory. Use with extreme caution! Inspired by Harry P. Mulder -MACRO parameter passing method changed drastically. Read (and re-read) the manual for details. Suggested by Harry P. Mulder. - |
-||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.05 | -20 July 1997 | -RGBDS fixes: + + + xAsm History+
- Last updated 21 September 1997 by Carsten Sorensen +Last updated 21 September 1997 by Carsten Sorensen diff --git a/doc/asm/if.htm b/doc/asm/if.htm index 44b996ee..df0ec6d8 100644 --- a/doc/asm/if.htm +++ b/doc/asm/if.htm @@ -1,37 +1,24 @@ - - - -IF
- |
-IF 2+2==4 + + + |
-
The ELSE block is optional. IF/ELSE/ENDC-blocks can be nested.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+ENDC +The ELSE block is optional. IF/ELSE/ENDC-blocks can be nested.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/incbin.htm b/doc/asm/incbin.htm index 9f2c4e53..5dfdeb61 100644 --- a/doc/asm/incbin.htm +++ b/doc/asm/incbin.htm @@ -1,44 +1,22 @@ - - - -You probably have some graphics you'd like to include. Use INCBIN to include a raw binary
-file as it is. If the file isn't found in the current directory the include-path list will be searched.
-
-
-INCBIN "titlepic.bin" -INCBIN "sprites\\hero.bin"- |
-
You can also include only part of a file with INCBIN. The example below includes 256 bytes from data.bin starting from position 78.
-
-
-
-INCBIN "data.bin",78,256- |
-
Last updated 21 June 1997 by Carsten Sorensen
+ + +You probably have some graphics you’d like to include. Use INCBIN to include a raw binary file as it is. If the file isn’t found in the current directory the include-path list will be searched.
+INCBIN "titlepic.bin" +INCBIN "sprites\\hero.bin"+
You can also include only part of a file with INCBIN. The example below includes 256 bytes from data.bin starting from position 78.
+INCBIN "data.bin",78,256+
Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/include.htm b/doc/asm/include.htm index 4bb38c13..41f34f74 100644 --- a/doc/asm/include.htm +++ b/doc/asm/include.htm @@ -1,30 +1,19 @@ - - - -Use INCLUDE to process another assembler-file and then return to the current file when done. If the file isn't found in the current directory the include-path list will be searched. You may nest INCLUDE calls infinitely (or until you run out of memory whichever comes first).
-
-
-INCLUDE "irq.inc"- |
-
Last updated 21 June 1997 by Carsten Sorensen
+ + +Use INCLUDE to process another assembler-file and then return to the current file when done. If the file isn't found in the current directory the include-path list will be searched. You may nest INCLUDE calls infinitely (or until you run out of memory whichever comes first).
+INCLUDE "irq.inc"+
Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/labels.htm b/doc/asm/labels.htm index 547bfbdb..755442f9 100644 --- a/doc/asm/labels.htm +++ b/doc/asm/labels.htm @@ -1,30 +1,22 @@ - - - -One of the assemblers main tasks is to keep track of addresses for you so you don't have to remember obscure numbers but can make do with a meaningful name, a label.
-
This can be done in a number of ways:
-
-
-GlobalLabel + + + |
-
This is very similar to other assemblers. Local labels are only accessible within the scope they are defined. A scope starts after a global label and ends at the next global label. You may or may not have seen the :: feature before. It declares a normal global label but does an EXPORT at the same time.
-
Labels will normally change their value during the link process and are thus not constant.
-
-
-
Last updated 21 June 1997 by Carsten Sorensen
+ThisWillBeExported:: ;note the two colons +This is very similar to other assemblers. Local labels are only accessible within the scope they are defined. A scope starts after a global label and ends at the next global label. You may or may not have seen the :: feature before. It declares a normal global label but does an EXPORT at the same time.
+Labels will normally change their value during the link process and are thus not constant.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/macro.htm b/doc/asm/macro.htm index 3580b6f0..d2fdbb52 100644 --- a/doc/asm/macro.htm +++ b/doc/asm/macro.htm @@ -1,121 +1,60 @@ - - - -One of the best features of an assembler is the ability to write macros for it. Macros also provide a method of passing
-arguments to them and they can then react to the input using IF-constructs.
-
-
-MyMacro: MACRO + + + |
-
The above example is a very simple macro. You execute the macro by typing its name.
-
-
-add a,b + ENDM+ The above example is a very simple macro. You execute the macro by typing its name. + add a,b
ld sp,hl
MyMacro ;This will be expanded
- sub a,87
- |
-
When the assembler meets MyMacro it will insert the macrodefinition (the text enclosed in MACRO/ENDM). -
Suppose your macro contains a loop.
-
-
-LoopyMacro: MACRO + sub a,87+ When the assembler meets MyMacro it will insert the macrodefinition (the text enclosed in MACRO/ENDM). +Suppose your macro contains a loop. +LoopyMacro: MACRO
xor a,a
.loop ld [hl+],a
dec c
jr nz,.loop
- ENDM
- |
-
This is fine. That is, if you only use the macro once per scope. To get around this problem there is a special label string equate called \@ that you can append to your labels and it will then expand to a unique string.
-\@ also works in REPT-blocks should you have any loops there.
-
-
-LoopyMacro: MACRO + ENDM+ This is fine. That is, if you only use the macro once per scope. To get around this problem there is a special label string equate called \@ that you can append to your labels and it will then expand to a unique string. +\@ also works in REPT-blocks should you have any loops there. +LoopyMacro: MACRO
xor a,a
.loop\@ ld [hl+],a
dec c
jr nz,.loop\@
- ENDM
- |
-
I'd like LoopyMacro a lot better if I didn't have to pre-load the registers with values and then call it. -What I'd like is the ability to pass it arguments and it then loaded the registers itself. -
And I can do that. In macros you can get the arguments by using the special macro string equates \1 through
-\9, \1 being the first argument specified on the calling of the macro.
-
-
-LoopyMacro: MACRO + ENDM+ Arguments+I’d like LoopyMacro a lot better if I didn’t have to pre-load the registers with values and then call it. What I’d like is the ability to pass it arguments and it then loaded the registers itself. +And I can do that. In macros you can get the arguments by using the special macro string equates \1 through \9, \1 being the first argument specified on the calling of the macro. +LoopyMacro: MACRO
ld hl,\1
ld c,\2
xor a,a
.loop\@ ld [hl+],a
dec c
jr nz,.loop\@
- ENDM
- |
-
Now I can call the macro specifying two arguments. The first being the address and the second being a bytecount.
-The macro will then reset all bytes in this range.
-
-
-LoopyMacro MyVars,54- |
-
You can specify up to nine arguments when calling a - macro. Arguments are passed as string equates. There's no need to enclose them in quotes. Parameter passing has changed a bit since v1.03 in that an expression will not be evaluated first but passed directly. This means that it's probably a very good idea to use -brackets around \1-\9 if you perform further calculations on them. For instance if you pass 1+2 as the first argument and then do + ENDM +
Now I can call the macro specifying two arguments. The first being the address and the second being a bytecount. The macro will then reset all bytes in this range.
+LoopyMacro MyVars,54+
You can specify up to nine arguments when calling a macro. Arguments are passed as string equates. There’s no need to enclose them in quotes. Parameter passing has changed a bit since v1.03 in that an expression will not be evaluated first but passed directly. This means that it’s probably a very good idea to use brackets around \1–\9 if you perform further calculations on them. For instance if you pass 1+2 as the first argument and then do PRINTV \1*2
+you will get the value 5 on screen and not 6 as you might have expected.
Note that a colon (:) following the macro-name is required. Macros can't be exported or imported. It's valid to call a macro from a macro (yes, even the same one).
-
-PRINTV \1*2 -- |
-
Note that a colon (:) following the macro-name is required. Macros can't be exported or imported. It's valid to call a macro from a macro (yes, even the same one).
-
-
Last updated 02 July 1997 by Carsten Sorensen
+Last updated 02 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/miscfunc.htm b/doc/asm/miscfunc.htm index eac9ce5b..c843de12 100644 --- a/doc/asm/miscfunc.htm +++ b/doc/asm/miscfunc.htm @@ -1,42 +1,38 @@ - - - -| Name | -Operation | -
| BANK(label) | -Gameboy ONLY: Returns the bank number label is in. The link will have to resolve this so it can't be used when the expression has to be constant | -
| DEF(label) | -Returns TRUE if label has been defined | -
Last updated 21 June 1997 by Carsten Sorensen
+ + +There's a few other functions that do various useful things:
+| Name | +Operation | +
|---|---|
| BANK(label) | +Gameboy ONLY: Returns the bank number label is in. The link will have to resolve this so it can't be used when the expression has to be constant | +
| DEF(label) | +Returns TRUE if label has been defined | +
Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/opt.htm b/doc/asm/opt.htm index 6169e3ab..d01f4a4c 100644 --- a/doc/asm/opt.htm +++ b/doc/asm/opt.htm @@ -1,38 +1,27 @@ - - - -OPT can be used to change some of the options during assembling you source instead of defining them on the commandline.
+OPT takes a comma-seperated list of options as its argument:
- -OPT can be used to change some of the options during assembling you source instead of defining them on the commandline.
-
OPT takes a comma-seperated list of options as its argument: - -
- PUSHO
+ |
-
The options that OPT can modify are currently: b, e and g - -
Last updated 20 July 1997 by Carsten Sorensen
+ DW `00112233 +The options that OPT can modify are currently: b, e and g
+Last updated 20 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/popo.htm b/doc/asm/popo.htm index 45c0a52f..4843c5ea 100644 --- a/doc/asm/popo.htm +++ b/doc/asm/popo.htm @@ -1,25 +1,18 @@ - - - -POPO and PUSHO provide the interface to the option stack. PUSHO will push the current set of options on the option stack. POPO can then later be used to restore them. Useful if you want to change some options in an include file and you don't want to destroy the options set by the program that included your file. The stacks number of entries is limited only by the amount of memory in your machine. - -
German people: Yes, I know what "POPO" means. You are hereby allowed to snigger and giggle every time you type it. - -
Last updated 20 July 1997 by Carsten Sorensen
+ + +POPO and PUSHO provide the interface to the option stack. PUSHO will push the current set of options on the option stack. POPO can then later be used to restore them. Useful if you want to change some options in an include file and you don't want to destroy the options set by the program that included your file. The stacks number of entries is limited only by the amount of memory in your machine.
+Last updated 20 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/pops.htm b/doc/asm/pops.htm index 54dad35e..cf5cd712 100644 --- a/doc/asm/pops.htm +++ b/doc/asm/pops.htm @@ -1,23 +1,18 @@ - - - -POPS and PUSHS provide the interface to the section stack. PUSHS will push the current section context on the section stack. POPS can then later be used to restore it. Useful for defining sections in included files when you don't want to destroy the section context for the program that included your file. The stacks number of entries is limited only by the amount of memory in your machine. - -
Last updated 18 July 1997 by Carsten Sorensen
+ + +POPS and PUSHS provide the interface to the section stack. PUSHS will push the current section context on the section stack. POPS can then later be used to restore it. Useful for defining sections in included files when you don't want to destroy the section context for the program that included your file. The stacks number of entries is limited only by the amount of memory in your machine.
+Last updated 18 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/presym.htm b/doc/asm/presym.htm index 929bdc53..a7846f07 100644 --- a/doc/asm/presym.htm +++ b/doc/asm/presym.htm @@ -1,64 +1,63 @@ - - - -| Name | -Contents | -Type | -
| @ | -PC value | -EQU | -
| _PI | -Fixed point ¶ | -EQU | -
| _RS | -_RS counter | -SET | -
| _NARG | -Number of arguments passed to macro | -EQU | -
| __LINE__ | -The current linenumber | -EQU | -
| __FILE__ | -The current filename | -EQUS | -
| __DATE__ | -Todays date | -EQUS | -
| __TIME__ | -The current time | -EQUS | -
Last updated 21 June 1997 by Carsten Sorensen
+ + +| Name | +Contents | +Type | +
|---|---|---|
| @ | +PC value | +EQU | +
| _PI | +Fixed point ¶ | +EQU | +
| _RS | +_RS counter | +SET | +
| _NARG | +Number of arguments passed to macro | +EQU | +
| __LINE__ | +The current linenumber | +EQU | +
| __FILE__ | +The current filename | +EQUS | +
| __DATE__ | +Todays date | +EQUS | +
| __TIME__ | +The current time | +EQUS | +
Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/print.htm b/doc/asm/print.htm index 83811dad..9e7f91b2 100644 --- a/doc/asm/print.htm +++ b/doc/asm/print.htm @@ -1,40 +1,29 @@ - - - -These three instructions type text and values to stdout. Useful for debugging macros or wherever you may feel the
-need to tell yourself some important information.
-
-
-PRINTT "I'm the greatest programmer in the whole wide world\n" + + + |
-
Last updated 21 June 1997 by Carsten Sorensen
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/purge.htm b/doc/asm/purge.htm index fcc187c6..2763e60b 100644 --- a/doc/asm/purge.htm +++ b/doc/asm/purge.htm @@ -1,26 +1,18 @@ - - - -The PURGE command allows you to completely remove a symbol from the symbol table as if it had never existed. USE WITH EXTREME CAUTION!!! I can't stress this enough but you seriously need to know what you are doing. DON'T purge symbol that you use in expressions the linker needs to calculate. In fact, it's probably not even safe to purge anything other than string symbols and macros.
-
-
-Kamikaze EQUS "I don't want to live anymore" + + + |
-
Note that string symbols that are part of a PURGE command WILL NOT BE EXPANDED as the ONLY exception to this rule.
-
-
Last updated 02 July 1997 by Carsten Sorensen
+ PURGE Kamikaze,AOLer +Note that string symbols that are part of a PURGE command WILL NOT BE EXPANDED as the ONLY exception to this rule.
+Last updated 02 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/rept.htm b/doc/asm/rept.htm index f6023863..60abe0e3 100644 --- a/doc/asm/rept.htm +++ b/doc/asm/rept.htm @@ -1,51 +1,32 @@ - - - -Suppose you're feeling lazy and you want to unroll a time consuming loop. REPT is here for that purpose. Everything between REPT and ENDR will be repeated a number of times just as if you done a copy/paste operation yourself
-
-
-REPT 4 + + + |
-
This will assemble add a,c four times.
-
You can also use REPT to generate tables on the fly: -
-; -- +ENDR+ This will assemble You can also use REPT to generate tables on the fly: +; --
; -- Generate a 256 byte sine table with values between 0 and 128
; --
ANGLE SET 0.0
REPT 256
DB (MUL(64.0,SIN(ANGLE))+64.0)>>16
ANGLE SET ANGLE+256.0
- ENDR
- |
-
Last updated 21 June 1997 by Carsten Sorensen
+ ENDR +REPT is also very useful in recursive macros and as in macros you can also use the special label operator \@. REPT-blocks can be nested.
+
Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/rs.htm b/doc/asm/rs.htm index 8049cefb..6980a441 100644 --- a/doc/asm/rs.htm +++ b/doc/asm/rs.htm @@ -1,90 +1,76 @@ - - - -The RS group of commands is a handy way of defining structures:
-
-
-RSRESET + + + |
-
The example defines four equated symbols:
-
-
| Name | -Value | -
| str_pStuff | -0 | -
| str_tData | -2 | -
| str_bCount | -258 | -
| str_SIZEOF | -259 | -
| Command | -Meaning | -
| RSRESET | -Resets the _RS counter to zero | -
| RSSET constexpr | -Sets the _RS counter to constexpr | -
| RB constexpr | -Sets the preceding symbol to _RS and adds constexpr to _RS | -
| RW constexpr | -Sets the preceding symbol to _RS and adds constexpr*2 to _RS | -
Note that a colon (:) following the symbol-name is not allowed. RS symbols can be exported and imported. They don't change their value during the link process.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+str_SIZEOF RB 0 +The example defines four equated symbols:
+| Name | +Value | +
|---|---|
| str_pStuff | +0 | +
| str_tData | +2 | +
| str_bCount | +258 | +
| str_SIZEOF | +259 | +
There are four commands in the RS group of commands:
+| Command | +Meaning | +
|---|---|
| RSRESET | +Resets the _RS counter to zero | +
| RSSET constexpr | +Sets the _RS counter to constexpr | +
| RB constexpr | +Sets the preceding symbol to _RS and adds constexpr to _RS | +
| RW constexpr | +Sets the preceding symbol to _RS and adds constexpr*2 to _RS | +
Note that a colon (:) following the symbol-name is not allowed. RS symbols can be exported and imported. They don't change their value during the link process.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/section.htm b/doc/asm/section.htm index c85561cc..912e1ce2 100644 --- a/doc/asm/section.htm +++ b/doc/asm/section.htm @@ -1,95 +1,63 @@ - - - -Before you can start writing code you must define a section. This tells the assembler what kind of data follows and if it is code where to put it.
-
-
-SECTION "CoolStuff",CODE- |
-
This switches to the section called "CoolStuff" (or creates it if it doesn't already exits) and it defines
-it as a code section. All sections within a sourcefile must be identified by a unique name.
-
-
| Name | -Function | -
| CODE | -A code section. The linker decides where to put this. For the Gameboy it also decides which bank to put it in except #0 (the HOME bank). | -
| DATA | -Really just a synonym for CODE. | -
| BSS | -This section is for variables. For the Gameboy it will be placed where the Gameboy RAM is. | -
| HOME | -Gameboy ONLY: A code section that will be placed in Gameboy bank #0. | -
| VRAM | -Gameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is. | -
| HRAM | -Gameboy ONLY: This section is for allocating variables in the high RAM area ($FF80-$FFFE) and will be placed there. Suggested by Jens Ch. Restemeier. NOTE WELL: if you use this method of allocating HRAM the assembler will NOT choose the short addressingmode in the LD instruction because the actual address calculation is done by the linker! If you find this undesirable you can use RSSET/RB/RW instead or use the LDIO mnemonic. The address calculation is then done by the assembler. | -
Due to quite a lot of emails requesting an ORG directive you can now add an address to the sectiontype for the Gameboy:
-
-
-SECTION "CoolStuff",HOME[$1234]- |
-
This will force the section to address $1234. This also works with the other sectiontypes. For CODE/DATA sections the linker will then place the section in any bank at the address you specify. If you also want to specify the bank you can do:
-
-
-SECTION "CoolStuff",DATA[$4567],BANK[3]- |
-
And if you only want to force the section into a certain bank, and not it's position within the bank, that's also possible:
-
-
-SECTION "CoolStuff",CODE,BANK[7]- |
-
HINT: If you think this is a lot of typing for doing a simple ORG type thing you can quite easily write an intelligent macro (called ORG for example) that uses \@ for the sectionname and determines correct sectiontype etc as arguments for SECTION
-
-
Last updated 18 July 1997 by Carsten Sorensen
+ + +Before you can start writing code you must define a section. This tells the assembler what kind of data follows and if it is code where to put it.
+SECTION "CoolStuff",CODE+
This switches to the section called "CoolStuff" (or creates it if it doesn't already exits) and it defines it as a code section. All sections within a sourcefile must be identified by a unique name.
+| Name | +Function | +
|---|---|
| CODE | +A code section. The linker decides where to put this. For the Gameboy it also decides which bank to put it in except #0 (the HOME bank). | +
| DATA | +Really just a synonym for CODE. | +
| BSS | +This section is for variables. For the Gameboy it will be placed where the Gameboy RAM is. | +
| HOME | +Gameboy ONLY: A code section that will be placed in Gameboy bank #0. | +
| VRAM | +Gameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is. | +
| HRAM | +Gameboy ONLY: This section is for allocating variables in the high RAM area ($FF80-$FFFE) and will be placed there. Suggested by Jens Ch. Restemeier. NOTE WELL: if you use this method of allocating HRAM the assembler will NOT choose the short addressingmode in the LD instruction because the actual address calculation is done by the linker! If you find this undesirable you can use RSSET/RB/RW instead or use the LDIO mnemonic. The address calculation is then done by the assembler. | +
Due to quite a lot of emails requesting an ORG directive you can now add an address to the sectiontype for the Gameboy:
+SECTION "CoolStuff",HOME[$1234]+
This will force the section to address $1234. This also works with the other sectiontypes. For CODE/DATA sections the linker will then place the section in any bank at the address you specify. If you also want to specify the bank you can do:
+SECTION "CoolStuff",DATA[$4567],BANK[3]+
And if you only want to force the section into a certain bank, and not it's position within the bank, that's also possible:
+SECTION "CoolStuff",CODE,BANK[7]+
HINT: If you think this is a lot of typing for doing a simple ORG type thing you can quite easily write an intelligent macro (called ORG for example) that uses \@ for the sectionname and determines correct sectiontype etc as arguments for SECTION
+Last updated 18 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/set.htm b/doc/asm/set.htm index 18342be9..a78489c4 100644 --- a/doc/asm/set.htm +++ b/doc/asm/set.htm @@ -1,31 +1,22 @@ - - - -SETs are like EQUates also constant symbols in the sense that their values are defined during the assembly process. These symbols are normally used in macros.
-
-
-KINKYCOUNT SET 2 -KINKYCOUNT SET DONUT_ISGOOD+KINKYCOUNT- |
-
Note that a colon (:) following the label-name is not allowed. SETs can be exported and imported but the result is undefined and might change in a later release. Alternatively you can use = as a synonym for SET.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+ + +SETs are like EQUates also constant symbols in the sense that their values are defined during the assembly process. These symbols are normally used in macros.
+KINKYCOUNT SET 2 +KINKYCOUNT SET DONUT_ISGOOD+KINKYCOUNT+
Note that a colon (:) following the label-name is not allowed. SETs can be exported and imported but the result is undefined and might change in a later release. Alternatively you can use = as a synonym for SET.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/shift.htm b/doc/asm/shift.htm index 910fca90..be81b943 100644 --- a/doc/asm/shift.htm +++ b/doc/asm/shift.htm @@ -1,21 +1,19 @@ - - - -SHIFT is a special command only available in macros. Very useful in REPT-blocks. It will "shift" the arguments by one "to the left". \1 will get \2's value, \2 will get \3's value and so forth.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+ + +SHIFT is a special command only available in macros. Very useful in REPT-blocks. It will "shift" the arguments by one "to the left". \1 will get \2's value, \2 will get \3's value and so forth.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/symbols.htm b/doc/asm/symbols.htm index 9a6cc462..1af4fde0 100644 --- a/doc/asm/symbols.htm +++ b/doc/asm/symbols.htm @@ -1,33 +1,31 @@ - - - -xAsm supports several types of symbols:
+A symbol cannot have the same name as a reserved keyword.
-xAsm supports several types of symbols:Last updated 02 July 1997 by Carsten Sorensen
+Last updated 02 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/syntax.htm b/doc/asm/syntax.htm index f923db50..c308ddc1 100644 --- a/doc/asm/syntax.htm +++ b/doc/asm/syntax.htm @@ -1,47 +1,23 @@ - - - -
-[label] [instruction] [;comment]- |
-
-John: ld a,87 ;Weee- |
-
A comment can also be an asterisk (*) followed by the comment if the asterisk is the first character on the line:
-
-
-
-******************************** + + |
-
All pseudo-ops, mnemonics and registers (reserved keywords) are case-insensitive and all labels are case-sensitive.
-
-
Last updated 21 June 1997 by Carsten Sorensen
+******************************** +All pseudo‐ops, mnemonics and registers (reserved keywords) are case‐insensitive and all labels are case‐sensitive.
+Last updated 21 June 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/trg_gb.htm b/doc/asm/trg_gb.htm index a34ee9a0..fae41ca3 100644 --- a/doc/asm/trg_gb.htm +++ b/doc/asm/trg_gb.htm @@ -1,102 +1,102 @@ - - - -The full GB-Z80 instruction-set is implemented with a few modifications to the original Zilog syntax. This is due
-to a Bison problem but in my opinion the syntax is better than the original one.
-
ADC - ADD - AND - BIT - CALL - CCF - CP - CPL - DAA - DEC - DI - EI - EX - HALT - INC - JP - JR - LD - LDD - LDI - LDH/LDIO (see note below) - NOP - OR - POP - PUSH - RES - RET - RETI - RL - RLA - RLC - RLCA - RR - RRA - RRC - RRCA - RST - SBC - SCF - SET - SLA - SRA - SRL - STOP - SUB - SWAP - XOR-
Note that you can use both -
OR A,B - OR B-
Indirect addressing has been changed to [ ] instead of ( ):
-
A - B - C - D - E - H - L - AF - BC - DE - HL - SP - [BC] - [DE] - [HL] - [HL-]/[HLI] - [HL+]/[HLD] - [SP] - n8 (8 bit expression) - n16 (16 bit expression) - n3 (3 bit CONSTANT expression) - [n16]/[$FF00+n8] - [$FF00+C]/[C]-
The assembler will intelligently decide between [n16] and [$FF00+n8] in the LD instruction. Note however that if you use any constant symbols in the expression they had better be defined before the instruction or your symbol-table may become mangled. Also worth noting is that it will only ever select the short $FF00 mode when you use constant symbols. NOT if you use symbols defined in a HRAM section. As this defies the whole point of implementing the HRAM sectiontype I've added the LDIO mnemonic. It works like the LD instruction but it will ALWAYS generate the $FF00+ form and it will also automatically logically AND the expression with $FF if it is relocatable. Which is what you want. Trust me ;)
-
-
C - NC - Z - NZ- -
Last updated 20 July 1997 by Carsten Sorensen
+ + +The full GB-Z80 instruction-set is implemented with a few modifications to the original Zilog syntax. This is due to a Bison problem but in my opinion the syntax is better than the original one.
+Note that you can use both +
OR A,B + OR B+
Indirect addressing has been changed to [ ] instead of ( ):
+The assembler will intelligently decide between [n16] and [$FF00+n8] in the LD instruction. Note however that if you use any constant symbols in the expression they had better be defined before the instruction or your symbol-table may become mangled. Also worth noting is that it will only ever select the short $FF00 mode when you use constant symbols. NOT if you use symbols defined in a HRAM section. As this defies the whole point of implementing the HRAM sectiontype I've added the LDIO mnemonic. It works like the LD instruction but it will ALWAYS generate the $FF00+ form and it will also automatically logically AND the expression with $FF if it is relocatable. Which is what you want. Trust me ;)
+Last updated 20 July 1997 by Carsten Sorensen
+ + diff --git a/doc/asm/usage.htm b/doc/asm/usage.htm index 7cd0b1e3..f48ac865 100644 --- a/doc/asm/usage.htm +++ b/doc/asm/usage.htm @@ -1,38 +1,30 @@ - - - -
-C:\>xAsm [options] asmfile- |
-
oobjectfile : Write an object-file for xLink - ipath : Add an extra include-path + + +-xAsm Usage
+C:\>xAsm [options] asmfile+Options are preceded by a hyphen (-) and go as follows:
+oobjectfile : Write an object-file for xLink + ipath : Add an extra include-path h : Short help text - e(l|b) : Change endianness (CAUTION!) - gASCI : Change the four characters used for Gameboy graphics - constants (default is 0123) - bAS : Change the two characters used for binary constants - (default is 01) - zHX : Set the byte value (hex format) used for uninitialised data (default is ? for random) -+ e(l|b) : Change endianness (CAUTION!) + gASCI : Change the four characters used for Gameboy graphics + constants (default is 0123) + bAS : Change the two characters used for binary constants + (default is 01) + zHX : Set the byte value (hex format) used for uninitialised data (default is ? for random) +
Last updated 08 October 1997 by Carsten Sorensen
+Last updated 08 October 1997 by Carsten Sorensen
+ +