🡄 Previous

Next 🡆

Contents > Functions

Function Catalog

The table below provides the names and definitions of the functions created for the general-purpose computer. The missing byte match functions are covered separately.

Parameters A and B are bytes, W is a 16-bit word, and C, D, and E are Booleans (bytes restricted to 0 and 1).

FunctionDefinition
CLEARA0
DECAA − 1
DEC_16WW − 1
IDENTITYAA
INCAA + 1
INC_16WW + 1
LS2AA << 2
LS3AA << 3
LS4AA << 4
RS1AA >>> 1
RS5AA >>> 5
ADD_AB_FB[ A, B ][ A + B, B ]
AND_AB_AF[ A, B ][ A, A & B ]
AND_AB_FB[ A, B ][ A & B, B ]
AND_NOT_AB_FB[ D, E ][ D, D and not E ]
COPY_A_B[ A, B ][ A, A ]
COPY_B_A[ A, B ][ B, B ]
INC_16_C[ W, C ][ C ? W + 1 : W, C ]
OR_AB_FB[ A, B ][ A | B, B ]
SUB_AB_FB[ A, B ][ A − B, B ]
SWAP[ A, B ][ B, A ]
XOR_AB_FB[ A, B ][ A ^ B, B ]
AND_A_B_C[ D, E, C ][ D, E, D and E ]
C_AND_A_NOT_B[ C, D, E ][ D and not E, D, E ]
CMP_C[ A, B, C ][ A, B, A = B ]
CMP_AND_C[ A, B, C ][ A, B, (A = B) and C ]
C_CMP[ C, A, B ][ A = B, A, B ]
COPY_A_B_C[ A, B, C ][ A, C ? A : B, C ]
COPY_B_A_C[ A, B, C ][ C ? B : A, B, C ]
C_COPY_B_A[ C, A, B ][ C, C ? B : A, B ]
C_COPY_A_B[ C, A, B ][ C, A, C ? A : B ]

A byte match functions accept a byte, A, and a Boolean, C. It returns A, unchanged, along with a Boolean indicating if A matches a specific bit pattern. The function names declare the parameter orders:

Ends with _C:[ A, C ][ A, isMatch(A) ]
Starts with C_:[ C, A ][ isMatch(A), A ]

The following table details the byte match functions. Those with bit patterns containing don’t-care are capable of matching multiple values, as shown in the right column.

FunctionPatternValues
ADD_C0001000010
AND_C0001000111
BEQ_C0010001123
BMI_C0010010125
BNE_C0010001022
BPL_C0010010024
DEC_C0001001012
INC_C0001001113
JMP_C0010000020
JSR_C0010100028
LDB_C0100000141
LS2_C0001010014
LS3_C0001010115
LS4_C0001011016
OR_C0001011117
RS1_C0001100018
RS5_C0001100119
RTS_C0111000070
SEA_C0101000050
SEB_C0101000151
SMN_C001011112F
STA_C0011000030
STB_C0011000131
SUB_C000110101A
XOR_C000110111B
TAX_C000000**00, 01, 02, 03
TBX_C000001**04, 05, 06, 07
TMX_C000010**08, 09, 0A, 0B
TNX_C000011**0C, 0D, 0E, 0F
TXA_C0000**0000, 04, 08, 0C
TXB_C0000**0101, 05, 09, 0D
TXM_C0000**1002, 06, 0A, 0E
TXN_C0000**1103, 07, 0B, 0F
LDX_C0100000*40, 41
STX_C0011000*30, 31
SEX_C0101000*50, 51
THREE_C0010****20..2F
MINUS_C1*******80..FF
C_MINUS1*******80..FF
ZERO_C0000000000
C_ZERO0000000000

As their names suggest, the byte match functions primarily detect machine language opcodes or sets of opcodes. The most generic of them, THREE_C, matches the opcodes for all 3-byte instructions.

MINUS_C and C_MINUS recognize negative numbers, those with bit-7 set per two’s complement.

ZERO_C and C_ZERO are zero detectors.

🡄 Previous

Next 🡆