SNES master cycle viewer - Manual

Assembler

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.

Instruction syntax

AddressingSyntaxExample
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 pagedp
.b dp
LDA $00
LDA.b $00
Direct page Indexed, Xdp, X
.b dp, X
LDA $00, X
LDA.b $00, X
Direct page Indexed, Ydp, 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), YLDA ($00), Y
Direct page Indirect Long[dp]LDA [$00]
Direct page Indirect Long Indexed, Y[dp], YLDA [$00], Y
Absoluteabs
.w abs
LDA $0000
LDA.w $0000
Absolute Indexed, Xabs, X
.w abs, X
LDA $0000, X
LDA.w $0000, X
Absolute Indexed, Yabs, 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 Longlong
.l long
LDA $000000
LDA.l $000000
Absolute Long Indexed, Xlong, X
.l long
LDA $000000, X
LDA.l $000000, X
RelativerelBEQ Label
Relative LongrlongBRL Label
Stack Relativesr, SLDA $00, S
Stack Relative Indirect Indexed, Y(sr, S), YLDA ($00, S), Y
Block Movesrc, dstMVP $00, $01

Directive

NameSyntaxExample
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

Label

NameSyntaxExample
Global labelLabel:Label:
Local label.LabelLabel:
.Local
Unnamed label (Forward)+BRA +
+ NOP
Unnamed label (Backward)-- NOP
BRA -

Define

NameSyntaxExample
DefineName = ValueCounter = $13
INC Counter    ; E6 13
Local define.Name = ValueLabel:
.Temporary = $0A
STA .Temporary ; 85 0A

Comment

NameSyntaxExample
Single line; ...
// ...
; comment
// comment

Expression

Operators are evaluated left to right with no associative order.

NameSyntaxExample
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

Emulation

I/O Registers

RegisterAddressAccessNote
M7A$211BWritefor PPU multiplication
M7B$211CWritefor PPU multiplication
MPYL$2134Read
MPYM$2135Read
MPYB$2136Read
WRMPYA$4202Write
WRMPYB$4203Write
WRDIVL$4204Write
WRDIVH$4205Write
WRDIVB$4206Write
MEMSEL$420DWrite
RDMPYL$4216Read
RDMPYH$4217Read
DMA parameters$43nXRead/Writefor fast RAM

Note

Does not emulate DRAM refresh to account for worst case cycle calculations.

Sample

Initialized memory

Set the address of the RAM with the .org directive to give an initial value.

Block move

Manual FastROM change

Either change the start address or jump to the FastROM area.

DMA registers as fast RAM

5A22 MPY, DIV and PPU MPY

Definition using local labels

Local labels and local definitions within definitions are referenced from the defined scope.

Heatmap not mapped to source code

The heatmap does not show line numbers for dynamic code in RAM.

Execute openbus

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