diff --git a/doc/asm.htm b/doc/asm.htm index e10758f0..4f44c80b 100644 --- a/doc/asm.htm +++ b/doc/asm.htm @@ -1,135 +1,135 @@ - - - - xAsm - - - -
-
- - - - -

xAsm Documentation

-

-

Table of Contents

- -

General stuff

- - -

Symbols

- - -

The macrolanguage

- - -

Other ways than mnemonics to define data

- - -

Target specific information

- - -

Alphabetical list of the macro-language instructions and functions

- - -

Last updated 20 July 1997 by Carsten Sorensen

- - + + + + xAsm + + + +
+
+ + + + +

xAsm Documentation

+

+

Table of Contents

+ +

General stuff

+ + +

Symbols

+ + +

The macrolanguage

+ + +

Other ways than mnemonics to define data

+ + +

Target specific information

+ + +

Alphabetical list of the macro-language instructions and functions

+ + +

Last updated 20 July 1997 by Carsten Sorensen

+ + diff --git a/doc/asm/db.htm b/doc/asm/db.htm index 4fe895c7..25a845c0 100644 --- a/doc/asm/db.htm +++ b/doc/asm/db.htm @@ -1,36 +1,36 @@ - - - xAsm DB, DW - - - -

DB
-DW -

-
- -

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. -

See also:

- - -

-

Last updated 02 July 1997 by Carsten Sorensen

+ + + xAsm DB, DW + + + +

DB
+DW +

+
+ +

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. +

See also:

+ + +

+

Last updated 02 July 1997 by Carsten Sorensen

diff --git a/doc/asm/ds.htm b/doc/asm/ds.htm index b8aeb1e0..bc3c6c0e 100644 --- a/doc/asm/ds.htm +++ b/doc/asm/ds.htm @@ -1,30 +1,30 @@ - - - xAsm DS - - - -

DS -

-
- -

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
-
- -

See also:

- - -

-

Last updated 02 July 1997 by Carsten Sorensen

+ + + xAsm DS + + + +

DS +

+
+ +

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
+
+ +

See also:

+ + +

+

Last updated 02 July 1997 by Carsten Sorensen

diff --git a/doc/asm/equ.htm b/doc/asm/equ.htm index 9347b7a6..2dd30416 100644 --- a/doc/asm/equ.htm +++ b/doc/asm/equ.htm @@ -1,29 +1,29 @@ - - - xAsm EQU - - - -

EQU


- -

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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm EQU + + + +

EQU


+ +

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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/equs.htm b/doc/asm/equs.htm index c912994c..50c2832d 100644 --- a/doc/asm/equs.htm +++ b/doc/asm/equs.htm @@ -1,48 +1,48 @@ - - - xAsm EQUS - - - -

EQUS


- -

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+]"
-          
-         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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

- + + + xAsm EQUS + + + +

EQUS


+ +

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+]"
+          
+         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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

+ diff --git a/doc/asm/export.htm b/doc/asm/export.htm index 490da091..02ed9946 100644 --- a/doc/asm/export.htm +++ b/doc/asm/export.htm @@ -1,41 +1,41 @@ - - - xAsm EXPORT/XREF, IMPORT/XDEF, GLOBAL - - - -

EXPORT/XREF
-IMPORT/XDEF
-GLOBAL


- -

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.
-
- - - - - - - - - - - - - - - - - - - -
Import/export commands
CommandMeaning
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

+ + + xAsm EXPORT/XREF, IMPORT/XDEF, GLOBAL + + + +

EXPORT/XREF
+IMPORT/XDEF
+GLOBAL


+ +

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.
+
+ + + + + + + + + + + + + + + + + + + +
Import/export commands
CommandMeaning
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 5188385a..c515c20e 100644 --- a/doc/asm/expr_fix.htm +++ b/doc/asm/expr_fix.htm @@ -1,85 +1,85 @@ - - - xAsm Fixed-point expression - - - -

Fixed-point expressions -

-
- -

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: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameOperation
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]
-
- - - - -
-
; --
-; -- 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
-
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm Fixed-point expression + + + +

Fixed-point expressions +

+
+ +

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: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameOperation
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]
+
+ + + + +
+
; --
+; -- 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
+
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/expr_int.htm b/doc/asm/expr_int.htm index eca4bafb..f70a1f08 100644 --- a/doc/asm/expr_int.htm +++ b/doc/asm/expr_int.htm @@ -1,103 +1,103 @@ - - - xAsm Integer/Boolean expressions - - - -

Integer and Boolean expressions -

-
- -

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. -


Numeric Formats

-

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. -


-Operators

-

A great number of operators you can use in expressions are available (listed in order of precedence): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Operators
OperatorMeaning
( )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
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm Integer/Boolean expressions + + + +

Integer and Boolean expressions +

+
+ +

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. +


Numeric Formats

+

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. +


+Operators

+

A great number of operators you can use in expressions are available (listed in order of precedence): + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operators
OperatorMeaning
( )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
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/expr_str.htm b/doc/asm/expr_str.htm index 793f481b..5a40c9cf 100644 --- a/doc/asm/expr_str.htm +++ b/doc/asm/expr_str.htm @@ -1,117 +1,117 @@ - - - xAsm String expressions - - - -

String expressions -

-
- -

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:
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Escape characters:
Character sequenceMeaningNotes
\\Backslash
\"Double-quote
\{Curly bracket left
\}Curly bracket right
\nNewline ($0A)
\tTab ($09)
\1-\9MacroargumentOnly in macros
\@Labelname suffixOnly 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!
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
String functions:
NameOperation
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
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm String expressions + + + +

String expressions +

+
+ +

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:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Escape characters:
Character sequenceMeaningNotes
\\Backslash
\"Double-quote
\{Curly bracket left
\}Curly bracket right
\nNewline ($0A)
\tTab ($09)
\1-\9MacroargumentOnly in macros
\@Labelname suffixOnly 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!
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
String functions:
NameOperation
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
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/fail.htm b/doc/asm/fail.htm index ecf2e6ea..1b404bc3 100644 --- a/doc/asm/fail.htm +++ b/doc/asm/fail.htm @@ -1,24 +1,24 @@ - - - xAsm FAIL, WARN - - - -

FAIL
-WARN -

-
- -

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. - -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm FAIL, WARN + + + +

FAIL
+WARN +

+
+ +

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. + +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/history.htm b/doc/asm/history.htm index 8adda6fc..3b409baa 100644 --- a/doc/asm/history.htm +++ b/doc/asm/history.htm @@ -1,217 +1,217 @@ - - - xAsm History - - - -

xAsm History


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The history of xAsm
VersionDatedRelease notes
1.01 Oct. 96First release
1.011 Dec. 96Fixed bug in INCBIN (sometimes reported the section full)
- Added DEF() function
1.0212 Feb. 97Added 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.0323 Mar. 97The 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.0403 July 1997First 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.0520 July 1997RGBDS fixes:
- RGBAsm supports the LDD and LDI syntax plus [HLD] and [HLI]. LDH is - synonymous with LDIO.
- General fixes:
-There was a bug in the macro parameter passing. Any whitespace after the -last parameter would be appended to the last parameter. Reported by Jeff Frohwein.
-A section stack has been implemented. Look up POPS and PUSHS. Jeff Frohweins doing again.
-OPT command added for defining and changing some options while assembling.
-You can now define which characters are used for the Gameboy graphics -integer (`) using the commandline or the new OPT command. Cool idea by (surprise surprise) Jeff Frohwein.
-Also, an option stack has been added. Look up POPO and PUSHO in the -manual.
-Fixed yet another line number bug reported by Jeff Frohwein (when will this guy leave me alone? ;)
-
1.0622 July 1997General fixes:
-The lamest typo bug of all time has been fixed. RGBAsm would output a word defined with DW as 4 bytes instead of 2. Jeff Frohwein reported this.
-The first line of an included file didn't assemble correctly.
--b option added for setting the characters used for binary constants.
-
1.0821 September 1997General fixes:
-A crash occured if you tried to use a macro symbol in an expression. -(Jeff Frohwein)
-You couldn't use STRCMP, STRLEN and STRIN in relocatable expressions. (Harry -P. Mulder)
-Relocatable symbols are no longer allowed as arguments to the DEF function.
-Bug fixed in the assembler where it would sometimes write out too many bytes -for HRAM section definitions.
-
1.0802 July 1999 - Feature: -
- DQ directive added for defining 32-bit data constants. See operation of DW & DB. -
-
1.0805 July 1999 - Feature: -
- Allow only a part of a binary file to be included instead of the whole thing. -
-
1.0810 June 1999 - Feature: -
- Added output of file dependency information for each file included/assembled. Enabled with a command line option. -
-
1.08?? ???? 1999 - Feature: -
- Added ORG directive to allow anonymous sections. -
-
1.08?? ???? 1999 - Feature: -
- Added ability to output error information in either RGBDS or Microsoft Developer Studio format. -
-
1.08?? ???? 1999 - Feature: -
- Added pseudo-instructions to handle NE (not equal), EQ (equal), and LT (less than) on JR/JP/CALL instructions -
-
1.08?? ???? 1999 - Feature: -
- Added STRTRIM, STRLTRIM, STRRTRIM directives to allow trimming of white space from strings in macro arguments. -
-
1.08?? ???? 1999 - Bug Fix: -
- When an "unknown symbol" error was reported during the link phase the undefined symbol was not given. -
-
1.08?? ???? 1999 - Bug Fix: -
- Declaring a symbol as GLOBAL in a header file and then referencing it in code but never defining it would crash the linker. -
-
1.0908 February 2000 - Feature: -
- Can now use a command line option to set the number format between a slightly tweaked Motorola/RGBDS format and Zilog. -
- Hex numbers can now be represented as $FF or FFh. -
- Octal as &77 or 77o. -
- Binary as %10010110 or 10010110b. -
- Gameboy graphics numbers as `1001 or 1001g. -
- Decimal numbers remain unchanged. -
-
- -

-

Last updated 21 September 1997 by Carsten Sorensen

+ + + xAsm History + + + +

xAsm History


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
The history of xAsm
VersionDatedRelease notes
1.01 Oct. 96First release
1.011 Dec. 96Fixed bug in INCBIN (sometimes reported the section full)
+ Added DEF() function
1.0212 Feb. 97Added 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.0323 Mar. 97The 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.0403 July 1997First 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.0520 July 1997RGBDS fixes:
+ RGBAsm supports the LDD and LDI syntax plus [HLD] and [HLI]. LDH is + synonymous with LDIO.
+ General fixes:
+There was a bug in the macro parameter passing. Any whitespace after the +last parameter would be appended to the last parameter. Reported by Jeff Frohwein.
+A section stack has been implemented. Look up POPS and PUSHS. Jeff Frohweins doing again.
+OPT command added for defining and changing some options while assembling.
+You can now define which characters are used for the Gameboy graphics +integer (`) using the commandline or the new OPT command. Cool idea by (surprise surprise) Jeff Frohwein.
+Also, an option stack has been added. Look up POPO and PUSHO in the +manual.
+Fixed yet another line number bug reported by Jeff Frohwein (when will this guy leave me alone? ;)
+
1.0622 July 1997General fixes:
+The lamest typo bug of all time has been fixed. RGBAsm would output a word defined with DW as 4 bytes instead of 2. Jeff Frohwein reported this.
+The first line of an included file didn't assemble correctly.
+-b option added for setting the characters used for binary constants.
+
1.0821 September 1997General fixes:
+A crash occured if you tried to use a macro symbol in an expression. +(Jeff Frohwein)
+You couldn't use STRCMP, STRLEN and STRIN in relocatable expressions. (Harry +P. Mulder)
+Relocatable symbols are no longer allowed as arguments to the DEF function.
+Bug fixed in the assembler where it would sometimes write out too many bytes +for HRAM section definitions.
+
1.0802 July 1999 + Feature: +
+ DQ directive added for defining 32-bit data constants. See operation of DW & DB. +
+
1.0805 July 1999 + Feature: +
+ Allow only a part of a binary file to be included instead of the whole thing. +
+
1.0810 June 1999 + Feature: +
+ Added output of file dependency information for each file included/assembled. Enabled with a command line option. +
+
1.08?? ???? 1999 + Feature: +
+ Added ORG directive to allow anonymous sections. +
+
1.08?? ???? 1999 + Feature: +
+ Added ability to output error information in either RGBDS or Microsoft Developer Studio format. +
+
1.08?? ???? 1999 + Feature: +
+ Added pseudo-instructions to handle NE (not equal), EQ (equal), and LT (less than) on JR/JP/CALL instructions +
+
1.08?? ???? 1999 + Feature: +
+ Added STRTRIM, STRLTRIM, STRRTRIM directives to allow trimming of white space from strings in macro arguments. +
+
1.08?? ???? 1999 + Bug Fix: +
+ When an "unknown symbol" error was reported during the link phase the undefined symbol was not given. +
+
1.08?? ???? 1999 + Bug Fix: +
+ Declaring a symbol as GLOBAL in a header file and then referencing it in code but never defining it would crash the linker. +
+
1.0908 February 2000 + Feature: +
+ Can now use a command line option to set the number format between a slightly tweaked Motorola/RGBDS format and Zilog. +
+ Hex numbers can now be represented as $FF or FFh. +
+ Octal as &77 or 77o. +
+ Binary as %10010110 or 10010110b. +
+ Gameboy graphics numbers as `1001 or 1001g. +
+ Decimal numbers remain unchanged. +
+
+ +

+

Last updated 21 September 1997 by Carsten Sorensen

diff --git a/doc/asm/if.htm b/doc/asm/if.htm index 51707b1c..4fd7772b 100644 --- a/doc/asm/if.htm +++ b/doc/asm/if.htm @@ -1,36 +1,36 @@ - - - xAsm IF, ELSE, ENDC - - - -

IF
-ELSE
-ENDC -

-
- -

These three commands is used to conditionally assemble parts of your file. It is a powerful feature commonly used in macros.
-
- - - - -
-
IF   2+2==4
-PRINTT    "2+2==4\n"
-ELSE
-PRINTT    "2+2!=4\n"
-ENDC
-
-

The ELSE block is optional. IF/ELSE/ENDC-blocks can be nested.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm IF, ELSE, ENDC + + + +

IF
+ELSE
+ENDC +

+
+ +

These three commands is used to conditionally assemble parts of your file. It is a powerful feature commonly used in macros.
+
+ + + + +
+
IF   2+2==4
+PRINTT    "2+2==4\n"
+ELSE
+PRINTT    "2+2!=4\n"
+ENDC
+
+

The ELSE block is optional. IF/ELSE/ENDC-blocks can be nested.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/incbin.htm b/doc/asm/incbin.htm index 695ea82b..341e2b46 100644 --- a/doc/asm/incbin.htm +++ b/doc/asm/incbin.htm @@ -1,31 +1,31 @@ - - - xAsm INCBIN - - - -

INCBIN -

-
- -

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"
-
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm INCBIN + + + +

INCBIN +

+
+ +

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"
+
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/include.htm b/doc/asm/include.htm index 14dfc99b..bc7528f9 100644 --- a/doc/asm/include.htm +++ b/doc/asm/include.htm @@ -1,29 +1,29 @@ - - - xAsm INCLUDE - - - -

INCLUDE -

-
- -

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"
-
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm INCLUDE + + + +

INCLUDE +

+
+ +

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"
+
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/labels.htm b/doc/asm/labels.htm index 346183e0..5d00ae9c 100644 --- a/doc/asm/labels.htm +++ b/doc/asm/labels.htm @@ -1,29 +1,29 @@ - - - xAsm Labels - - - -

Labels


-

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
-AnotherGlobal:
-.locallabel
-.yet_a_local:
-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

+ + + xAsm Labels + + + +

Labels


+

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
+AnotherGlobal:
+.locallabel
+.yet_a_local:
+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 932e4462..25798bb5 100644 --- a/doc/asm/macro.htm +++ b/doc/asm/macro.htm @@ -1,120 +1,120 @@ - - - xAsm MACRO/ENDM - - - -

MACRO
-ENDM


- -

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
-          ld   a,80
-          call MyFunc
-          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
-               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
-               xor  a,a
-.loop\@        ld   [hl+],a
-               dec  c
-               jr   nz,.loop\@
-               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 - -

- - - -
-
    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).
- -

See also:

- - -

-

Last updated 02 July 1997 by Carsten Sorensen

+ + + xAsm MACRO/ENDM + + + +

MACRO
+ENDM


+ +

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
+          ld   a,80
+          call MyFunc
+          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
+               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
+               xor  a,a
+.loop\@        ld   [hl+],a
+               dec  c
+               jr   nz,.loop\@
+               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 + +

+ + + +
+
    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).
