Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
  You are not logged in - nap
SNasm 1.7.1   [2007]

SNasm 1.7.1 Released by :
Indi

Release Date :
30 November 2007

Type :
Other Platform C64 Tool

User rating:awaiting 8 votes (8 left)

Credits :
Code .... Indi

Download :

Look for downloads on external sites:
 Pokefinder.org


Summary
Submitted by Scout on 29 November 2007
SNasm V1.7.1 - 6502 assembler
© Copyright Michael Dailly, 2002-2007. All rights reserved.

I can be reached at:-
http://dailly.blogspot.com/



SNasm is a simple assembler written in a couple of weeks, so please forgive any niggles that still remain. While simple, it is however a fully featured assembler with full macro support.

This assembler was written for my Commodore Plus/4 remote development kit, but is also a stand alone 6502 assembler.




THIS ASSEMBLER IS TOTALY FREE AND CAN BE USED BY ANYONE FOR ANYTHING. BEING FREE, I ACCEPT NO RESPONSIBILITY FOR ANY PROBLEMS RESULTING IN THE USE OF THIS PROGRAM. IF YOU ARE GOING TO INCLUDE IT IN ANOTHER PACKAGE, YOU ARE STILL FREE TO DO SO, BUT PLEASE LET ME KNOW.



Command Line:
SNasm [options] <inputname> <outputname>
-sym Dumps the symbol table in Minus4w format
-vice Dumps the symbol table in VICE format
-map Start of a symbolic DUMP, not much use just now.
-commay Disables ZeroPage,y warnings


Numerical
0 - 9 Decimal
$A-$F Hex
%0-%1 Binary
A-Z[A-Z0-9_][:] Label
@A-Z[A-Z0-9_][:] Local Label
!A-Z[A-Z0-9_][:] Local Label



Addressing Modes
#expression Immediate mode
expression Zeropage is <256
expression Absolute if >=256
expression,x Zeropage+X if <256
expression,x Absolute +X if >=256
expression,y Zeropage+Y if <256
expression,y Absolute +Y if >=256
(expression) Indirect
(expression),y Zero page indirect +Y
(expression,x) Zero page indirect +X
[$00] Direct Page (65816)
[$00],y Direct Page+Y (65816)
>expression 24 bit LONG (65816)
>expression,x 24 bit LONG+X (65816)
(expression,x) Absolute+X (65816, 65c02)
expression,s Stack relative (65816)
(expression,s),y Indirect stack relative + Y (65816)
expression,expression Block transfer only (65816, 65c02)


Assembler Directives:
; Comment till end of line

ORG <Expression> No forward referencing allowed. (Pads - see notes)
PCORG <Expression> No forward referencing allowed. (Does NOT pad, sets PC only)
END end of source file.

DB <expression>,”String”,….
DW <expression>, <expression>
DS <expression> reserve space

Label[:] equ <expression> equate label to value
Label[:]= <expression> equate label to value
Label[:] set <expression> can be redefined
Label[:] rb <expression> reserve byte (structures)
Label[:] rw <expression> reserve word (structures)
Label[:] Set to current PC
@Label[:] Local labels. Set to current PC,
Valid until next “Label[:]”
(also !Label[:])

RSRESET sets to 0 (structures)
RSSET [Expression] if no expression, defaults to 0 (structures)
INCLUDE <Drive:\Path\FileName> include a file for assembly
INCBIN <Drive:\Path\FileName> include a raw binary file

MESSAGE “Text”,Expression,[…] Like a BASIC print statement (pass2 only)
MESSAGE 0 Prints 0
MESSAGE “L1:”,L1,” L2: “,L2 Print L1: [Label] L2: [Label]

Label[:] MACRO define a macro
ENDM end of macro definition
\0..\9,\a..\f 16 macro paramaters (eg. "lda #\0" or "\1 #$00" )
IF,IFDEF,IFNDEF,ELSE,ENDIF Conditional compilation
LONGA <on/off> Turn 16 accumulator register on/off in 65816 mode.
LONGI <on/off> Turn 16 bit index register on/off in 65816 mode.


OPT compiler options (eg. “opt prg”)
Prg outputs a 2 byte .PRG file header at the start of the output file.
Plus4=StartAddress outputs a basic command to exe a start address (for the Plus/4)
C64=StartAddress outputs a basic command to exe a start address (for the C64)
Illegal Enable undocumented opcodes (dcm, ins, lax, xaa)
A65c02 Enable 65c02 opcodes
A65816 Enable 65816 opcodes + 16bit registers & 24bit address space
SNasm Expressions
+ Add
- Subtract
* Multiply
/ Divide
^ XOR
XOR XOR value
( ) Sub-calculation
<< Shift Left
>> 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
![_A-Z][A-Z0-9] Local Label
RS Current RS counter
PC Current SNASM program counter.
* Current SNASM program counter.
LO( ) Low byte (<256) of value
HI( ) High byte (>256) of value




