Note
It is a simple assembler and does not have advanced functions.
Since strict addressing optimization is not performed, please add a length specification as necessary.
It is a simple assembler and does not have advanced functions.
Since strict addressing optimization is not performed, please add a length specification as necessary.
Addressing | Syntax | Example |
---|---|---|
Implied | (none) | NOP |
Accumulator | (none) A | ASL ASL A |
Stack | (none) | RTS |
Immediate | #imm .b #imm .w #imm | LDA #$00 LDA.b #$01 LDA.w #$01 |
Direct page | dp .b dp | LDA $00 LDA.b $00 |
Direct page Indexed, X | dp, X .b dp, X | LDA $00, X LDA.b $00, X |
Direct page Indexed, Y | dp, Y .b dp, Y | LDA $00, Y LDA.b $00, Y |
Direct page Indirect | (dp) | LDA ($00) |
Direct page Indexed Indirect, X | (dp, X) | LDA ($00, X) |
Direct page Indirect Indexed, Y | (dp), Y | LDA ($00), Y |
Direct page Indirect Long | [dp] | LDA [$00] |
Direct page Indirect Long Indexed, Y | [dp], Y | LDA [$00], Y |
Absolute | abs .w abs | LDA $0000 LDA.w $0000 |
Absolute Indexed, X | abs, X .w abs, X | LDA $0000, X LDA.w $0000, X |
Absolute Indexed, Y | abs, Y .w abs, Y | LDA $0000, Y LDA.w $0000, Y |
Absolute Indirect | (abs) | JMP ($0123) |
Absolute Indexed Indirect | (abs, X) | JMP ($0123, X) |
Absolute Indirect Long | [abs] | JMP [$0123] |
Absolute Long | long .l long | LDA $000000 LDA.l $000000 |
Absolute Long Indexed, X | long, X .l long | LDA $000000, X LDA.l $000000, X |
Relative | rel | BEQ Label |
Relative Long | rlong | BRL Label |
Stack Relative | sr, S | LDA $00, S |
Stack Relative Indirect Indexed, Y | (sr, S), Y | LDA ($00, S), Y |
Block Move | src, dst | MVP $00, $01 |
Name | Syntax | Example |
---|---|---|
Origin | .org address | .org $008000 |
Byte array | .db value, value, value, ... | .db $00, 1, "ABC", Label |
Word array | .dw value, value, value, ... | .dw $00, 1, "ABC", Label |
Long array | .dl value, value, value, ... | .dl $00, 1, "ABC", Label |
Dword array | .dd value, value, value, ... | .dd $00, 1, "ABC", Label |
Memory short | .m8 | .m8 LDA #0 ; A9 00 |
Memory long | .m16 | .m16 LDA #0 ; A9 00 00 |
Index short | .i8 | .i8 LDX #0 ; A2 00 |
Index long | .i16 | .i16 LDX #0 ; A2 00 00 |
Direct pointer value | .dp value | .org $008000 .dp $0123 LDA $0124 ; A5 01 |
Name | Syntax | Example |
---|---|---|
Global label | Label: | Label: |
Local label | .Label | Label: .Local |
Unnamed label (Forward) | + | BRA + + NOP |
Unnamed label (Backward) | - | - NOP BRA - |
Name | Syntax | Example |
---|---|---|
Define | Name = Value | Counter = $13 INC Counter ; E6 13 |
Local define | .Name = Value | Label: .Temporary = $0A STA .Temporary ; 85 0A |
Name | Syntax | Example |
---|---|---|
Single line | ; ... // ... | ; comment // comment |
Operators are evaluated left to right with no associative order.
Name | Syntax | Example |
---|---|---|
Addition | + | LDA.b #$12+3 ; A9 15 |
Subtraction | - | LDA.b #$12-3 ; A9 0F |
Multiplication | * | LDA.b #$12*3 ; A9 36 |
Division | / | LDA.b #$12/3 ; A9 06 |
Modulo | % | LDA.b #$12%3 ; A9 00 |
Logical shift left | << | LDA.b #$12<<3 ; A9 90 |
Logical shift right | >> | LDA.b #$12>>3 ; A9 02 |
Bitwise AND | & | LDA.b #$12&3 ; A9 02 |
Bitwise OR | | | LDA.b #$12|3 ; A9 13 |
Bitwise XOR | ^ | LDA.b #$12^3 ; A9 11 |
Negative | - | LDA.b #-$12 ; A9 EE |
Register | Address | Access | Note |
---|---|---|---|
M7A | $211B | Write | for PPU multiplication |
M7B | $211C | Write | for PPU multiplication |
MPYL | $2134 | Read | |
MPYM | $2135 | Read | |
MPYB | $2136 | Read | |
WRMPYA | $4202 | Write | |
WRMPYB | $4203 | Write | |
WRDIVL | $4204 | Write | |
WRDIVH | $4205 | Write | |
WRDIVB | $4206 | Write | |
MEMSEL | $420D | Write | |
RDMPYL | $4216 | Read | |
RDMPYH | $4217 | Read | |
DMA parameters | $43nX | Read/Write | for fast RAM |
Does not emulate DRAM refresh to account for worst case cycle calculations.
Set the address of the RAM with the .org directive to give an initial value.
Either change the start address or jump to the FastROM area.
Local labels and local definitions within definitions are referenced from the defined scope.
The heatmap does not show line numbers for dynamic code in RAM.
$00-3F,80-BF:2000-5FFF with no I/O registers, LoROM maps $00-3F,80-BF:6000-7FFF and HiROM maps $00-0F,80-8F:6000-7FFF as open buses.