+ +

See also:

+ + +

+

Last updated 02 July 1997 by Carsten Sorensen

diff --git a/doc/asm/miscfunc.htm b/doc/asm/miscfunc.htm index 4c915511..f0e8ad11 100644 --- a/doc/asm/miscfunc.htm +++ b/doc/asm/miscfunc.htm @@ -1,41 +1,41 @@ - - - xAsm Other functions - - - -

Other functions -

-
- -There's a few other functions that do various useful things: - -

- - - - - - - - - - - - - - -
Other functions
NameOperation
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
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm Other functions + + + +

Other functions +

+
+ +There's a few other functions that do various useful things: + +

+ + + + + + + + + + + + + + +
Other functions
NameOperation
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
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/opt.htm b/doc/asm/opt.htm index 9873d4b5..a76091c5 100644 --- a/doc/asm/opt.htm +++ b/doc/asm/opt.htm @@ -1,37 +1,37 @@ - - - xAsm OPT - - - -

OPT -

-
- -

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
-    OPT   g.oOX    ;Set the GB graphics constants to use these characters
-    DW    `..ooOOXX
-    POPO
-    DW    `00112233
-
- -

The options that OPT can modify are currently: b, e and g - -

See also:

- - -

-

Last updated 20 July 1997 by Carsten Sorensen

+ + + xAsm OPT + + + +

OPT +

+
+ +

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
+    OPT   g.oOX    ;Set the GB graphics constants to use these characters
+    DW    `..ooOOXX
+    POPO
+    DW    `00112233
+
+ +

The options that OPT can modify are currently: b, e and g + +

See also:

+ + +

+

Last updated 20 July 1997 by Carsten Sorensen

diff --git a/doc/asm/popo.htm b/doc/asm/popo.htm index fe88a080..fec157c6 100644 --- a/doc/asm/popo.htm +++ b/doc/asm/popo.htm @@ -1,24 +1,24 @@ - - - xAsm POPO, PUSHO - - - -

POPO
-PUSHO -

-
- -

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. - -

See also:

- - -

-

Last updated 20 July 1997 by Carsten Sorensen

+ + + xAsm POPO, PUSHO + + + +

POPO
+PUSHO +

+
+ +

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. + +

See also:

+ + +

+

Last updated 20 July 1997 by Carsten Sorensen

diff --git a/doc/asm/pops.htm b/doc/asm/pops.htm index ba61f4c6..cc8aaf95 100644 --- a/doc/asm/pops.htm +++ b/doc/asm/pops.htm @@ -1,22 +1,22 @@ - - - xAsm POPS, PUSHS - - - -

POPS
-PUSHS -

-
- -

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. - -

See also:

- - -

-

Last updated 18 July 1997 by Carsten Sorensen

+ + + xAsm POPS, PUSHS + + + +

POPS
+PUSHS +

+
+ +

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. + +

See also:

+ + +

+

Last updated 18 July 1997 by Carsten Sorensen

diff --git a/doc/asm/presym.htm b/doc/asm/presym.htm index 10c07244..1afc8b54 100644 --- a/doc/asm/presym.htm +++ b/doc/asm/presym.htm @@ -1,63 +1,63 @@ - - - xAsm Predeclared symbols - - - -

Predeclared symbols -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Symbols
NameContentsType
@PC valueEQU
_PIFixed point ¶EQU
_RS_RS counterSET
_NARGNumber of arguments passed to macroEQU
__LINE__The current linenumberEQU
__FILE__The current filenameEQUS
__DATE__Todays dateEQUS
__TIME__The current timeEQUS
- -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm Predeclared symbols + + + +

Predeclared symbols +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Symbols
NameContentsType
@PC valueEQU
_PIFixed point ¶EQU
_RS_RS counterSET
_NARGNumber of arguments passed to macroEQU
__LINE__The current linenumberEQU
__FILE__The current filenameEQUS
__DATE__Todays dateEQUS
__TIME__The current timeEQUS
+ +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/print.htm b/doc/asm/print.htm index f33e01ad..3932d809 100644 --- a/doc/asm/print.htm +++ b/doc/asm/print.htm @@ -1,39 +1,39 @@ - - - xAsm PRINTT, PRINTV, PRINTF - - - -

PRINTT
-PRINTV
-PRINTF
-

-
- -

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"
-PRINTV    (2+3)/5
-PRINTF    MUL(3.14,3987.0)
-
-PRINTT prints out a string
-PRINTV prints out an integer value or, as in the example, the result of a calculation. Unsurprisingly you can also print out a constant symbols value
-PRINTF prints out a fixed point value.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm PRINTT, PRINTV, PRINTF + + + +

PRINTT
+PRINTV
+PRINTF
+

+
+ +

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"
+PRINTV    (2+3)/5
+PRINTF    MUL(3.14,3987.0)
+
+PRINTT prints out a string
+PRINTV prints out an integer value or, as in the example, the result of a calculation. Unsurprisingly you can also print out a constant symbols value
+PRINTF prints out a fixed point value.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/purge.htm b/doc/asm/purge.htm index 5bbdc2a1..0aae44c7 100644 --- a/doc/asm/purge.htm +++ b/doc/asm/purge.htm @@ -1,25 +1,25 @@ - - - xAsm PURGE - - - -

PURGE


- -

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"
-AOLer       EQUS    "Me too"
-            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

+ + + xAsm PURGE + + + +

PURGE


+ +

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"
+AOLer       EQUS    "Me too"
+            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 0e2694cb..be0ec0be 100644 --- a/doc/asm/rept.htm +++ b/doc/asm/rept.htm @@ -1,50 +1,50 @@ - - - xAsm REPT, ENDR - - - -

REPT
-ENDR -

-
- -

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
-add  a,c
-ENDR
-
-

This will assemble add a,c four times.
-

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
-
- -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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm REPT, ENDR + + + +

REPT
+ENDR +

+
+ +

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
+add  a,c
+ENDR
+
+

This will assemble add a,c four times.
+

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
+
+ +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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/rs.htm b/doc/asm/rs.htm index 7a485e70..d0375743 100644 --- a/doc/asm/rs.htm +++ b/doc/asm/rs.htm @@ -1,89 +1,89 @@ - - - xAsm RSSET, RSRESET, RB, RW - - - -

RSSET
-RERESET
-RB
-RW


- -

The RS group of commands is a handy way of defining structures:
-
- - - - -
-
              RSRESET
-str_pStuff    RW   1
-str_tData     RB   256
-str_bCount    RB   1
-str_SIZEOF    RB   0
-
-

The example defines four equated symbols:
-
- - - - - - - - - - - - - - - - - - - - - - - -
Defined symbols
NameValue
str_pStuff0
str_tData2
str_bCount258
str_SIZEOF259
-
-There are four commands in the RS group of commands:
-
- - - - - - - - - - - - - - - - - - - - - - - -
RS related commands
CommandMeaning
RSRESETResets the _RS counter to zero
RSSET constexprSets the _RS counter to constexpr
RB constexprSets the preceding symbol to _RS and adds constexpr to _RS
RW constexprSets 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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm RSSET, RSRESET, RB, RW + + + +

RSSET
+RERESET
+RB
+RW


+ +

The RS group of commands is a handy way of defining structures:
+
+ + + + +
+
              RSRESET
+str_pStuff    RW   1
+str_tData     RB   256
+str_bCount    RB   1
+str_SIZEOF    RB   0
+
+

