t3x.org / t3x / t3x-manual / 44.html
 
T3X - A Minimum Procedural Language
Version 8.1.5, Online Edition
Copyright(C) 1996-2004
Nils M Holm
 
Previous:
4.3 Instance Contexts
TOC | Index | Back Next:
4.5 Instruction Cycles

4.4 Tcode Instruction Format

Tcode instructions come in two flavours. The first sort has no inline arguments and is one byte long. The second sort has inline arguments. Its length is described in the flags field of the opcode. The first flavour has the following format:

Bit#   7 6 5 4 3 2 1 0
Field   AR C C C C C C C
Fig.6 Flavour 1 Tcode Instruction Format

The AR field of flavour-1 instructions must be zero, thereby indicating that the instruction has no inline arguments. The entire instruction is contained in a single byte. The C bits 0 through 6 contain the opcode of the instruction. Flavour-2 instructions have a one-byte flags prefix attached to the opcode:

Bit#   7 6 5 4 3 2 1 0   7 6 5 4 3 2 1 0
Field   AR N A SF L 2 L 1   0 C C C C C C C
Fig.7 Flavour 2 Tcode Instruction Format

The flags field of flavour-2 instructions contains the following additional fields:

Field Content Values
AR Argument flag Must be 1
NA Number of arguments 0, 1, 2
SF String flag 0, 1
L2 Length of argument 2 0, 1, 3
L1 Length of argument 1 0, 1, 3

An AR flag value of 1 indicates that this byte holds the flags of a flavour-2 instruction. NA holds the number of arguments of this instruction. Tcode instructions may have zero, one, or two arguments. However, zero-argument instructions are typically of flavour-1. If the SF flag is set, the last argument of this instruction is a string. L1 and L2 specify the length of operand 1 and operand 2 repectively. Each length field holds the number of bytes used to represent the operand minus 1, so an Lx value of zero denotes a single-byte operand. Operands must be sign-extended to machine word size as described earlier in this chapter.

The characters of string operands are stored in the bytes following the last argument of an instruction. For example, the IPROC statement

IPROC 128 7 "t3x_bpw"

has 2 arguments, the second one being a string. It would be encoded as follows:

Field AR NA SF L2 L1   Opcode Operand#1 Operand#2 String text (ASCII)
Value 1 2 1 0 1 0 0x4F 0x00 0x80 0x07 t 3 x _ b p w
Previous:
4.3 Instance Contexts
TOC | Index | Back Next:
4.5 Instruction Cycles