/* * Z-80 assembler. * Header file, used by all * parts of the assembler. */ #include #include #include #ifdef vax #include stsdef #include ssdef #endif /* * Table sizes, etc. */ #define NCPS 8 /* # of characters in symbol */ #define NHASH 64 /* # of hash buckets */ #define HMASK 077 /* Mask for above */ #define NFNAME 32 /* # of characters in filename */ #define NERR 10 /* Size of error buffer */ #define NCODE 128 /* # of characters in code buffer */ #define NINPUT 128 /* # of characters in input line */ #define NLPP 60 /* # of lines on a page */ #define XXXX 0 /* Unused value */ /* * Exit codes. */ #ifdef vax #define GOOD (SS$_NORMAL) #define BAD (STS$M_INHIB_MSG|SS$_ABORT) #else #define GOOD 0 #define BAD 1 #endif /* * Listing modes. */ #define NLIST 0 /* No list */ #define ALIST 1 /* Address only */ #define BLIST 2 /* Byte format */ #define WLIST 3 /* Word format */ #define SLIST 4 /* Source text only */ /* * Types. These are used * in both symbols and in address * descriptions. Observe the way the * symbol flags hide in the register * field of the address. */ #define TMREG 0x00FF /* Register code */ #define TMMDF 0x0001 /* Multidef */ #define TMASG 0x0002 /* Defined by "=" */ #define TMMODE 0xFF00 /* Mode */ #define TMINDIR 0x8000 /* Indirect flag in mode */ #define TNEW 0x0000 /* Virgin */ #define TUSER 0x0100 /* User name */ #define TBR 0x0200 /* Byte register */ #define TWR 0x0300 /* Word register */ #define TSR 0x0400 /* Special register (I, R) */ #define TDEFB 0x0500 /* defb */ #define TDEFW 0x0600 /* defw */ #define TDEFS 0x0700 /* defs */ #define TDEFM 0x0800 /* defm */ #define TORG 0x0900 /* org */ #define TEQU 0x0A00 /* equ */ #define TCOND 0x0B00 /* conditional */ #define TENDC 0x0C00 /* end conditional */ #define TNOP 0x0F00 /* nop */ #define TRST 0x1000 /* restarts */ #define TREL 0x1100 /* djnz, jr */ #define TRET 0x1200 /* ret */ #define TJMP 0x1300 /* call, jp */ #define TPUSH 0x1400 /* push, pop */ #define TIM 0x1500 /* im */ #define TIO 0x1600 /* in, out */ #define TBIT 0x1700 /* set, res, bit */ #define TSHR 0x1800 /* sl, sr et al */ #define TINC 0x1900 /* inc, dec */ #define TEX 0x1A00 /* ex */ #define TADD 0x1B00 /* add, adc, sbc */ #define TLD 0x1C00 /* ld */ #define TCC 0x1D00 /* condition code */ #define TSUB 0x1E00 /* sub et al */ /* * Registers. */ #define B 0 #define C 1 #define D 2 #define E 3 #define H 4 #define L 5 #define M 6 #define A 7 #define IX 8 #define IY 9 #define BC 0 #define DE 1 #define HL 2 #define SP 3 #define AF 4 #define AFPRIME 5 #define I 0 #define R 1 /* * Condition codes. */ #define CNZ 0 #define CZ 1 #define CNC 2 #define CC 3 #define CPO 4 #define CPE 5 #define CP 6 #define CM 7 typedef unsigned int VALUE; /* For symbol values */ /* * Address description. */ typedef struct ADDR { int a_type; /* Type */ VALUE a_value; /* Index offset, etc */ } ADDR; /* * Symbol. */ typedef struct SYM { struct SYM *s_fp; /* Link in hash */ char s_id[NCPS]; /* Name */ int s_type; /* Type */ VALUE s_value; /* Value */ } SYM; /* * External variables. */ extern char *cp; extern char *ep; extern char *ip; extern char cb[]; extern char eb[]; extern char ib[]; extern FILE *ifp; extern FILE *ofp; extern FILE *lfp; extern int line; extern int lmode; extern VALUE laddr; extern SYM sym[]; extern int pass; extern SYM *phash[]; extern SYM *uhash[]; extern int lflag; extern jmp_buf env; extern VALUE dot; extern SYM *lookup();