The example defines four equated symbols:
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Defined symbols
NameValue
str_pStuff0
str_tData2
str_bCount258
str_SIZEOF259
+
+There are four commands in the RS group of commands:
+
+ + + + + + + + + + + + + + + + + + + + + + + +
RS related commands
CommandMeaning
RSRESETResets the _RS counter to zero
RSSET constexprSets the _RS counter to constexpr
RB constexprSets the preceding symbol to _RS and adds constexpr to _RS
RW constexprSets 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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/section.htm b/doc/asm/section.htm index 5e562c7f..0a6e5e9b 100644 --- a/doc/asm/section.htm +++ b/doc/asm/section.htm @@ -1,94 +1,94 @@ - - - xAsm SECTION - - - -

SECTION

-
- -

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.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Section types
NameFunction
CODEA 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).
DATAReally just a synonym for CODE.
BSSThis section is for variables. For the Gameboy it will be placed where the Gameboy RAM is.
HOMEGameboy ONLY: A code section that will be placed in Gameboy bank #0.
VRAMGameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is.
HRAMGameboy 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
- -

See also:

- - -

-

Last updated á18 July 1997 by Carsten Sorensen

+ + + xAsm SECTION + + + +

SECTION

+
+ +

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.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Section types
NameFunction
CODEA 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).
DATAReally just a synonym for CODE.
BSSThis section is for variables. For the Gameboy it will be placed where the Gameboy RAM is.
HOMEGameboy ONLY: A code section that will be placed in Gameboy bank #0.
VRAMGameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is.
HRAMGameboy 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
+ +

See also:

+ + +

+

Last updated á18 July 1997 by Carsten Sorensen

diff --git a/doc/asm/set.htm b/doc/asm/set.htm index ae219f93..f020ce78 100644 --- a/doc/asm/set.htm +++ b/doc/asm/set.htm @@ -1,30 +1,30 @@ - - - xAsm SET - - - -

SET


- -

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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

- + + + xAsm SET + + + +

SET


+ +

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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

+ diff --git a/doc/asm/shift.htm b/doc/asm/shift.htm index 3cb54477..1ec29123 100644 --- a/doc/asm/shift.htm +++ b/doc/asm/shift.htm @@ -1,20 +1,20 @@ - - - xAsm SHIFT - - - -

SHIFT


- -

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.
- -

See also:

- - -

-

Last updated 21 June 1997 by Carsten Sorensen

+ + + xAsm SHIFT + + + +

SHIFT


+ +

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.
+ +

See also:

+ + +

+

Last updated 21 June 1997 by Carsten Sorensen

diff --git a/doc/asm/symbols.htm b/doc/asm/symbols.htm index 1b35bbf7..ee3f26f8 100644 --- a/doc/asm/symbols.htm +++ b/doc/asm/symbols.htm @@ -1,32 +1,32 @@ - - - xAsm Symbols - - - -

xAsm Symbols


- -xAsm supports several types of symbols:
-
- - -A symbol cannot have the same name as a reserved keyword. - -

See also:

- - -

-

Last updated 02 July 1997 by Carsten Sorensen

+ + + xAsm Symbols + + + +

xAsm Symbols


+ +xAsm supports several types of symbols:
+
+ + +A symbol cannot have the same name as a reserved keyword. + +

See also:

+ + +

+

Last updated 02 July 1997 by Carsten Sorensen

diff --git a/doc/asm/syntax.htm b/doc/asm/syntax.htm index f522cbeb..a88f4115 100644 --- a/doc/asm/syntax.htm +++ b/doc/asm/syntax.htm @@ -1,46 +1,46 @@ - - - xAsm Syntax - - - -

xAsm Syntax


- -The syntax line-based, just as in any other assembler. Meaning that you do one instruction or pseudo-op per line:
-
- - - - -
-
[label] [instruction] [;comment]
-
-
-Example:
-
- - - - -
-
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: -
-
- - - - -
-
********************************
-* These are full line comments *
-********************************
-
- -

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

+ + + xAsm Syntax + + + +

xAsm Syntax


+ +The syntax line-based, just as in any other assembler. Meaning that you do one instruction or pseudo-op per line:
+
+ + + + +
+
[label] [instruction] [;comment]
+
+
+Example:
+
+ + + + +
+
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: +
+
+ + + + +
+
********************************
+* These are full line comments *
+********************************
+
+ +

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 79e350f1..fecc8b08 100644 --- a/doc/asm/trg_gb.htm +++ b/doc/asm/trg_gb.htm @@ -1,101 +1,101 @@ - - - xAsm Gameboy - - - -

Gameboy -

-
- -

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.
-


-Instructions

-
    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
-


Addressingmodes

-

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 ;)
-
-

Conditioncodes

-
    C
-    NC
-    Z
-    NZ
- -

-

Last updated 20 July 1997 by Carsten Sorensen

+ + + xAsm Gameboy + + + +

Gameboy +

+
+ +

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.
+


+Instructions

+
    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
+


Addressingmodes

+

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 ;)
+
+

Conditioncodes

+
    C
+    NC
+    Z
+    NZ
+ +

+

Last updated 20 July 1997 by Carsten Sorensen

diff --git a/doc/asm/usage.htm b/doc/asm/usage.htm index 71b9696f..2e7e1c8e 100644 --- a/doc/asm/usage.htm +++ b/doc/asm/usage.htm @@ -1,37 +1,37 @@ - - - xAsm Usage - - - -

xAsm Usage


- - - - - -
-
C:\>xAsm [options] asmfile
-
-Options are preceded by a dash (-) 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)
-
- -

See also:

- - -

-

Last updated 08 October 1997 by Carsten Sorensen

+ + + xAsm Usage + + + +

xAsm Usage


+ + + + + +
+
C:\>xAsm [options] asmfile
+
+Options are preceded by a dash (-) 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)
+
+ +

See also:

+ + +

+

Last updated 08 October 1997 by Carsten Sorensen

diff --git a/doc/fix.htm b/doc/fix.htm index 089e08be..46446328 100644 --- a/doc/fix.htm +++ b/doc/fix.htm @@ -1,102 +1,102 @@ - - - RGBFix - - - -
- - - - -

RGBFix Documentation

-
-

Table of Contents

- -


History

- - - - - - - - - - - - - - - - - - - - - - -
The history of RGBFix
VersionDatedRelease notes
1.01 Oct. 96First release
1.013 Dec. 96-t didn't Work. Fixed.
1.0220 July 1997RGBFix can now also truncate the ROM-images to a valid size.
-
-


Usage


-
    rgbfix [options] image[.gb]
-
-Options are preceded by a dash (-) and go as follows:
-
-
    tname   : Change title field of image
-    p       : Pad image to valid size
-    v       : Validate header
-    d       : Debug, don't change image
-    r       : Truncate image to valid size
-    h       : Short help text
-

Note: RGBFix was previously released by me as a standalone program known as GBFix. -I have chosen to release it in the ASMotor package instead from now on. Its usage has changed a bit from that of GBFix -for the sake of consistence with the other ASMotor tools. Being part of RGBDS means RGBFix' -distribution now follows the same rules as the rest of the ASMotor package. GBFix still follows its own rules.
-



Options

-

How to use the various options. -


-Titlefield

-

This option changes the titlefield of the image to the string you specify truncated to a maximum of 16 characters. No -uppercase conversion is performed.
-
-

    rgbfix -tASMOTOR foobar.gb
-


Pad Image

-

Pad the image to a valid size. 32Kb, 64Kb, 128Kb, 256Kb and 512Kb. RGBFix intelligently decides which one to use. -The cartridge size byte in the image header is left unchanged. If you find this undesireable use the Validate Header option.
-
-

    rgbfix -p foobar.gb
-


Truncate Image

-

Truncates the image to a valid size. 32Kb, 64Kb, 128Kb, 256Kb and 512Kb. RGBFix intelligently decides which one to use. -The cartridge size byte in the image header is left unchanged. If you find this undesireable use the Validate Header option.
-
-

    rgbfix -r foobar.gb
-


-Validate Header

-

Examines the header for errors and validates them if any.
-
-Areas examined: -

