ref: e4fbcddc49d1884e2bf8d804e73194f48e974d02
dir: /5552.h/
#define MMAX 1 << 8 #define OPLEN 16 #define REGS 16 #define INSTLEN 3 /* internal */ enum { WARN, ERR, SFLAG, }; /* ops */ enum { DRD, /* read from device */ DWR, /* write to device */ NOT, AND, NOR, XOR, ADD, SUB, INC, DEC, MUL, DIV, SHR, SHL, JMP, }; /* registers */ enum { ZERO, ONE, DUP, FLAGS, PC, STATE, } /* devices */ typedef enum { REG, MEM, SIO, TP0, }Dev; /* states */ typedef enum { OFF, ON, DED, }State; typedef int Word; typedef char Byte; typedef struct { int inst; int arg1; int arg2; int line; }Op; typedef struct { char *name; int pc; }Label; extern Op program[]; extern Label labels[]; extern int outfd; /* emulator */ int mach_drd(Word dev, Word src, Word dst); int mach_dwr(Word mode, Word arg1, Word arg2); int mach_not(Word mode, Word arg1, Word arg2); int mach_and(Word mode, Word arg1, Word arg2); int mach_nor(Word mode, Word arg1, Word arg2); int mach_xor(Word mode, Word arg1, Word arg2); int mach_add(Word mode, Word arg1, Word arg2); int mach_sub(Word mode, Word arg1, Word arg2); int mach_inc(Word mode, Word arg1, Word arg2); int mach_dec(Word mode, Word arg1, Word arg2); int mach_mul(Word mode, Word arg1, Word arg2); int mach_div(Word mode, Word arg1, Word arg2); int mach_shr(Word mode, Word arg1, Word arg2); int mach_shl(Word mode, Word arg1, Word arg2); int mach_jmp(Word mode, Word arg1, Word arg2); /* lint */ int lint_drd(Word mode, Word arg1, Word arg2); int lint_dwr(Word mode, Word arg1, Word arg2); int lint_not(Word mode, Word arg1, Word arg2); int lint_and(Word mode, Word arg1, Word arg2); int lint_nor(Word mode, Word arg1, Word arg2); int lint_xor(Word mode, Word arg1, Word arg2); int lint_add(Word mode, Word arg1, Word arg2); int lint_sub(Word mode, Word arg1, Word arg2); int lint_inc(Word mode, Word arg1, Word arg2); int lint_dec(Word mode, Word arg1, Word arg2); int lint_mul(Word mode, Word arg1, Word arg2); int lint_div(Word mode, Word arg1, Word arg2); int lint_shr(Word mode, Word arg1, Word arg2); int lint_shl(Word mode, Word arg1, Word arg2); int lint_jmp(Word mode, Word arg1, Word arg2);