The assembler, AS.TTP, takes as input all files listed on the command line. Output is placed in YA.OUT, unless over-ridden by the -o option. All files after the -l in the command line are treated as libraries; only unresolved symbols will be added to the load module. The options to the assembler include: -o outfile output placed in outfile -m a symbol table map is included in the output -l lib ... all files that follow are libraries -f listfile input file names are found in listfile (this gets around the 128 byte command line limit) The input is always MJC intermediate code, which is a terse form of assembly language. This saves space, makes the assembler/loader quicker, and allows one to create "object" modules with a regular text editor. The drawback is that it takes more space than typical object code. Basically, every line maps into one or more 68000 instructions. I have listed here all the codes, their 68000 assembler equivalent, and a brief comment. Some notes at the end explain labels, strings, and operations (e.g. add, sub, etc). ! comment, everything on the line is ignored : sym define a text symbol . sym val define a bss symbol; val is number of bytes needed * lbl define a label (see notes) $ str define a string (see notes) = num word value in text space =. sym address value in text space =$ str string address in text space =+ sym val address of symbol + value in text space ? sym remove the symbol from symbol table (for static) csv link A6,#stk set frame and stack pointer ret unlk A6;rts return from function efn stk end of function, stk becomes the constant for csv rsv reglst movem reglist,-(A7) push active registers rst regpat movem (A7)+,reglist pop active registers rs[wl] x off move.[wl] Ax,off(A6) save register variable rr[wl] off x move.[wl] off(A6),Ax restore register variable cse num lbl cmpi.l #num,D0 compare for case statements brc op lbl bcc lbl branch on condition (see notes) jmp lbl bra lbl unconditional branch jsr sym jsr sym direct function call jsi x jsr (Ax) indirect function call trp num trap #num trap instruction pop num adda.l #num,A7 pop stuff off the stack pd[wl] num move.[wl] #num,-(A7) push a value on the stack pl[bwl] off move.[bwl] off(A6),-(A7)push a local variable pha x move.l Ax,-(A7) push an address on stack tad x y move.l Ax,Dy transfer Areg to Dreg tda x y move.l Dx,Ay transfer Dreg to Areg tdd x y move.l Dx,Dy transfer Dreg to Dreg ld[wl] num d move.[wl] #num,Dd load value ll[bwl] off d move.[bwl] off(A6),Dd load local variable lg[bwl] sym d move.[bwl] sym,Dd load global variable lx[bwl] a i d move.[bwl] 0(Aa,Di),Dd load indexed value lo[bwl] a off d move.[bwl] off(Aa),Dd load indirect with offset l$ str a lea #str,Aa load string address lag sym a lea sym,Aa load global address lal off a lea off(A6),Aa load local address lax a i x lea 0(Aa,Di),Ax load indexed address lao a off x lea off(Aa),Ax load address of indirect offset ob[bwl] op x y xxx.[bwl] Dx,Dy binary operation (see notes) ou[bwl] op x xxx.[bwl] Dx unary operation (see notes) so[bwl] a off d move.[bwl] Dd,off(Aa) store indirect with offset sg[bwl] d sym move.[bwl] Dd,sym store global sl[bwl] d off move.[bwl] Dd,off(A6) store local sx[bwl] a i d move.[bwl] Dd,0(Aa,Di) store indexed value ad[bwl] num d various opcodes multiply Dd by num, long result cm[bwl] x y cmp.[bwl] Dx,Dy compare two values cd[bwl] x num cmpi.[bwl] #num,Dx immediate data compare ts[bwl] x tst.[bwl] Dx test register against 0 ig[bwl] num sym addi.[bwl] #num,sym increment global il[bwl] num off addi.[bwl] #num,off(A6) increment local irl num x addi.l #num,Ax increment register var ii[bwl] num a addi.[bwl] #num,(Aa) increment indirect xtb x ext.w Dx extend byte to word xtw x ext.l Dx extend word to long xub x andi.l #0xFF,Dx unsigned extend byte to long xuw x andi.l #0xFFFF,Dx unsigned extend word to long Notes: Labels and string identifiers are numbers that are re-used for every function. As labels and strings are used, the assembler keeps track of their use. When the "efn" opcode is encountered, all the label forward references are fixed up and the label identifiers can then be re-used. Strings are typically a forward reference, which is fixed up when the string is defined. All the possible C operations are numbered by the compiler. These numbers are matched in the assembler to 68000 opcodes. 1 or 2 exclusive or 3 and 4 equal (comparison) 5 not equal (comparison) 6 less than (comparison) 7 greater than (comparison) 8 less than or equal (comparison) 9 greater than or equal (comparison) 10 shift left 11 logical shift right 12 add 13 subtract 14 multiply 15 divide 16 mod 17 logical negation 18 arithmetic negation 19 bitwise negation (eor #0xFFFFFFFF,reg) 20 unsigned equal (comparison) 21 unsigned not equal (comparison) 22 unsigned low (comparison) 23 unsigned high (comparison) 24 unsigned low or same (comparison) 25 unsigned high or same (comparison) 26 arithmetic shift right (sign bit carried through) If your favorite 68000 opcode does not appear in the above, you can resort to using the "=" facility to place opcodes in line in the text. For example, you can get access to the LineA facilities with: PutPixel(color, x, y) { /* set up input LineA variables */ asm( = 40961 ); /* 40961 == 0xA001 */ } Arguments to opcodes can be set using =. or =$ codes. For example, "move.l xxx,yyy" can be implemented in an intermediate code module as = 9209 # opcode for move.l sym.l,sym.l =. xxx # address of symbol xxx =. yyy # address of symbol yyy Please remember that all values in the intermediate code are (long signed) decimal. That certainly doesn't make the above easy, but you should be writing in C most the time anyway, right? I have recently build a filter that takes Motorola assembly format and generates the stuff above. Send me a letter if you're interested.