-
-
    rgbfix -v foobar.gb
-


-Debug

-

Pretends it performs the desired changes.
-
-

    rgbfix -tASMOTOR -p -v -d foobar.gb
-
-
-

Last updated 18 July 1997 by Carsten Sorensen

- - + + + RGBFix + + + +
+ + + + +

RGBFix Documentation

+
+

Table of Contents

+ +


History

+ + + + + + + + + + + + + + + + + + + + + + +
The history of RGBFix
VersionDatedRelease notes
1.01 Oct. 96First release
1.013 Dec. 96-t didn't Work. Fixed.
1.0220 July 1997RGBFix can now also truncate the ROM-images to a valid size.
+
+


Usage


+
    rgbfix [options] image[.gb]
+
+Options are preceded by a dash (-) and go as follows:
+
+
    tname   : Change title field of image
+    p       : Pad image to valid size
+    v       : Validate header
+    d       : Debug, don't change image
+    r       : Truncate image to valid size
+    h       : Short help text
+

Note: RGBFix was previously released by me as a standalone program known as GBFix. +I have chosen to release it in the ASMotor package instead from now on. Its usage has changed a bit from that of GBFix +for the sake of consistence with the other ASMotor tools. Being part of RGBDS means RGBFix' +distribution now follows the same rules as the rest of the ASMotor package. GBFix still follows its own rules.
+



Options

+

How to use the various options. +


+Titlefield

+

This option changes the titlefield of the image to the string you specify truncated to a maximum of 16 characters. No +uppercase conversion is performed.
+
+

    rgbfix -tASMOTOR foobar.gb
+


Pad Image

+

Pad the image to a valid size. 32Kb, 64Kb, 128Kb, 256Kb and 512Kb. RGBFix intelligently decides which one to use. +The cartridge size byte in the image header is left unchanged. If you find this undesireable use the Validate Header option.
+
+

    rgbfix -p foobar.gb
+


Truncate Image

+

Truncates the image to a valid size. 32Kb, 64Kb, 128Kb, 256Kb and 512Kb. RGBFix intelligently decides which one to use. +The cartridge size byte in the image header is left unchanged. If you find this undesireable use the Validate Header option.
+
+

    rgbfix -r foobar.gb
+


+Validate Header

+

Examines the header for errors and validates them if any.
+
+Areas examined: +

+
+
    rgbfix -v foobar.gb
+


+Debug

+

Pretends it performs the desired changes.
+
+

    rgbfix -tASMOTOR -p -v -d foobar.gb
+
+
+

Last updated 18 July 1997 by Carsten Sorensen

+ + diff --git a/doc/geninfo.htm b/doc/geninfo.htm index 3da02e0e..a1ecbfe0 100644 --- a/doc/geninfo.htm +++ b/doc/geninfo.htm @@ -1,156 +1,156 @@ - - - General Information - - - -
- - - - -

ASMotor General Information

-
-
-

Table of Contents -

- -


BlahBlahBlah

-

The ASMotor package (xAsm, xLink, RGBFix, examples and documentation) is freeware and distributed as is. The -author retains his copyright and right to modify the specifications and operation of the software without notice. -

In other words this means I encourage you to... -

-

This also means you can't... -

-

I am happy to say that xAsm and xLink use PMODE/W as DOS-extender for the MS-DOS port! This means fast assembling of your sourcecodes. A lot faster. PMODE/W is a drop-in replacement for the bulky DOS4GW. If you are a programmer you should check out http://www.di.net/pmw
-"PMODE/W is Copyright (c) 1994-1997, Charles Scheffold and Thomas Pytel. All rights reserved."
-



The Author

-

Any questions? Write me!
-
-Carsten Sorensen
-1 Spring Court
-Guildford
-Surrey GU2 6QW
-United Kingdom
-
-e-mail:
-surfsmurf@matilde.demon.co.uk (private)
-csorensen@ea.com (work)
-
-Get the latest version from my web page at http://www.matilde.demon.co.uk -



Introduction

-

ASMotor is a package currently consisting of three programs (xAsm, xLink and RGBFix) originally designed for development on the Gameboy hand-held -video-game console by Nintendo but recently it has moved towards being a target independent shell for making development of new -assemblers for different processors easier.
-xAsm is a decently fast assembler (up to 800000 lines/minute (hrm well actually that's for 16384 lines of NOP's ;) on a P-120). It converts an assembler source into the RGB object-fileformat.
-xLink is used to link multiple (one or more) object files together into one target file eg. a Gameboy ROM or Psion2 relocatable module.
-RGBFix is used to apply some final cosmetic details to a Gameboy ROM-image.
-

This document does not try to teach you how to program in assembler, how to program a specifix processor or the Gameboy. -It does just briefly explain the features of xAsm and xLink. Sometimes I will assume that you have actually worked with assemblers before and that you are familiar with the target processor. -

Why another assembler? There seems to be millions out there! This project started out as a Gameboy assembler because none of the available assemblers had the features I wanted. Now the reason is I want to make the most powerful assembler. Ever ;) And I want to be able to re-use it easily whenever I encounter a new system with another processor. -Don't like it? Something you'd like to see added? Mail me and I'll see what I can do. -

The assembler and linker are written entirely in ANSI C using Bison for the parser. I try to maintain two pre-compiled ports of ASMotor, one for the MS-DOS environment and one for Linux. Bison - is a GNU tool (compiler-compiler) tailored to aid in the development of compilers which you will need if you want to compile it afresh.
- -



Installation

-

Anywhere on your HD will do. For maximum enjoyment I recommend adding the directory to your path. -Alternatively you can run it from a floppy.
- -



The Documentation

-

The documentation only comes in one flavour. HTML. This has several advantages for me -

- -


History

