-*- Mode: Text; Syntax: ANSI-English -*-
$Id: macroinsn-notes.txt,v 1.1 2001/12/24 02:45:02 james Exp $

MAIN OP insns
-------------
15                 0
 cccc cccc bbbo oooo

c - opcode
b - base register:
    0 = FEF
    1 = FEF+64
    2 = FEF+128
    3 = higher lexical context
    4 = SELF mapping table
    5 = local variables
    6 = arguments
    7 = PDL-POP (offset not used)
o - offset

Main ops have an operand address in the insn and may take additional args from
the stack.  The disposition of the result is impled by the operation.  Base
registers are 0-origin, thus offset 0 is the first elt.

SHORT BRANCH insns
------------------
15                 0
 111t ttsd dddd dddd

t - test condition:
    0 = NULL (else pop)
    1 = NULL
    2 = ATOM
    3 = ZEROP
    4 = SYMBOLP
    5 = (unused)
    6 = NULL (likely)
    7 = always
s - sense
    0 = branch when true
    1 = branch when false

If the displacement cannot be encoded within 9 bits then a Long Branch is
used.  Long branches are AUX OPs.

IMMEDIATE OP insns
------------------
15                 0
 cccc cccv vvvv vvvv

c - opcode
v - value

Immediate ops use the value bits in different ways depending on the particular
insn.  Eg, PUSH-NUMBER uses it as a FIXNUM.  Various op-IMMED insns use it as
a signed integer operand.

CALL OP insns
-------------
15                 0
 10nn nddb bboo oooo

n - number of arguments
d - destination:
    0 = D-INDS (set indicators)
    1 = D-PUSH (push result on stack)
    2 = D-RETURN (return from current frame)
    4 = D-TAIL-REC (replace current frame)

Base and offset fields for Call ops are the same as for Main ops, specifying
the function to be called.  The function args are pushed on the stack before
the Call op is executed.  If the n field contains a 7 then the insn is a
CALL-N insn and the number of args is on the top of the stack (the last thing
pushed).

MISC OP insns
-------------
15                 0
 0d00 001n nnnn nnnn

d - destination:
    0 = D-INDS (set indicators)
    1 = D-PUSH (push result on stack)
n - misc op number

AUX OP insns
------------
15                 0
 0000 000n nnnn nnnn

n - aux op number

AUX OP Complex Call
-------------------
15                 0
 0000 0000 0100 ccdd

c - call type:
    0 = Use call-info word. Push args, mapping table (optional), call-info
        word, and function.
    1 = APPLY (one arg).  Push arg with function to call.
    2 = (unused)
    3 = LEXPR-FUNCALL-WITH-MAPPING-TABLE (one arg).  Push arg, mapping table,
        and function.
d - destination:
    0 = D-INDS (set indicators)
    1 = D-PUSH (push result on stack)
    2 = D-RETURN (return from current frame)
    3 = D-TAIL-REC (replace current frame)

AUX OP Long Branch
------------------
15                 0
 0000 0001 oocc cccc

o - operation:
    0 = unbind <c> special vars
    1 = pop <c> values off stack
    2 = return <c> values from stack
    3 = (unused)
c - count used in operation

AREFI insns
-----------
15                 0
 0d00 111r rrii iiii

d - destination
    0 = D-INDS (set indicators)
    1 = D-PUSH (push result on stack)
r - reference kind
    0 = AREF (Zetalisp)
    1 = ARRAY-LEADER
    2 = %INSTANCE-REF
    3 = AREF (Common Lisp)
    4 = (SETF (AREF ...))
    5 = (SETF (ARRAY-LEADER ...))
    6 = (SETF (%INSTANCE-REF ...))
    7 = unused

MODULE group
------------
15                 0
 0d00 0100 mmmm mooo
d - destination:
    0 = D-INDS (set indicators)
    1 = D-PUSH (push result on stack)
m - module:
    0 = TV
    1 = MOUSE
o - op

This document can be converted to a PostScript reference card with the
command below.  This final page can be discarded.

enscript -U 2 -f "Courier8" -h --margins=36:36:: macroinsn-notes.txt -o macroinsn-notes.ps

Local Variables:
fill-column: 78
mode: auto-fill
End:
