The 6502 Assembler included in-game within Hacker's Edge is a bit different than other 6502 Assemblers roaming the Internet. The 6502 Assembler in Hacker's Edge supports relocatable code and other features and directives not found in other popular 6502 Assemblers.
Your program should always end with a BRK operation, which will call the kernel routine to return you back to your shell program. Although BRK is $00 in memory, you can never be sure that the area where your program loaded into was filled with $00 before your code was loaded in. Without a BRK, your program will continue to run operations past your program's end point in memory and may cause some unexpected behavior!
Anything that begins with a period is classified as an assembler directive, here is a list of the publicly available ones at the moment:
|.DATA||.DATA||Ends the code segment and begins the data segment.|
|.OUT||.OUT KERNEL.SYS||Enforces the name of the output binary image.|
|.TYP||.TYP RAW||Specifies a binary type to generate, currently only RAW is supported, if left out, it uses the default relocatable type.|
Labels come in two different types, relative ones used in branching statement, and ones which support relocation. Relocating labels cannot be used when pointing to a value in your data segment, relocating @ labels can only be used with JSR and JMP operations. However, you can create these labels anywhere in your code segment and use LDA #>@label or #<@label to refer to the high and low bytes of the pointing address respectively.
Inserting RAW data
Inserting RAW data into your binary is required for your data segment, or if you are creating a custom binary type. Here are the statements you can use to insert RAW data bytes and words into your output binary.
|DCB||DCB $40,$50,$8c,$00||Inserts RAW bytes into your output binary.|
|DCW||DCW $a350,@label||Inserts RAW 16-bit words into your output binary, supports absolute labels.|
|DCS||DCS Hello World!\n\0||Inserts a string along with newlines and/or nulls into your output binary.|