- - - - - - - - - - - - - - - - - - - - - - - - - -
The history of ASMotor
VersionDatedRelease notes
1.003 July 1997First release
1.0120 July 1997RGBDS fixes:
- RGBFix can now also truncate the ROM-images to a valid size.
- RGBAsm supports the LDD and LDI syntax plus [HLD] and [HLI]. LDH is - synonymous with LDIO.
- Example filenames have been changed to adhere to Jeff Frohweins proposed - standard.
- General fixes:
-RGBLink knows about big and little endian. Plus it can do range checking -on intermediate results in an expression. This is necessary to support -different types of CPUs.
-RGBLink DIDN'T know about the special PC symbol "@" so if you used it -more than once per sourcefile in an expression the linker had to -resolve, things would go horribly wrong.
-There was a bug in the macro parameter passing. Any whitespace after the -last parameter would be appended to the last parameter. Reported by Jeff Frohwein.
-A section stack has been implemented. Look up POPS and PUSHS in the -manual. Jeff Frohweins doing again.
-OPT command added for defining and changing some options while assembling.
-You can now define which characters are used for the Gameboy graphics -integer (`) using the commandline or the new OPT command. Cool idea by (surprise surprise) Jeff Frohwein.
-Also, an option stack has been added. Look up POPO and PUSHO in the -manual.
-Fixed yet another line number bug reported by Jeff Frohwein (when will this guy leave me alone? ;)
-
1.0222 July 1997General fixes:
-The lamest typo bug of all time has been fixed. RGBAsm would output a word defined with DW as 4 bytes instead of 2. Jeff Frohwein reported this.
-The first line of an included file didn't assemble correctly.
--b option added for setting the characters used for binary constants.
-
1.1021 Sep 1997General fixes:
-The assembler would crash if you tried to use a macro symbol in an expression. -(Jeff Frohwein)
-You couldn't use STRCMP, STRLEN and STRIN in relocatable expressions. (Harry -P. Mulder)
-Relocatable symbols are no longer allowed as arguments to the DEF function.
-Finally! A librarian and smart linking has been added.
-Bug fixed in the assembler where it would sometimes write out too many bytes -for HRAM section definitions.
--z options (set fill value used for uninitialised data) added to the -assembler and linker.
-The assembler will now read in any type of ASCII file on any type of OS. -
-

-

Last updated 08 October 1997 by Carsten Sorensen

- - + + + General Information + + + +
+ + + + +

ASMotor General Information

+
+
+

Table of Contents +

+ +


BlahBlahBlah

+

The ASMotor package (xAsm, xLink, RGBFix, examples and documentation) is freeware and distributed as is. The +author retains his copyright and right to modify the specifications and operation of the software without notice. +

In other words this means I encourage you to... +

+

This also means you can't... +

+

I am happy to say that xAsm and xLink use PMODE/W as DOS-extender for the MS-DOS port! This means fast assembling of your sourcecodes. A lot faster. PMODE/W is a drop-in replacement for the bulky DOS4GW. If you are a programmer you should check out http://www.di.net/pmw
+"PMODE/W is Copyright (c) 1994-1997, Charles Scheffold and Thomas Pytel. All rights reserved."
+



The Author

+

Any questions? Write me!
+
+Carsten Sorensen
+1 Spring Court
+Guildford
+Surrey GU2 6QW
+United Kingdom
+
+e-mail:
+surfsmurf@matilde.demon.co.uk (private)
+csorensen@ea.com (work)
+
+Get the latest version from my web page at http://www.matilde.demon.co.uk +



Introduction

+

ASMotor is a package currently consisting of three programs (xAsm, xLink and RGBFix) originally designed for development on the Gameboy hand-held +video-game console by Nintendo but recently it has moved towards being a target independent shell for making development of new +assemblers for different processors easier.
+xAsm is a decently fast assembler (up to 800000 lines/minute (hrm well actually that's for 16384 lines of NOP's ;) on a P-120). It converts an assembler source into the RGB object-fileformat.
+xLink is used to link multiple (one or more) object files together into one target file eg. a Gameboy ROM or Psion2 relocatable module.
+RGBFix is used to apply some final cosmetic details to a Gameboy ROM-image.
+

This document does not try to teach you how to program in assembler, how to program a specifix processor or the Gameboy. +It does just briefly explain the features of xAsm and xLink. Sometimes I will assume that you have actually worked with assemblers before and that you are familiar with the target processor. +

Why another assembler? There seems to be millions out there! This project started out as a Gameboy assembler because none of the available assemblers had the features I wanted. Now the reason is I want to make the most powerful assembler. Ever ;) And I want to be able to re-use it easily whenever I encounter a new system with another processor. +Don't like it? Something you'd like to see added? Mail me and I'll see what I can do. +

The assembler and linker are written entirely in ANSI C using Bison for the parser. I try to maintain two pre-compiled ports of ASMotor, one for the MS-DOS environment and one for Linux. Bison + is a GNU tool (compiler-compiler) tailored to aid in the development of compilers which you will need if you want to compile it afresh.
+ +



Installation

+

Anywhere on your HD will do. For maximum enjoyment I recommend adding the directory to your path. +Alternatively you can run it from a floppy.
+ +



The Documentation

+

The documentation only comes in one flavour. HTML. This has several advantages for me +

+ +


History

+ + + + + + + + + + + + + + + + + + + + + + + + + +
The history of ASMotor
VersionDatedRelease notes
1.003 July 1997First release
1.0120 July 1997RGBDS fixes:
+ RGBFix can now also truncate the ROM-images to a valid size.
+ RGBAsm supports the LDD and LDI syntax plus [HLD] and [HLI]. LDH is + synonymous with LDIO.
+ Example filenames have been changed to adhere to Jeff Frohweins proposed + standard.
+ General fixes:
+RGBLink knows about big and little endian. Plus it can do range checking +on intermediate results in an expression. This is necessary to support +different types of CPUs.
+RGBLink DIDN'T know about the special PC symbol "@" so if you used it +more than once per sourcefile in an expression the linker had to +resolve, things would go horribly wrong.
+There was a bug in the macro parameter passing. Any whitespace after the +last parameter would be appended to the last parameter. Reported by Jeff Frohwein.
+A section stack has been implemented. Look up POPS and PUSHS in the +manual. Jeff Frohweins doing again.
+OPT command added for defining and changing some options while assembling.
+You can now define which characters are used for the Gameboy graphics +integer (`) using the commandline or the new OPT command. Cool idea by (surprise surprise) Jeff Frohwein.
+Also, an option stack has been added. Look up POPO and PUSHO in the +manual.
+Fixed yet another line number bug reported by Jeff Frohwein (when will this guy leave me alone? ;)
+
1.0222 July 1997General fixes:
+The lamest typo bug of all time has been fixed. RGBAsm would output a word defined with DW as 4 bytes instead of 2. Jeff Frohwein reported this.
+The first line of an included file didn't assemble correctly.
+-b option added for setting the characters used for binary constants.
+
1.1021 Sep 1997General fixes:
+The assembler would crash if you tried to use a macro symbol in an expression. +(Jeff Frohwein)
+You couldn't use STRCMP, STRLEN and STRIN in relocatable expressions. (Harry +P. Mulder)
+Relocatable symbols are no longer allowed as arguments to the DEF function.
+Finally! A librarian and smart linking has been added.
+Bug fixed in the assembler where it would sometimes write out too many bytes +for HRAM section definitions.
+-z options (set fill value used for uninitialised data) added to the +assembler and linker.
+The assembler will now read in any type of ASCII file on any type of OS. +
+

+

Last updated 08 October 1997 by Carsten Sorensen

+ + diff --git a/doc/index.htm b/doc/index.htm index 8a769770..57946acc 100644 --- a/doc/index.htm +++ b/doc/index.htm @@ -1,33 +1,33 @@ - - - ASMotor Documentation - - - -
-
- - - -

ASMotor v1.10
-documentation
-
(stay with the machine)
-

-

-

Table of Contents -

- -
-
-

Last updated 21 September 1997 by Carsten Sorensen

- - + + + ASMotor Documentation + + + +
+
+ + + +

ASMotor v1.10
+documentation
+
(stay with the machine)
+

+

+

Table of Contents +

+ +
+
+

Last updated 21 September 1997 by Carsten Sorensen

+ + diff --git a/doc/lib.htm b/doc/lib.htm index be561bc1..f48faee1 100644 --- a/doc/lib.htm +++ b/doc/lib.htm @@ -1,71 +1,71 @@ - - - xLib - - - -
-
- - - - -

xLib Documentation

-

Table of Contents

- -


-
-
-History

- - - - - - - - - - - - -
The history of xLib
VersionDatedRelease notes
1.021 Sep. 1997First release
-
-
-
-

Usage

-
    xlib library command [module1 module2 ... modulen]
-
-

-
-The Commands

-

The command specified after library on the commandline tells xLib what to do. -

The following commands are available: - - - - - - - - - - - - - - - - - -
aAdds (or replaces if already present) the modules to the library
dDeletes the modules specified from the library
lLists the library contents
xExtracts the modules from the library
-


-

Last updated 21 September 1997 by Carsten Sorensen

- - + + + xLib + + + +
+
+ + + + +

xLib Documentation

+

Table of Contents

+ +


+
+
+History

+ + + + + + + + + + + + +
The history of xLib
VersionDatedRelease notes
1.021 Sep. 1997First release
+
+
+
+

Usage

+
    xlib library command [module1 module2 ... modulen]
+
+

+
+The Commands

+

The command specified after library on the commandline tells xLib what to do. +

The following commands are available: + + + + + + + + + + + + + + + + + +
aAdds (or replaces if already present) the modules to the library
dDeletes the modules specified from the library
lLists the library contents
xExtracts the modules from the library
+


+

Last updated 21 September 1997 by Carsten Sorensen

+ + diff --git a/doc/link.htm b/doc/link.htm index a21f8181..ed1aac76 100644 --- a/doc/link.htm +++ b/doc/link.htm @@ -1,145 +1,145 @@ - - - xLink - - - -
-
- - - - -

xLink Documentation

-

Table of Contents

- -


