TAsm

An Amiga to Snes cross-assembler.

TAsm is a utility to create programs for the Snes using an Amiga and a Copier Dev Kit.

Normally the file produced by TAsm would be sent to a Super WildCard device that sits on top of a Snes (Super Famicom/Nintendo).

Download the Amiga executable here.

Source code (use DEVPAC):
tasm.s.

Tasm is only compatible with Kickstart/Workbench 2.04+ and a 68020+, this (normally) rules out A500's and A2000's... You should be okay on a A3000, A1200, or a A4000!!! Tasm has been tested to work on a A4000/30, I do not know about 68040 compatibility - but it should work! There will never be a version for the older machines, so don't hold your breath!!!

For an Amiga to Super WildCard cable, get an assembled RS232 DB 25 M/M and switch the wires from pin 1 to 13 on one end. You will have to connect the modified end to the Amiga and the unmodified end to the Super WildCard.

Tasm is also semi-source compatible with Fasm by Mr.Madness!

An n-pass assembler:

Tasm is an "n"-pass assembler, this means that it will take, if necessary, any amount of passes to solve an assembly. Seeing as this could be a "pain" sometimes, the maximum amount of passes has been set to about 20. Having this type of assembly is quite useful, as it will assemble in one or two passes if possible (like a conventional assembler), it will also assemble some code that a normal assembler would normally chuck out!

eg.
Label1 EQU Label2+1 a one pass assembler fails here!
Label2 EQU Label3+1 a two pass assembler fails here!
Label3 EQU Label4+1
Label4 EQU Label5+1
Label5 EQU 10 no problem for tasm!!!

Unused rom space:

Unused rom space is filled with the byte $ff. Just like a real cart!

Complex expression evaluator:

Tasm has a complex expression evaluator - this was one of the major faults with Fasm and one of the main reasons why Tasm was written. For more information see the notes on "Numbers, constants & labels".

Help:

For general help, type "TASM ?" [return]

To assemble:

To assemble type "TASM S sourcename" [return]

This will assemble the source file, the object name by default will be sourcename.SMC, if you want a different name add to the line...
"O objectname"

