Skip to content

adamsmasher/snap

Repository files navigation

snap (Super Nintendo Assembling Program) is a multi-pass 65816 assembler.

snap is GPL'd software.
If you want to change it or improve it, please do so for everyone. Thanks!

USAGE:
snap [-s <sym-file>] <in-file> <out-file>

(<sym-file> is where the assembler will dump its symbol table in the end.
 This way you can easily determine what address a procedure is located at,
 so you can add breakpoints or whatever)

Syntax generally follows that laid out in the WDC 65816 docs and datasheets.

COMPILING:
 run make. copy/install snap to your bin directory if that makes you happy.

TODO:
-absolute modifiers
-more math/expression parsing - right now snap only supports + and -
-a bunch more directives
-more features for the existing directives
-riddled with bugs I am sure

WHAT'S DONE:
-all instructions/addressing modes
-very very basic math/expression parsing
-multipass optimization
-memmap output - very handy!

It's very important that when you modify D or DBR you pass this
info to the assember so that it resolves labels correctly.

LDA #$80
PHA
PLD
SETDBR #$80

LDA #$0800
TCD
SETD #$0800

; comments look like this

LabelsLookLikeThis:
  JMP LabelsLookLikeThis
.localLabelsLookLikeThis:
  beq .localLabelsLookLikeThis

LabelsCanGoOnTheSameLine: bra LabelsCanGoOnTheSameLine

DefinesLookLikeThis: equ $20

LDA #DefinesLookLikeThis
STA DefinesLookLikeThis

INCSRC "defines.asm"
INCBIN "binarydata.bin"

ORG $8000 ; doesn't actually write any data, just changes the current PC

; the usual 65816 stuff
XCE
CLC
lda #$12       ; case insensitivity
sta $2100
LdA #%10010100 ; case insensitivity!
STA $00
STA $20+5     ; maths!
STA $20-5
LONGA ON
LONGA OFF
LONGI ON
LONGI OFF ; these don't actually emit the necessary REP/SEP ops - they're for
          ; the assembler only

PAD $FFC0 ; writes 0s until PC = operand

ASCII "GAME TITLE"
PAD $FFD5
DB $20
PAD $FFFC
DW Start

MultiByteDefine1:
DB 0,1,2,3,4,5,6
MultiByteDefine2: DW 1,2,3,4,5,6

About

a snappy super nintendo assembler program

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published