-
-
-History

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The history of xLink
VersionDatedRelease notes
1.01 Oct. 96First release (RGBDS)
1.013 Dec. 96BANK() didn't work. Fixed.
- Sections were quite often output in the wrong order. Fixed.
1.0212 Feb. 97-s switch and mapfile option added
1.0323 Mar. 97Mapfile now shows BSS, VRAM and HRAM areas
- There was a bug regarding fixed HOME sections.
1.0403 July 1997First ASMotor release. Supports big-endian CPUs as well. Usage changed to allow for different output fileformats
1.0520 July 1997We can now do range checking on intermediate results in an expression. This is necessary to support -different types of CPUs.
-RGBLink DIDN'T know about the special PC symbol "@" so if you used it -more than once per sourcefile in an expression the linker had to -resolve, things would go horribly wrong.
-
1.0621 September 1997Smart linking and library support added
- Program renamed to xLink
-
-
-
-
-

Usage

-
    xlink [options] linkfile
-

Options are preceded by a dash (-) and go as follows:
-
-

    h         : Short help text
-    mmapfile  : Write a mapfile
-    t         : Output target:
-      tg      : Gameboy ROM image (default)
-      ts      : Gameboy Small mode (32kB) ROM image
-      tp      : Psion2 relocatable module
-    zHX       : Set the byte value (hex format) used for uninitialised data (default is ? for random)
-
-
-

-
-The Linkfile

-

A linkfile is used to tell xLink which objects to include and what the outputname should be. It is in plain ASCII-format.
-
-

    # Linkfile for foobar.gb
-      
-    [Objects]
-    foo.obj
-    bar.obj
-      
-    [Libraries]
-    mylib.lib
-
-    [Output]
-    foobar.gb
-

A line starting with # is ignored.
-

If you use libraries they will only be included if one of the objects actually reference them. This works on a SECTION level and not on a module level. This means that when you write libraries you can put each subroutine in its own SECTION so only the relevant bits are included. -



-Operation for Gameboy (-tg)

-

Sections created with HOME in the assembler are placed in the GB bank #0 (the fixed bank $0000-$3FFF) in the order they are loaded from the objectfiles specified in the linkfile. So you want the first file in the linkfile to contain your header. -CODE/DATA sections are placed in any bank other than #0. This means you have absolutely no control over which sections goes where. This insures minimal slack (unused bytes) at the end of each bank in the image. -

Currently the linker doesn't calculate the GB checksums. -You must use RGBFix to do this.

- -



-Operation for Gameboy small mode (-ts)

-

Small mode forces all DATA/CODE sections to be of type HOME and increases the -HOME section size from 16kB to 32kB. This also means that CODE/DATA/HOME sections are written to the final image in the order you have specified in the linkfile. -

Currently the linker doesn't calculate the GB checksums. -You must use RGBFix to do this.

- -



-Operation for Psion2 relocatable modules (-tp)

-

This is a fileformat for the Psion2 that allows you to load your code into where ever there's any free space. The only sections types allowed are HOME, DATA and BSS. All CODE and DATA sections are written to the output file in the order specified in the linkfile. The BSS are actually then expanded to DATA sections filled with zeroes and appended. This might change later.
-The file looks like this (all values are big endian): -

-LONG    NumberOfDataBytes
-REPT    NumberOfDataBytes
-    DB  x
-ENDR
-LONG    NumberOfPatches
-REPT    NumberOfPatches
-    LONG    x    ; A value to add to the word at address x in the code
-ENDR
-
- -
-

Last updated 08 October 1997 by Carsten Sorensen

- - + + + xLink + + + +
+
+ + + + +

xLink Documentation

+

Table of Contents

+ +


+
+
+History

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
The history of xLink
VersionDatedRelease notes
1.01 Oct. 96First release (RGBDS)
1.013 Dec. 96BANK() didn't work. Fixed.
+ Sections were quite often output in the wrong order. Fixed.
1.0212 Feb. 97-s switch and mapfile option added
1.0323 Mar. 97Mapfile now shows BSS, VRAM and HRAM areas
+ There was a bug regarding fixed HOME sections.
1.0403 July 1997First ASMotor release. Supports big-endian CPUs as well. Usage changed to allow for different output fileformats
1.0520 July 1997We can now do range checking on intermediate results in an expression. This is necessary to support +different types of CPUs.
+RGBLink DIDN'T know about the special PC symbol "@" so if you used it +more than once per sourcefile in an expression the linker had to +resolve, things would go horribly wrong.
+
1.0621 September 1997Smart linking and library support added
+ Program renamed to xLink
+
+
+
+
+

Usage

+
    xlink [options] linkfile
+

Options are preceded by a dash (-) and go as follows:
+
+

    h         : Short help text
+    mmapfile  : Write a mapfile
+    t         : Output target:
+      tg      : Gameboy ROM image (default)
+      ts      : Gameboy Small mode (32kB) ROM image
+      tp      : Psion2 relocatable module
+    zHX       : Set the byte value (hex format) used for uninitialised data (default is ? for random)
+
+
+

+
+The Linkfile

+

A linkfile is used to tell xLink which objects to include and what the outputname should be. It is in plain ASCII-format.
+
+

    # Linkfile for foobar.gb
+      
+    [Objects]
+    foo.obj
+    bar.obj
+      
+    [Libraries]
+    mylib.lib
+
+    [Output]
+    foobar.gb
+

A line starting with # is ignored.
+

If you use libraries they will only be included if one of the objects actually reference them. This works on a SECTION level and not on a module level. This means that when you write libraries you can put each subroutine in its own SECTION so only the relevant bits are included. +



+Operation for Gameboy (-tg)

+

Sections created with HOME in the assembler are placed in the GB bank #0 (the fixed bank $0000-$3FFF) in the order they are loaded from the objectfiles specified in the linkfile. So you want the first file in the linkfile to contain your header. +CODE/DATA sections are placed in any bank other than #0. This means you have absolutely no control over which sections goes where. This insures minimal slack (unused bytes) at the end of each bank in the image. +

Currently the linker doesn't calculate the GB checksums. +You must use RGBFix to do this.

+ +



+Operation for Gameboy small mode (-ts)

+

Small mode forces all DATA/CODE sections to be of type HOME and increases the +HOME section size from 16kB to 32kB. This also means that CODE/DATA/HOME sections are written to the final image in the order you have specified in the linkfile. +

Currently the linker doesn't calculate the GB checksums. +You must use RGBFix to do this.

+ +



+Operation for Psion2 relocatable modules (-tp)

+

This is a fileformat for the Psion2 that allows you to load your code into where ever there's any free space. The only sections types allowed are HOME, DATA and BSS. All CODE and DATA sections are written to the output file in the order specified in the linkfile. The BSS are actually then expanded to DATA sections filled with zeroes and appended. This might change later.
+The file looks like this (all values are big endian): +

+LONG    NumberOfDataBytes
+REPT    NumberOfDataBytes
+    DB  x
+ENDR
+LONG    NumberOfPatches
+REPT    NumberOfPatches
+    LONG    x    ; A value to add to the word at address x in the code
+ENDR
+
+ +
+

Last updated 08 October 1997 by Carsten Sorensen

+ + diff --git a/doc/rgb0.htm b/doc/rgb0.htm index ca84da95..790901e8 100644 --- a/doc/rgb0.htm +++ b/doc/rgb0.htm @@ -1,221 +1,221 @@ - - - RGB? Fileformat - - - -
- - - - -

The RGB ObjectFileFormats

-
-

Table of Contents

- -
-


Background

-

I developed the RGB0 fileformat mainly because I needed a suitable dataformat to hold the output from xAsm that was powerful to accomodate all the features I needed and also would make it easy for me to add -new ones. -The reason for documenting it is so people can write converters between it and other formats. Perhaps even develop other compilers for it?
-
-The RGB1 fileformat saw the light of day with the V1.02 of the old RGBDS release because of the addition of fixed sections.
-The RGB2 fileformat emerged because I needed to add support for big endian CPUs. -



FileStructure

