Difference between revisions of "SNASM68K"
From Sega Retro
m |
(Spiny Norman (https://montypython.fandom.com/wiki/Spiny_Norman) the giant hedgehog from Monty Python's Flying Circus (https://en.wikipedia.org/wiki/Monty Python's Flying Circus ; https://www.youtube.com/watch?v=C-FDW1shmqA) .) |
||
Line 1: | Line 1: | ||
{{rewrite|remove first-person writing, consolidate focus, correct formatting, and others.}} | {{rewrite|remove first-person writing, consolidate focus, correct formatting, and others.}} | ||
[[File:SNASM68K Console Interface.jpg|thumb|right|320px]] | [[File:SNASM68K Console Interface.jpg|thumb|right|320px]] | ||
− | '''SNASM68K''' ( | + | '''SNASM68K''' (Spiny Norman's Assembler 68K{{intref|Interview: Realtime Games Software (1989-08-12) by ST NEWS Disk Magazine}}) is a command-line assembler for the [[68000|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 [[wikipedia:GNU Assembler|GNU Assembler]] code or [https://segaretro.org/Sierra_68000_C_Compiler Sierra C]. |
==Usage== | ==Usage== |
Latest revision as of 04:17, 8 June 2024
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 (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.
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.
- 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
SNASM68K is a follow-up to the original SNasm, an assembler created by Martin Day[3] (a.k.a Spiny Norman) of SN Systems. Cross Products' developers Ian Oliver and Andy Craven were reportedly co-developers on the system[4][5][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
This list is incomplete. The following list has been marked as incomplete. If you can, please complete it. |
- Flashback[9]
- Instruments of Chaos Starring Young Indiana Jones[10]
- The Lawnmower Man[11]
- Mega lo Mania (NTSC-J)[12]
- TNN Bass Tournament of Champions[13]
Photo gallery
Ian Oliver's prototype SNASM68K hardware built during development of M-1 Abrams Battle Tank.[14]
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.
References
- ↑ Interview: Realtime Games Software (1989-08-12) by ST NEWS Disk Magazine
- ↑ K Horowitz (2016). Playing at the Next Level: A History of American Sega Games
- ↑ The One, "June 1990" (UK; 1990-05-28), page 23
- ↑ The One, "May 1989" (UK; 1989-04-xx), page 28
- ↑ The One, "May 1990" (UK; 1990-04-xx), page 85
- ↑ The One, "May 1990" (UK; 1990-04-xx), page 86
- ↑ http://www.snsys.com:80/snsys.htm (Wayback Machine: 1997-07-09 12:39)
- ↑ K Horowitz (2016). Playing at the Next Level: A History of American Sega Games
- ↑ Explicitly states SNASM68K usage in its credits, thanking Cross Products
- ↑ Prototype debug text mentions SNASM68K usage
- ↑ An error string consists of JUMP TO SNASM
- ↑ Contains portions of help text from SNASM68K in otherwise unallocated ROM space
- ↑ Contains portions of help text from SnLink, an associated SMASK68K linking program, which mentions SNASM68K
- ↑ K Horowitz (2016). Playing at the Next Level: A History of American Sega Games