diff --git a/doc/asm.htm b/doc/asm.htm index 8d63d604..735dc01e 100644 --- a/doc/asm.htm +++ b/doc/asm.htm @@ -42,7 +42,7 @@
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.
+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 WRAM0/WRAMX/HRAM/VRAM/SRAM section.
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 allocates a number of bytes. The content is undefined. This is the preferred method of allocationg space in a RAM section. You can however also use DB and DW without any arguments.
DS str_SIZEOF ;allocate str_SIZEOF bytes
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+
SECTION "CoolStuff",ROMX
This switches to the section called "CoolStuff" (or creates it if it doesn't already exits) and it defines it as a code section. All sections within a sourcefile must be identified by a unique name.
-| Name | -Function | -
|---|---|
| CODE | -A code section. The linker decides where to put this. For the Gameboy it also decides which bank to put it in except #0 (the HOME bank). | -
| DATA | -Really just a synonym for CODE. | -
| BSS | -This section is for variables. For the Gameboy it will be placed where the Gameboy RAM is. | -
| HOME | -Gameboy ONLY: A code section that will be placed in Gameboy bank #0. | -
| VRAM | -Gameboy ONLY: This section is for allocating VRAM and will be placed where the Gameboy VRAM is. | -
| HRAM | -Gameboy ONLY: This section is for allocating variables in the high RAM area ($FF80-$FFFE) and will be placed there. Suggested by Jens Ch. Restemeier. NOTE WELL: if you use this method of allocating HRAM the assembler will NOT choose the short addressingmode in the LD instruction because the actual address calculation is done by the linker! If you find this undesirable you can use RSSET/RB/RW instead or use the LDIO mnemonic. The address calculation is then done by the assembler. | -
Possible section types are as follows: + +
The following deprecated section names are aliases for some of the above sections: + +
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]+
SECTION "CoolStuff",ROM0[$1234]+
This will force the section to address $1234. This also works with the other sectiontypes. For ROMX 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",ROMX[$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]+
SECTION "CoolStuff",ROMX,BANK[7]
HINT: If you think this is a lot of typing for doing a simple ORG type thing you can quite easily write an intelligent macro (called ORG for example) that uses \@ for the sectionname and determines correct sectiontype etc as arguments for SECTION
Last updated 18 July 1997 by Carsten Sorensen
+Last updated 18 July 1997 by Carsten Sorensen
diff --git a/doc/link.htm b/doc/link.htm index 721263df..3f4d74d0 100644 --- a/doc/link.htm +++ b/doc/link.htm @@ -104,27 +104,14 @@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.
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. +
Sections created with ROM0 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. ROMX 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.
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. +
Small mode forces all ROMX sections to be of type ROM0 and increases the ROM0 section size from 16kB to 32kB. This also means that ROM0/ROMX sections are written to the final image in the order you have specified on the command line.
Currently the linker doesn't calculate the GB checksums. You must use RGBFix to do this. -
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