1 /* 2 the DASM macro assembler (aka small systems cross assembler) 3 4 Copyright (c) 1988-2002 by Matthew Dillon. 5 Copyright (c) 1995 by Olaf "Rhialto" Seibert. 6 Copyright (c) 2003-2008 by Andrew Davie. 7 Copyright (c) 2008 by Peter H. Froehlich. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License along 20 with this program; if not, write to the Free Software Foundation, Inc., 21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 */ 23 24 /* 25 * GLOBALS.C 26 */ 27 28 #include "asm.h" 29 30 SYMBOL *SHash[SHASHSIZE]; /* symbol hash table */ 31 32 33 MNEMONIC *MHash[MHASHSIZE]; /* mnemonic hash table */ 34 INCFILE *pIncfile; /* include file stack */ 35 REPLOOP *Reploop; /* repeat loop stack */ 36 SEGMENT *Seglist; /* segment list */ 37 SEGMENT *Csegment; /* current segment */ 38 IFSTACK *Ifstack; /* IF/ELSE/ENDIF stack */ 39 char *Av[256]; /* up to 256 arguments */ 40 char Avbuf[512]; 41 unsigned char MsbOrder = 1; 42 int Mnext; 43 char Inclevel; 44 unsigned int Mlevel; 45 unsigned long Localindex; /* to generate local variables */ 46 unsigned long Lastlocalindex; 47 48 unsigned long Localdollarindex; 49 unsigned long Lastlocaldollarindex; 50 51 unsigned long Processor = 0; 52 bool bTrace = false; 53 bool Xdebug; 54 bool bStrictMode = false; 55 56 unsigned char Outputformat; 57 58 unsigned long Redo_why = 0; 59 int Redo_eval = 0; /* infinite loop detection only */ 60 int Redo = 0; 61 62 int nMacroDeclarations = 0; 63 int nMacroClosings = 0; 64 65 unsigned long maxFileSize = 640 * 1024; // avoid recursive growing via set,eqm 66 // 640k are enough for everybody ... said Bill G. How many 64k pages have you ? 67 68 unsigned long Redo_if = 0; 69 70 char ListMode = 1; 71 unsigned long CheckSum; /* output data checksum */ 72 73 int F_format = FORMAT_DEFAULT; 74 75 /* -T option [phf] */ 76 sortmode_t F_sortmode = SORTMODE_DEFAULT; 77 /* -E option [phf] */ 78 errorformat_t F_errorformat = ERRORFORMAT_DEFAULT; 79 80 unsigned char F_verbose; 81 const char *F_outfile = "a.out"; 82 char *F_listfile; 83 char *F_symfile; 84 FILE *FI_listfile; 85 FILE *FI_temp; 86 unsigned char Fisclear; 87 unsigned long Plab, Pflags; 88 89 /*unsigned int Adrbytes[] = { 1, 2, 3, 2, 2, 2, 3, 3, 3, 2, 2, 2, 3, 1, 1, 2, 3 };*/ 90 unsigned int Cvt[] = { 0, 2, 0, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 0, 0 }; 91 unsigned int Opsize[] = { 0, 1, 2, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 0, 0, 1, 1, 1, 2 }; 92 93 MNEMONIC Ops[] = { 94 { NULL, v_list , "list", 0, 0, {0,} }, 95 { NULL, v_include , "include", 0, 0, {0,} }, 96 { NULL, v_seg , "seg", 0, 0, {0,} }, 97 { NULL, v_hex , "hex", 0, 0, {0,} }, 98 { NULL, v_err , "err", 0, 0, {0,} }, 99 { NULL, v_dc , "dc", 0, 0, {0,} }, 100 { NULL, v_dc , "byte", 0, 0, {0,} }, 101 { NULL, v_dc , "word", 0, 0, {0,} }, 102 { NULL, v_dc , "long", 0, 0, {0,} }, 103 { NULL, v_ds , "ds", 0, 0, {0,} }, 104 { NULL, v_dc , "dv", 0, 0, {0,} }, 105 { NULL, v_end , "end", 0, 0, {0,} }, 106 { NULL, v_trace , "trace", 0, 0, {0,} }, 107 { NULL, v_org , "org", 0, 0, {0,} }, 108 { NULL, v_rorg , "rorg", 0, 0, {0,} }, 109 { NULL, v_rend , "rend", 0, 0, {0,} }, 110 { NULL, v_align , "align", 0, 0, {0,} }, 111 { NULL, v_subroutine, "subroutine", 0, 0, {0,} }, 112 { NULL, v_equ , "equ", 0, 0, {0,} }, 113 { NULL, v_equ , "=", 0, 0, {0,} }, 114 { NULL, v_eqm , "eqm", 0, 0, {0,} }, 115 { NULL, v_set , "set", 0, 0, {0,} }, 116 { NULL, v_setstr , "setstr", 0, 0, {0,} }, 117 { NULL, v_macro , "mac", MF_IF|MF_BEGM, 0, {0,} }, 118 { NULL, v_macro , "macro", MF_IF|MF_BEGM, 0, {0,} }, 119 { NULL, v_endm , "endm", MF_ENDM,0, {0,} }, 120 { NULL, v_mexit , "mexit", 0, 0, {0,} }, 121 { NULL, v_ifconst , "ifconst", MF_IF, 0, {0,} }, 122 { NULL, v_ifnconst, "ifnconst", MF_IF, 0, {0,} }, 123 { NULL, v_ifnconst, "ifndef", MF_IF, 0, {0,} }, 124 { NULL, v_if , "if", MF_IF, 0, {0,} }, 125 { NULL, v_else , "else", MF_IF, 0, {0,} }, 126 { NULL, v_endif , "endif", MF_IF, 0, {0,} }, 127 { NULL, v_endif , "eif", MF_IF, 0, {0,} }, 128 { NULL, v_repeat , "repeat", MF_IF, 0, {0,} }, 129 { NULL, v_repend , "repend", MF_IF, 0, {0,} }, 130 { NULL, v_echo , "echo", 0, 0, {0,} }, 131 { NULL, v_processor,"processor", 0, 0, {0,} }, 132 { NULL, v_incbin , "incbin", 0, 0, {0,} }, 133 { NULL, v_incdir , "incdir", 0, 0, {0,} }, 134 MNEMONIC_NULL 135 }; 136 137