Difference between revisions of "SNASM68K"
From Sega Retro
m |
m (→Gallery: Fun fact (a boring fact actually)... Asagoth was a gunner on a M60A3 TTS (Tank Thermal Sight) battle tank while serving in the Portuguese army...) |
||
Line 219: | Line 219: | ||
SNASM68K Console Interface Back.jpg|SNASM68K Console Interface Back | SNASM68K Console Interface Back.jpg|SNASM68K Console Interface Back | ||
SNASM68K SCSI Bus.jpg|SNASM68K SCSI Bus | SNASM68K SCSI Bus.jpg|SNASM68K SCSI Bus | ||
+ | </gallery> | ||
+ | |||
+ | ==Physical scans== | ||
+ | <gallery> | ||
SNASM68K 68000 Cross Assembler System Manual.pdf|SNASM68K 68000 Cross Assembler System Manual - 8 August 1991 | SNASM68K 68000 Cross Assembler System Manual.pdf|SNASM68K 68000 Cross Assembler System Manual - 8 August 1991 | ||
SNASM68K Console and Z80 Notes.pdf|SNASM68K Console and Z80 Notes | SNASM68K Console and Z80 Notes.pdf|SNASM68K Console and Z80 Notes |
Revision as of 04:27, 15 November 2021
SNASM68K is a command-line assembler for the Motorola 68000 created by British programmer Ian Oliver of Realtime Games Software while working on M-1 Abrams Battle Tank, later mass produced by Cross Products. It can be used with either GNU Assembler code or Sierra C.
It was used as the assembler for a number of Sega Mega Drive games, including Flashback (which explicitly says so in its staff roll, thanking Cross Products). It may have also been used with:
- Instruments of Chaos Starring Young Indiana Jones (debug text in the prototype mentions SNASM)
- The Lawnmower Man (one of the error strings is JUMP TO SNASM)
- the Japanese build of Mega lo Mania (which contains parts of the SNASM68K help text in otherwise unallocated space in ROM)
- TNN Bass Tournament of Champions (has help text from an associated linker, SnLink, which mentions SNASM)
The SNASM68k is compatible with
Contents
Usage
Options
Options are preceded by either a dash (-) or a forward slash (/).
Switches
Option | Description |
---|---|
? | Show help text. A nice quick reference. |
b # | Set input buffer size to #. # is an integer between 1 and 64. If this option is not specified, 16 is assumed fo #. |
dmax # | Specify maximum data size for DS and DCB directives to #. # is an integer between 1 and 32. If this option is not specified, # is 16. |
ef file | Specify an external error file. The format for this file is completely unknown, and it doesn't seem to be necessary for our purposes anyway. |
err | List all error messages the assembler would use. This includes messages imported by ef. Note that the output will be huge, so you should redirect it to a file. |
errw | Same as above, but warn if no external error message for an error condition is available. |
errb | List all error messages that are built into the assembler. Ignore non-native messages for an error condition. |
emax # | Quit assembly after # nonfatal errors. # is a positive integer. If # = 0, assembly will not quit, no matter how many errors are encountered. Default is 30. |
hex # | Show # hex words in the listing file. # is an integer between 2 and 8. Default is 4. |
lnos | If set, print source line numbers in listing file. |
coff | Change endian-ness of COFF object file. Don't bother with it. |
d | Debug mode. Used for testing make scripts and such. No assembly is actually done. |
e s[=val]{;s[=val]}... | Equate symbol s to value val. I haven't messed around with this, but I assume that it's for macros. |
g | Write non-global symbols to object file. Applicable only if -l is set. |
i | Show an information window while assembling. Only compatible with pure 16-bit MSDOS. |
im | Import undefined symbols. Applicable only if -l is set. |
j path | Add path to the include file search list. |
k | Allow use of certain macro commands like IFEQ. |
l | Make a linkable output file. Don't bother with it. |
o opts | Use assembler options opts. See below. |
p | Make a flat binary output file. Required for use with emulators and final ROMs, omit for use with SNBUG68K debugger. |
q quirks | Use special features specified by quirks. |
s | Write s-record output. I have no clue. |
sdb | Include source debug info in the COFF file for source debugging with the SNBUG68K debugger. Not compatible with emulators. |
w | Write all equates to the listing file. |
Assembler options
These options follow the -o switch. They are succeeded by a + or -, to signify on or off, respectively. Here, we'll append the default status of the option, the one that is used if the option is not specified. Descriptions say what happens if the option is set.
Option | Description |
---|---|
bin- | Show the full binary output in the listing file. |
ae+ | Align word and longword data on even boundaries. |
an- | Allow alternate numeric formats. This means that you can add B, H, or D at the end of data to signify the base, rather than % or $ at the front. |
c- | Make labels case sensitive. |
d- | Descope local labels on EQU, EQUR, EQUS, and SET directives. |
l- | Set a new local label intro character. Takes a single character as a subargument - if this character is used, it counts as a +. Using l+ changes the intro character to a dot (.) rather than an @. |
lf- | Put conditioned source lines in the listing file. This means that if the assembler was directed to skip certain parts of code, they will still appear in the listing file. |
m- | Expand macro statements in the listing file. |
mc- | Print macro calls to the listing file. |
mj- |
Allow comma streams at the end of macro parameters. I've no clue. |
pic- | Give errors for position-dependent code. |
s- | Treat EQU symbols as labels. |
t- | Truncate bytes and words without issuing errors. I'm not sure what "truncate" means in this case. |
w+ | Show warning messages. |
ws- | Allow white space in operands. |
v- | Export all local symbols to map file. |
op- | Enable PC relative optimizations. Switch to PC relative addressing when absolute long addressing is used and the code allows such a switch. |
os- | Enable short branch optimizations. Backwards relative branches will use the short form if possible. |
ow- | Enable absolute word addressing optimizations. If absolute long addressing is specified, but the address will fit in a word, the shorter form is used. Optimization is not made if the size is specified. |
oz- | Enable zero displacement (offset-zero) optimizations. If an instruction uses the Indirect Addressing with Displacement addressing mode and the displacement is zero, the instruction will be assembled to Indirect Addressing mode. |
oaq- | Enable ADDQ optimizations. ADD instructions that can be coded as ADDQ instructions will be assembled as ADDQ instructions. |
osq- | Enable SUBQ optimizations. Like above. |
Quirks
Yes, quirks. That's what the help text calls 'em. They're the special features that the assembler takes. They tend to break compatibility with other assemblers, which is why they're all disabled by default. Syntax is exactly the same as the assembler options above.
Option | Description |
---|---|
fl- | Force function and predefined constants to lowercase. I have no idea. |
mp- | Make macro parameters lowercase if case insensitive. Again, no clue, though it would seem to essentially make the parameters case-sensitive. |
mc- | Allow \ as a continuation character on macro lines. |
or- | . I don't know why this would be necessary. Maybe for compatibility with other assemblers? |
sa- | Align with section boundaries. Sections aren't used on current disassemblies (unless Hivebrain used them in his Sonic 1 disassembly), so this isn't necessary... yet. |
sc- | Use SIERRA C SDB format. This is a complete mystery to me. |
Known issues
SNASM68K.EXE is a 16-bit MSDOS executable, which means:
- It's not compatible with 64 bit Windows (Microsoft dropped support for backwards compatibility with 16-bit programs), but seems to be fully usable with DOSBox
- Filenames are limited to 8.3 format (both files passed as arguments, and included in source using INCLUDE or INCBIN)
- The program has a 1024 character line buffer, and will either segfault or assemble garbage when attempting to read lines of code longer than this (watch your data sections)
Files
These are the arguments that come directly after the options. They specify files to use for various purposes.
The Source File
This, quite simply, is the source file to assemble.
The Object File
This is the assembly destination. It tells the assembler where to put the assembled object files, or binary if the -p option is set.
The Map File
I think this has something to do with debugging. I don't know if it's an input file or an output file, though.
The Listing File
If specified, this file will contain the offsets of every label and the assembled hex dump of every instruction, alongside the source listing. This is very useful for debugging, or hex hacking after you've assembled everything. Note that this file can be very large - when used on the Sonic 2 disassembly, the listing file is about 12 megabytes.
Gallery
Ian Oliver's Mega Drive hardware development board hand-built for the production of M-1 Abrams Battle Tank which eventually became the SNASM68K Console, sold by Cross Products
Physical scans
Downloads
![]() |
Download SNASM68K
File: SNASM68K.7z (116 kB) (info)
Current version: 2.02Ex |
Note: This program is not compatible with 64-bit systems.