If you have CygnusEd (a great editor), then (after loading your source into CygnusEd) type...
"TASM C objectname" [return]
(This will take the source code from CygnusEd's memory rather than disk)

Keywords:

Keywords can only be used BEFORE any code, the last of any keyword is the final one. Keywords are processed in the preassemble section of the assembly process.

BEST Performs: CASE ON, SNES ON, S700 ON, SMC ON and NES ON
SIZE number Size of object in 32k banks (1) Actual size is 512 bytes larger.
EMUL number Emulation number for header (0)
CASE ON/OFF Case sensitivity (off)
SNES ON/OFF Snes constants (off)
S700 ON/OFF S700 constants (off)
SMC ON/OFF SMC constants (off)
NES ON/OFF Nes constants (off)
LABELS number Number of labels (20000)
TITLE text Title of the program (blank)
MODE number Cartridge mode ($20)
TYPE number Cartridge type (0)
ROMSIZE number Size of rom N - 8x2^N (from size)
RAMSIZE number Size of ram N - 8x2^N (0)
COUNTRY number Destination country (0)
MAKER number Product maker (0)
VERSION number Current version of program (0)
VECTORS numbers (6) Jump vector table for $fff4 onwards (Cop, Brk, Abort, Nmi, Reset, & Irq)

Directives:

Directives can be used anywhere in the code. They are NOT 65816 or S700 commands, rather they are commands to control the assembly process or to insert data into code.

label EQU number Sets the label to the num.
label = number ===== "" =====
RSRESET Reset the RS pc.
RSSET number Set the RS to a particular value.
label RS.B size Sets the label to RS, adds 1 x size.
label RB size ===== "" =====
label RS.W size Sets the label to RS, adds 2 x size.
label RW size ===== "" =====
label RS.T size Sets the label to RS, adds 3 x size.
label RT size ===== "" =====
label RS.L size Sets the label to RS, adds 4 x size.
label RL size ===== "" =====
ORG number Sets the PC to num.
PC= number ===== "" =====
*= number ===== "" =====
DS.B size Adds 1 x size. to PC. Data is -1
DSB size ===== "" =====
DS.W size Adds 2 x size. to PC. Data is -1
DSW size ===== "" =====
DS.T size Adds 3 x size. to PC. Data is -1
DST size ===== "" =====
DS.L size Adds 4 x size. to PC. Data is -1
DSL size ===== "" =====
DCB.B size,number Adds 1 x size. to PC. Data is num.
BLK.B size,number ===== "" =====
DCB.W size,number Adds 2 x size. to PC. Data is num.
BLK.W size,number ===== "" =====
DCB.T size,number Adds 3 x size. to PC. Data is num.
BLK.T size,number ===== "" =====
DCB.L size,number Adds 4 x size. to PC. Data is num.
BLK.L size,number ===== "" =====
DC.B number(s),... Inserts the data byte(s) into code.
DB number ===== "" =====
DC.W number(s),... Inserts the data word(s) into code.
DW number ===== "" =====
DC.T number(s),... Inserts the data tword(s) into code.
DT number ===== "" =====
DC.L number(s),... Inserts the data long(s) into code.
DL number ===== "" =====
INCBIN filename Includes the file image in the object code.
EMULATE Inserts code to place SNES in emulate mode.
NATIVE Inserts code to place SNES in native mode.
ACCU 8|16 Tells tasm what size the accumulator is.
INDEX 8|16 Tells tasm what size the index registers are.
INIT Inserts standard init code for the SNES.

Numbers, constants & labels:

Numbers starting with A-Z or ? are assumed to be either a constant, equate, or a label! * is symbol for the current PC value.

Bytes are stored as bytes!
Words are stored lo-hi format! ($8009 is stored $0980)
TWords are stored lo-hi-bb format! ($018009 is stored $098001)
Longs are stored lo-hi-lo-hi format! ($12345678 is stored $78563412)
Any number/constant/label can be sized using .b, .w (default), .t, or .l.
Numbers starting with 0-9 are decimal.
Numbers starting with $ are hexadecimal.
Numbers starting with % are binary.
Numbers starting with @ are a defined base (2-9).
syntax: @base:number eg. @3:12 will actually be 5 decimal!
Numbers starting with " or ' are regarded as ascii.
(Right justified, leading bytes zeroed!!!)
Numbers are evaluated in a mathematical order < > & ! ^ \ / * + -
< is shift left. eg. 7<2 is 28
> is shift right. eg. 7>2 is 1
& is and. eg. 7&2 is 2 (!!!)
! is or. eg. 7!2 is 7 (!!!)
\ is remainder after a divide. eg. 7\2 is 1
/ is integer after a divide. eg. 7/2 is 3
* is multiply. eg. 7*2 is 14
+ is add. eg. 7+2 is 9
- is subtract. eg. 7-2 is 5
( and ) are NOT allowed. This was because of possible assembler confusion with the 6502's addressing modes. If you want brackets, then write your own assembler.

Tasm has ALL the official Snes constants built-in. (See SNES ON, etc).
Other equates for the S700, Nes & Magicom are also built-in, but as no official names have ever been defined, I've picked my own! Built-in equates can be replaced with new definitions by equating over them. This should make Tasm compatible with most programs, even if they define the system equates again.
eg. ROM is normally $8000, but "ROM equ 5" makes it 5.

I won't list the constants here (there are far too many), if you want a list then look at the assembler with an editor. If you don't know how to look at the assembler, then maybe you shouldn't be using it either. The value of the constant is the long-word before the next constant in the hex dump of the assembler. There are 2 special constants, "PC" and "*", both refer to the current value of the PC. They change with each line of the assembly. They can also be used to change the current value of the PC.
eg.
*= *+40
ORG *+80
PC= PC+90
They can also be use to set labels.
eg.
label = *+100
label EQU PC*2+100
Local labels start with "_". Within the assembler, locals are stored with their parent, thus you can branch to a local label from outside (in an emergency).
eg.
BRA Routine_Loop