-LONG is a 32-bit integer stored in little-endian format (Intel)
-BYTE is an 8-bit integer
-STRING is a 0 terminated string of BYTE
-
-Down to business...
-
-    ; There's a header...
-      
-    BYTE    ID[4]                      ;"RGB0", "RGB1", "RGB2"
-    LONG    NumberOfSymbols            ;The number of symbols used in this file
-    LONG    NumberOfSections           ;The number of sections used in this file
-      
-    ; Now for some symbols
-      
-    REPT    NumberOfSymbols            ;NumberOfSymbols symboldefs follow
-        STRING  Name                   ;The name of this symbol
-        BYTE    Type                   ;0 = LOCAL symbol only used in this file
-                                       ;1 = IMPORT this symbol from elsewhere
-                                       ;2 = EXPORT this symbol to other objects
-        IF      Type != 1
-            LONG    SectionID          ;The section number in which this symbol
-                                       ;is defined.  If -1 this symbol is an EQUate
-            LONG Value                 ;The symbols value. If SectionID!=-1 it's the
-                                       ;offset into that section
-        ENDC
-    ENDR
-      
-    ; And I'll be... Sections!
-      
-    REPT NumberOfSections
-        LONG    Size                   ;Size in bytes of this section
-        BYTE    Type                   ;0 = BSS
-                                       ;1 = VRAM
-                                       ;2 = CODE
-                                       ;3 = HOME
-                                       ;4 = HRAM
-        LONG    Org                    ;Only present in RGB1. Address to fix this
-                                       ;section at. -1 if the linker should
-                                       ;decide (normal operation)
-        LONG    Bank                   ;Only present in RGB1. Bank to load this
-                                       ;section into. -1 if the linker should
-                                       ;decide (normal operation). This field is
-                                       ;only valid for CODE sections.
-        IF      Type==CODE || Type==HOME
-            BYTE Data[Size]
-            LONG NumberOfPatches
-               
-            ; These types of sections may have patches
-               
-            REPT NumberOfPatches
-                STRING    SourceFile   ;The name of the sourcefile (for
-                                       ;printing an errormessage)
-                LONG Line              ;The line of the sourcefile
-                LONG Offset            ;Offset into the section where patch
-                                       ;should be applied
-                BYTE Type              ;0 = BYTE patch
-                                       ;1 = little endian WORD patch
-                                       ;2 = little endianLONG patch
-                                       ;3 = big endian WORD patch (RGB2 and later)
-                                       ;4 = big endianLONG patch (RGB2 and later)
-                LONG RPNSize
-                BYTE RPN[RPNSize]      ;RPN definition below
-            ENDR
-        ENDC
-    ENDR
-


Rpn Data

-

Expressions in the objectfile are stored as RPN. This is an expression of the form "2 5 +". This will first push -the value "2" to the stack. Then "5". The "+" operator pops two arguments from the stack, adds them, and then -pushes the result on the stack, effectively replacing the two top arguments with their sum. In the RGB format RPN -expression are stored as BYTEs with some bytes being special prefixes for integers and symbols.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RPN Expressions
Byte valueMeaning
$00+ operator
$01- operator
$02* operator
$03/ operator
$04% operator
$05unary -
$06| operator
$07& operator
$08^ operator
$09unary ~
$0A&& comparison
$0B|| comparison
$0Cunary !
$0D== comparison
$0E!= comparison
$0F> comparison
$10< comparison
$11>= comparison
$12<= comparison
$13<< operator
$14>> operator
$15BANK() function for Gameboy, a symbol ID follows
$16HRAMCheck for Gameboy, check if value is in HRAM and logically and it with 0xFF
$17ZeroPageCheck for PC-Engine, check if value is in ZP (0x2000-0x20FF) and logically and it with 0xFF
$18RangeCheck. LOW and HIGH signed LONGs follow. Checks a value to see if within the range [LOW;HIGH]. If not, generate an error. -
$80LONG integer follows
$81Symbol ID follows
-


-

Last updated 18 July 1997 by Carsten Sorensen

- - + + + RGB? Fileformat + + + +
+ + + + +

The RGB ObjectFileFormats

+
+

Table of Contents

+ +
+


Background

+

I developed the RGB0 fileformat mainly because I needed a suitable dataformat to hold the output from xAsm that was powerful to accomodate all the features I needed and also would make it easy for me to add +new ones. +The reason for documenting it is so people can write converters between it and other formats. Perhaps even develop other compilers for it?
+
+The RGB1 fileformat saw the light of day with the V1.02 of the old RGBDS release because of the addition of fixed sections.
+The RGB2 fileformat emerged because I needed to add support for big endian CPUs. +



FileStructure

+LONG is a 32-bit integer stored in little-endian format (Intel)
+BYTE is an 8-bit integer
+STRING is a 0 terminated string of BYTE
+
+Down to business...
+
+    ; There's a header...
+      
+    BYTE    ID[4]                      ;"RGB0", "RGB1", "RGB2"
+    LONG    NumberOfSymbols            ;The number of symbols used in this file
+    LONG    NumberOfSections           ;The number of sections used in this file
+      
+    ; Now for some symbols
+      
+    REPT    NumberOfSymbols            ;NumberOfSymbols symboldefs follow
+        STRING  Name                   ;The name of this symbol
+        BYTE    Type                   ;0 = LOCAL symbol only used in this file
+                                       ;1 = IMPORT this symbol from elsewhere
+                                       ;2 = EXPORT this symbol to other objects
+        IF      Type != 1
+            LONG    SectionID          ;The section number in which this symbol
+                                       ;is defined.  If -1 this symbol is an EQUate
+            LONG Value                 ;The symbols value. If SectionID!=-1 it's the
+                                       ;offset into that section
+        ENDC
+    ENDR
+      
+    ; And I'll be... Sections!
+      
+    REPT NumberOfSections
+        LONG    Size                   ;Size in bytes of this section
+        BYTE    Type                   ;0 = BSS
+                                       ;1 = VRAM
+                                       ;2 = CODE
+                                       ;3 = HOME
+                                       ;4 = HRAM
+        LONG    Org                    ;Only present in RGB1. Address to fix this
+                                       ;section at. -1 if the linker should
+                                       ;decide (normal operation)
+        LONG    Bank                   ;Only present in RGB1. Bank to load this
+                                       ;section into. -1 if the linker should
+                                       ;decide (normal operation). This field is
+                                       ;only valid for CODE sections.
+        IF      Type==CODE || Type==HOME
+            BYTE Data[Size]
+            LONG NumberOfPatches
+               
+            ; These types of sections may have patches
+               
+            REPT NumberOfPatches
+                STRING    SourceFile   ;The name of the sourcefile (for
+                                       ;printing an errormessage)
+                LONG Line              ;The line of the sourcefile
+                LONG Offset            ;Offset into the section where patch
+                                       ;should be applied
+                BYTE Type              ;0 = BYTE patch
+                                       ;1 = little endian WORD patch
+                                       ;2 = little endianLONG patch
+                                       ;3 = big endian WORD patch (RGB2 and later)
+                                       ;4 = big endianLONG patch (RGB2 and later)
+                LONG RPNSize
+                BYTE RPN[RPNSize]      ;RPN definition below
+            ENDR
+        ENDC
+    ENDR
+


Rpn Data

+

Expressions in the objectfile are stored as RPN. This is an expression of the form "2 5 +". This will first push +the value "2" to the stack. Then "5". The "+" operator pops two arguments from the stack, adds them, and then +pushes the result on the stack, effectively replacing the two top arguments with their sum. In the RGB format RPN +expression are stored as BYTEs with some bytes being special prefixes for integers and symbols.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RPN Expressions
Byte valueMeaning
$00+ operator
$01- operator
$02* operator
$03/ operator
$04% operator
$05unary -
$06| operator
$07& operator
$08^ operator
$09unary ~
$0A&& comparison
$0B|| comparison
$0Cunary !
$0D== comparison
$0E!= comparison
$0F> comparison
$10< comparison
$11>= comparison
$12<= comparison
$13<< operator
$14>> operator
$15BANK() function for Gameboy, a symbol ID follows
$16HRAMCheck for Gameboy, check if value is in HRAM and logically and it with 0xFF
$17ZeroPageCheck for PC-Engine, check if value is in ZP (0x2000-0x20FF) and logically and it with 0xFF
$18RangeCheck. LOW and HIGH signed LONGs follow. Checks a value to see if within the range [LOW;HIGH]. If not, generate an error. +
$80LONG integer follows
$81Symbol ID follows
+


+

Last updated 18 July 1997 by Carsten Sorensen

+ +