----------------------------------------------------------------------
-* SNasm 65816 Assembler V1.1Beta, Copyright (c) 1992,93 Michael Dailly *-
----------------------------------------------------------------------
This Assembler was written off and on for just over two months, so
please forgive any errors or bugs you find in this version. I do however
wish to hear about them. Here are some "BASIC" instuctions for use. More
readable documentation will be written when the assembler is finished AND
when I find the time.
Also included is an upload program.
This upload will send and run binnary files to a magicom
All commands are suported
Addr mode comment
#expresion imm mode
expresion Zero page (if less then 256)
<expresion Zero page (force)
expresion Absolute value
|expresion Absolute value (force)
>expresion 24bit (must use a ">")
(expresion) Zero Page (if less than 256)
(<expresion) Zero Page (force)
(expresion) absolute (if >255)
(|expresion) absolute (force) jmp ($0101)
(|expresion) absolute (force) jmp ($01)
[$00] 24bit indirect (zero page)
0-9 Dec
$A-$F Hex
%0-%1 Bin
A-Z[A-Z0-9_][:] Label
@A-Z[A-Z0-9_][:] Local label
SNasm commands
----------------
;comment till end of line
Org <Expresion> NO forward ref allowed
End end of source file
DB <expresion>,"string",.... (1 byte)
DW <expresion>,<expresion>,.. (2 bytes)
DT <expresion>,<expresion>,.. (3 bytes)
DL <expresion>,<expresion>,.. (4 bytes)
DS <expresion> (skip ? bytes)
Label[:] equ <expresion>
Label[:] set <expresion> (can be redefined)
Label[:] rb <expresion>
Label[:] rw <expresion>
Label[:] rt <expresion>
Label[:] rl <expresion>
Label[:] set to current PC
@Label[:] Local labels, till next "Label[:]"
NOTE: this is NOT allowed
Label1: ; then on the next line
@Local1:
It Must be
Label2: nop ; or any other
@Local2: ; instruction
RsSet [Expresion] if no expresion, default is 0.
ie.
{
RsSet ; or
RsSet $200 ; set _Rs to $200
}
longA On/Off set Acc to 8 or 16 bit (on=16 bit)
longI On/Off set Index regs to 8 or 16 bit (on=16 bit)
(no code output)
ie.
{
rep #$20 ; A=16bit
lda #$0101 ; return in 16bit mode
rts
longA off ; assembler switches mode
lda #$01 ; continue in 8 bit mode.
}
Include "Path+FileName" include a file for assembly
Read "Path+FileName" includes on pass 1 only.
this is IDEAL for equate and macro
files, as pass 2 skips these anyway!
LIB "Path+FileName" include a Pre-assembled LIB file.
Used for Bulk equates that DONT
change. (Like hardware equates.)
IncBin "Path+FileName" Include a Binnary file (like graphics).
Rept <Number> Set repeat loop (Not nested yet)
Endr endloop
Message "Text",Expr,[...] Like a basic PRINT
Message 0 prints a 0
Message Lab prints value of label Lab
Message "Lab=",Lab prints "Lab="+value of Lab
Message "Lab=",Lab," more" etc... This is great for debuging.
Label MACRO Please NOTE!
| These are VERY basic just now
Basic Code NO labels, OR operands
| BASIC code insertion ONLY
ENDM Labels are allowed, but will be
throw up an error if the macro is used
twice. (redefined label)
If a BRANCH is required. use PC+? or PC-?
PATH "path" This sets a BASE PATH for all
includes,inbins,reads and lib commands
it is just prepended to the filename
so PATH "658:frame/" and READ "equ.i"
will give READ "658:frame/equ.i"
Build In Macros
---------------
A8Bit Writes a Sep #$20. And set A to 8 bit
I8Bit Writes a Sep #$10. And set I to 8 bit
AI8Bit Writes a Sep #$30. And set both to 8 bit
A8BitC Writes a Sep #$21. And set A to 8 bit
also SETS carry
A16Bit Writes a Rep #$20. And set A to 16 bit
I16Bit Writes a Rep #$10. And set I to 16 bit
AI16Bit Writes a Rep #$30. And set both to 16 bit
A16BitC Writes a Rep #$21. And set A to 16 bit
also CLEARS carry
SNasm Expresions
----------------
+ Add
- Subtract
* Xply
/ Div
Xor xor value
() sub calculation
SHL <count> Shift left
SHR <count> Shift right
$ Hex
% Bin
& And
AND And
! Or
OR Or
~ Not
NOT Not
[A-Z][A-Z0-9_] Label
@[A-Z][A-Z0-9_] Local Label
_RS current RS counter (not in just yet)
PC current address
(before current instruction has been assembled)
(ie "LAB1: jsr PC" just calls the label LAB1 )
some notes
----------
1) Rep and Sep automaticly set longA & LongI
2) The Pound sign (£) is not available for use.
( C= put the pound sign up at ASCII 160 something.
only 0..127 is suported )
3) ASL A and
ASL will give the same command. (the "A" is optional)
(same for INC,ASL,etc..)
4) The assembler is NOT case sensitive,
However case is held in quotes. ie. "Hello" and not "HELLO"
5) #expresion. If I or A is in 8 bit, and the expresion >255
The value is CLIPPED. (a warning is shown)
(expresion & $FF)
6) Rept loops are if fact fairly slow, so only use them if
really needed.
If they are used for table gen. then try and incbin
the result instead, and gen the table elsewhere.
SNasm command line
--------------------
<InputName > Base Source filename (ie "test.s")
<OutputName> Output filename (ie "ram:test.dat")
[ErrorFile] All errors are written to this file (optional)
-LIB this dumps the symbol table in a form that can be
used with the LIB command.
Thats about it. Please let me know of any problems or suggestions you
may have. I am always willing to try something new!
Hope its fast enough for you, it should be okay. I use it on an A500
and it's fairly fast, so it should be pritty nippy on a 1200 up.