SNASM68K

From Sega Retro

Rewrite.svg
This article needs to be rewritten to remove first-person writing, consolidate focus, correct formatting, and others..
This article needs to be rewritten to conform to a higher standard of article quality. After the article has been rewritten, you may remove this message. For help, see the How to Edit a Page article.
SNASM68K Console Interface.jpg

SNASM68K (Spiny Norman's Assembler 68K[1]) 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.

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.

  • Source: The source file is, quite simply, the source file to assemble.
  • Object: This is the assembly destination. It tells the assembler where to put the assembled object files, or binary if the -p option is set.
  • Map: This file's use is unknown but may relate to debugging. It is unknown whether it is an input or output file.
  • Listing: 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.

History

Ian Oliver's prototype SNASM68K hardware built during development of M-1 Abrams Battle Tank.[2]

SNASM68K is a follow-up to the original SNasm, an assembler created by Martin Day

A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: SELECT `cargo__issuenames`.`name` AS `issuename`,`cargo__issuenames`.`date` AS `date`,`cargo__issuenames`.`pdf` AS `pdf`,`cargo__magnames`.`name` AS `magname`,`cargo__magnames`.`country` AS `country` FROM `cargo__issuenames` LEFT OUTER JOIN `cargo__magnames` ON ((`cargo__issuenames`.`code`=`cargo__magnames`.`code`)) WHERE `cargo__issuenames`.`code`="one" and `cargo__issuenames`.`num`="21" ORDER BY `cargo__issuenames`.`name`,`cargo__issuenames`.`date`,`cargo__issuenames`.`pdf`,`cargo__magnames`.`name`,`cargo__magnames`.`country` LIMIT 1 Function: CargoSQLQuery::run Error: 1021 Disk full (/tmp/#sql-temptable-15e6a-e8db3-1a0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") (localhost)

[3] (a.k.a Spiny Norman) of SN Systems. Cross Products' developers Ian Oliver and Andy Craven were reportedly co-developers on the system

A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: SELECT `cargo__issuenames`.`name` AS `issuename`,`cargo__issuenames`.`date` AS `date`,`cargo__issuenames`.`pdf` AS `pdf`,`cargo__magnames`.`name` AS `magname`,`cargo__magnames`.`country` AS `country` FROM `cargo__issuenames` LEFT OUTER JOIN `cargo__magnames` ON ((`cargo__issuenames`.`code`=`cargo__magnames`.`code`)) WHERE `cargo__issuenames`.`code`="one" and `cargo__issuenames`.`num`="8" ORDER BY `cargo__issuenames`.`name`,`cargo__issuenames`.`date`,`cargo__issuenames`.`pdf`,`cargo__magnames`.`name`,`cargo__magnames`.`country` LIMIT 1 Function: CargoSQLQuery::run Error: 1021 Disk full (/tmp/#sql-temptable-15e6a-e8db3-1a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") (localhost)

[4]

A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: SELECT `cargo__issuenames`.`name` AS `issuename`,`cargo__issuenames`.`date` AS `date`,`cargo__issuenames`.`pdf` AS `pdf`,`cargo__magnames`.`name` AS `magname`,`cargo__magnames`.`country` AS `country` FROM `cargo__issuenames` LEFT OUTER JOIN `cargo__magnames` ON ((`cargo__issuenames`.`code`=`cargo__magnames`.`code`)) WHERE `cargo__issuenames`.`code`="one" and `cargo__issuenames`.`num`="20" ORDER BY `cargo__issuenames`.`name`,`cargo__issuenames`.`date`,`cargo__issuenames`.`pdf`,`cargo__magnames`.`name`,`cargo__magnames`.`country` LIMIT 1 Function: CargoSQLQuery::run Error: 1021 Disk full (/tmp/#sql-temptable-15e6a-e8db3-1a8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") (localhost)

[5]

A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Query: SELECT `cargo__issuenames`.`name` AS `issuename`,`cargo__issuenames`.`date` AS `date`,`cargo__issuenames`.`pdf` AS `pdf`,`cargo__magnames`.`name` AS `magname`,`cargo__magnames`.`country` AS `country` FROM `cargo__issuenames` LEFT OUTER JOIN `cargo__magnames` ON ((`cargo__issuenames`.`code`=`cargo__magnames`.`code`)) WHERE `cargo__issuenames`.`code`="one" and `cargo__issuenames`.`num`="20" ORDER BY `cargo__issuenames`.`name`,`cargo__issuenames`.`date`,`cargo__issuenames`.`pdf`,`cargo__magnames`.`name`,`cargo__magnames`.`country` LIMIT 1 Function: CargoSQLQuery::run Error: 1021 Disk full (/tmp/#sql-temptable-15e6a-e8db3-1ac.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") (localhost)

[6], with Cross acquiring an official license to the hardware.[7] Initially purchased for developing software for Atari ST and Amiga computers, Oliver's development studio Realtime Games Software soon found themselves contracted by Sega of America to produce M-1 Abrams Battle Tank for the early Genesis market.

The programmer initially found himself struggling to fit the original game's larger C language code into the limited cartridge size and RAM of the Genesis. To address this, he created SNASM68K, a prototype command-line assembler inspired by the original SNasm which automatically translated the code for use with Sega's 16-bit home system[8], greatly reducing the difficulty in porting games to the Genesis. Reportedly, while SNasm required some modifications made in order to use with Genesis games, Sega's new home system was relatively similar to the Atari ST home computer (save for a lack of RAM for screen buffering) - something which Oliver was already familiar with. M-1 Abrams Battle Tank would eventually be released in 1991, and despite unimpressive sales, Sega of America was pleased with the studio's work.

List of developed games

px
This list is incomplete.
The following list has been marked as incomplete. If you can, please complete it.

Photo gallery

Physical scans

Downloads

Download.svg Download SNASM68K
File: SNASM68K.7z (116 kB) (info)
Current version: 2.02Ex

Note: This program is not compatible with 64-bit systems.

References

  1. Interview: Realtime Games Software (1989-08-12) by ST NEWS Disk Magazine
  2. K Horowitz (2016). Playing at the Next Level: A History of American Sega Games
  3. ', "" (; ), page 23
  4. ', "" (; ), page 28
  5. ', "" (; ), page 85
  6. ', "" (; ), page 86
  7. http://www.snsys.com:80/snsys.htm (Wayback Machine: 1997-07-09 12:39)
  8. K Horowitz (2016). Playing at the Next Level: A History of American Sega Games
  9. Explicitly states SNASM68K usage in its credits, thanking Cross Products
  10. Prototype debug text mentions SNASM68K usage
  11. An error string consists of JUMP TO SNASM
  12. Contains portions of help text from SNASM68K in otherwise unallocated ROM space
  13. Contains portions of help text from SnLink, an associated SMASK68K linking program, which mentions SNASM68K
  14. K Horowitz (2016). Playing at the Next Level: A History of American Sega Games