Notes
1) #<expression> If the value is >255 then the value is cropped ( AND 255 )
2) The Assembler is not case sensitive. Strings will maintain all case however.
3) “ASL A” and “ASL” will give the same result. The “A” is optional.
4) Macro paramaters can be used to construct labels, and even commands.
Testmacro macro
label\3: \0\1 \2
dw label\3
endm

Testmacro ld,x,#$55,index
Which gives:-
labelindex: ldx #$55

5) SNasm will not save out a file if there are ERRORS. But will do so if there are only WARNINGS.
6) A source file with ORG $100 and then ORG $200 will output 256 bytes, since changing ORG pad's to the address.
7) If you wish to assemble a section of code to copy into place then use PCORG to set the new address then PCORG to reset to the correct PC. i.e,

ORG $2000 ; main address
ldx #$00 ; Code before relocation chunk
CurrPC:
PCORG $300 ; relocate PC
lda #$00 ; relocatable code here
EndPC: ; label to work out SIZE of relocatable chunk
PCORG CurrPC+(EndPC-$300) ; Move PC back to correct address
nop ; carry on with code




Known Bugs

1) Nested if/else/endif statements don’t seem to work. (Inside macros at in case)
Whats Next?
1) Bug fixes, fix any that appear.
2) Source level debugging information. Symbols, Addresses, line numbers, file names etc. allowing for source level debugging.
3) File Listing. Standard output file listing.
4) Conditional assembly, with command-line symbol defines allowing for library source files.
5) DO/WHILE construction for building tables etc.
6) FILE commands for including and getting size of things.
7) Any requests that need to be added.



For any comments, requests, bugs etc. please feel free to drop me a line at one of the above e-mail addresses.





History

V1.0 - 2002 - First release

V1.1 – 2005
Fixed include bug (EOF not reset correctly)
Added incbin - should have been there already... lost?

V1.2 – 2005
Added PDS style "HEX" command
Added "if", "ifdef", "ifndef", "else" and "elseif"
local labels can now start with "@" or "!"
local labels are now allowed inside macros
added "opt" command with "prg"

V1.3 – 2005
Fixed "PCORG".
Added opt "plus4" and "c64".
Added -sym command line option to dump symbol table

V1.4 – 2006
Added INCPRG to allow including of PRG files (ignores header)
Fixed "Warning" error/crash.

V1.5 – 2006
Added LAX instruction (load A and X)
Added INS instruction
Added DCM instruction

V1.6 – 2006
Added VICE symbol table support to output
Fixed crash in warning system
Fixed STA ZeroPage,y compile error (now gives a warning and does sta $0000,y)
Fixed ALL zeropage,y problems... only stx and ldx are now allowed.
Now saves output if there are warnings, but no errors.
"opt C64=add" added.

V1.6.1 – 2006
Quick fix for crash when include file not found.

V1.6.2 – 2006
Command line crash. (no output file given)
Command line crash. (no source file given)

V1.6.3 – 2007
Added a list symbol option
Some undocumented ops added (opt Illegal)

V1.7.0 – Nov 2007
Changed symbol list to MAP
Added 65816 support (16bit) (opt A65816) – incomplete
Added 65c02 support (8bit) (opt A65c02) – incomplete
Now allows multiple symbol format outputs at once (Minus4, vice, MAP etc.)

V1.7.1 – Nov 2007
FULL 65816 support now available.
Fixed “LAX $00,y” command (allowing zeropage,y)
Fixed “JMP ($1234)” command
Fixed SEP and REP commands.
SEP and REP now automatically switch on/off LONGA and LONGI
















SNASM is (c) Copyright Michael Dailly, 2002-2006. All rights reserved.
Search CSDb
Advanced
Navigate
Prev - Random - Next
Detailed Info
· Summaries (1)
· User Comments
· Production Notes
Fun Stuff
· Goofs
· Hidden Parts
· Trivia
Forum
· Discuss this release
Support CSDb
Help keep CSDb running:



Funding status:




About this site:
CSDb (Commodore 64 Scene Database) is a website which goal is to gather as much information and material about the scene around the commodore 64 computer - the worlds most popular home computer throughout time. Here you can find almost anything which was ever made for the commodore 64, and more is being added every day. As this website is scene related, you can mostly find demos, music and graphics made by the people who made the scene (the sceners), but you can also find a lot of the old classic games here. Try out the search box in the top right corner, or check out the CSDb main page for the latest additions.
Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.142 sec.