back   contents   next  



Introduction

The As10k1's assembly syntax was originally intended to be similar to MC68K assembly. It has since evolved and now has a unique syntax.


General Assembly Syntax

Assembly lines generally have four fields separated by spaces or tabs:

Name_Field Opcode_field Operand_Field Comment_Field
[symbol] [mnemonic] [operands] [text]

With this assembler, each line can have a maximum of 256 characters and each symbol can be a maximum of 11 characters. Symbols ARE case sensitive, opcodes ARE NOT.

Symbols

A symbols is a words which placed at the beginning of a line (it must start at column 1) and is used by assembly directive. Symbols may be used to reference a register, an assembly-time equate, to reference a position in the program (the skip instruction), or just as a label to indicate to a reader where they are in a program (e.g. "start"). The use of a symbol is covered in greater detail in the sections describing assembly directives.

The first character in a symbol must be an alpha character* (a-z,A-Z). The remaining characters may be alphanumeric (a-z,A-Z,0-9) or an underscore (_). Symbols cannot exceed a length of 32 characters.

*An exception to this rule occurs when symbols are used for the skip command, in which case the symbol must start with a period.

Opcode

All instructions require 4 operands, they have the format

opcode R,A,X,Y

Here is a summary of the 16 opcodes. [1]

Opcode Number Opcode MnemonicInstructioncomment
0x0 MACS R = A + (X * Y >> 31) saturation
0x1 MACS1 R = A + (-X * Y >> 31) saturation
0x2 MACW R = A + (X * Y >> 31) wraparound
0x3 MACW1 R = A + (-X * Y >> 31) wraparound
0x4 MACINTS R = A + X * Y saturation
0x5 MACINTW R = A + X * Y wraparound (31-bit)
0x6 ACC3 R = A + X + Y saturation
0x7 MACMV R = A, acc += X * Y 67 bit accum, you can grab MS 32 bits of LS 32 bits
0x8 ANDXOR R = (A & X) ^ Y 
0x9 TSTNEG R = (A >= Y) ? X : ~X  
0xa LIMIT R = (A >= Y) ? X : Y 
0xb LIMIT1 R = (A < Y) ? X : Y 
0xc LOG ... 
0xd EXP ...  
0xe INTERP R = A + (X * (Y - A) >> 31) ; saturation
0xf SKIP R,CCR,CC_TEST,COUNT  

Operands

Operands can be specified as either a symbol or a value. hex values are prefixed by $, octal by @, and binary by %.

e.g.:

123 decimal value
$123 hex value
@123 octal value
%01101 binary value

The operands for emu10k1 instructions are always addresses of registers, there are no instruction which take immediate values.

Some directives have there own special operand forms

Comments

A semicolon ";" indicates to the assembler that everything afterwards is a comment.

Anything after a completed instruction (i.e. one that has four operands) will also be ignored. However, to be on the safe side, I recommend aways using a ";" to make sure that the assembler knows to ignore what follows.

Example

Here's an example of an instruction:

foo     macs      one,two,three,four    ;comment

"foo" is a symbol (in this case it does nothing), "macs" is our instruction, and "one,two,three,four" is our operand, ";comment" is ignored.



back   contents   next