Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1846 | yogev_ezra | 1 | //===== Глобальные переменные |
2 | // ---- Информация по tokens |
||
3 | dword tok=0; |
||
4 | dword type=0; |
||
5 | dword src=0; |
||
6 | dword post=0; |
||
7 | dword number=0; |
||
8 | byte string[STRLEN]=0; |
||
9 | dword tok2=0; |
||
10 | dword type2=0; |
||
11 | dword src2=0; |
||
12 | dword post2=0; |
||
13 | dword number2=0; |
||
14 | dword modline=0; |
||
15 | byte string2[STRLEN]=0; |
||
16 | // ---- Буфера управляющие флаги |
||
17 | dword currmod=0; // Номер текущего файла |
||
18 | dword displaytokerrors=1;// Флаг вывода сообщен й об ош бке |
||
19 | dword error=0; // Содержит номер текущей ошибк |
||
20 | dword maxerrors = 16; // Предел по количеству ошибок |
||
21 | dword makemapfile=0; // Флаг генерац и MAP-файла |
||
22 | dword dbg=0; // Флаг генерац и TDS-файла для TD32 |
||
23 | dword dbginfo=0; // Указатель на буфер dbg информацией (см.описание в enum dbg_...) |
||
24 | dword dbgs=0; // Текущий указатель в dbginfo |
||
25 | dword input=0; // Указатель на начало динамического буфера с входным файлом |
||
26 | dword inptr=0; // Указатель на текущ символ в буфере input |
||
27 | dword inptr2=0; // Копия inptr |
||
28 | dword endoffile=0; // Флаг конца файла |
||
29 | dword totallines=1; // Общее количество откомпилированных строк |
||
30 | dword linenumber=0; // Номер текущей строки |
||
31 | dword linenum2=0; // Номер следующей строки |
||
32 | dword list=0; // Флаг выдачи листинга |
||
33 | dword label=0; // Сквозной номер для локальных меток |
||
34 | dword mapfile=0; // Handle для MAP файла |
||
35 | dword module=0; // Счетчик откомпилированных модулей |
||
36 | dword outptr=0; // Индекс в output |
||
37 | dword output=0; // Указатель на буфер с кодом |
||
38 | dword localsize=0; // Размер стека под локальными переменными |
||
39 | dword posttype=0; // Указатель на тип POST |
||
40 | dword postloc=0; // Указатель на положение в output |
||
41 | dword postnum=0; // Указатель на значение по postloc |
||
42 | dword posts=0; // Номер текущей записи в posttype, postloc и postnum |
||
43 | dword postsize=0; // Суммарный размер всех post-переменных |
||
44 | dword poststrptr=MAXDATA-1; // Индекс для вывода post-строк |
||
45 | dword procedure_start=0;// Адрес начала процедуры |
||
46 | dword runfilesize=0; |
||
47 | dword startptr=0; // Указатель на main() |
||
48 | dword treestart=0; // Указатель на начало списка идентификаторов |
||
49 | dword treeptr=0; // Указатель на текущу запись в списке идент каторов |
||
50 | dword locallist = NULL; // Указатель на начало списка локальных переменных |
||
51 | dword localptr=NULL; // Указатель на текущую запись в списке локальных |
||
52 | dword DLLcount=0; // Счетчик импортированных DLL |
||
53 | dword APIcount=0; // Счетчик используемых API |
||
54 | dword importFlag=0; // Флаг импорта из DLL |
||
55 | dword DLLlist[MAXDLLS]; |
||
56 | byte currentfilename[FILENAMESIZE] = 0; |
||
57 | byte inputfile[FILENAMESIZE]=0; |
||
58 | byte rawfilename[FILENAMESIZE]=0; |
||
59 | byte mapstr[120]=0; |
||
60 | // ---- DOS&PE headers |
||
61 | word exeheader[34]={ |
||
62 | 0x5A4D,0x40,1,0,2,0,0xFFFF,0, |
||
63 | 0,0,0,0,0x40,0,0,0, |
||
64 | 0xC88C,0xD88E,0x0FBA,0xB400,0xCD09,0xB821,0x4C00,0x21CD, |
||
65 | 0x6957,0x336E,0x2032,0x6E6F,0x796C,0x2421,0x40,0, |
||
66 | 0x4550,0}; |
||
67 | // PE Header |
||
68 | //unsigned dword PEsign = 0x4550; |
||
69 | word PEmachine=0x14C; // target machine = Intel 386 |
||
70 | word PEnSections=1; // XAC - only .text!!! number of sections in Sections table |
||
71 | word PEDate=0; |
||
72 | word PEtime=0; |
||
73 | dword PEpSymbolTable=0; // Offset within COFF file of the symbol table |
||
74 | dword PEnSymbols=0; // number of entries in the symbol table |
||
75 | word PEOptHeaderSize=0xE0; // Size of optional header |
||
76 | word PECharacteristics=0x30E; //0x30E 32-bit+... |
||
77 | // Optional header (only in EX image) |
||
78 | word OptMagic=0x10B; // normal executable |
||
79 | byte OptLmajor=2; // Linker major version number |
||
80 | byte OptLminor=0x37; // Linker minor version number |
||
81 | dword OptCodeSize=0; // Size of the code section |
||
82 | dword OptInitDataSize=0; // Size of the initialized data section |
||
83 | dword OptUninitDataSize=0;// Size of the uninitialized data section (BSS) |
||
84 | dword OptEntryPointRVA=0x1000;// Address of entry point, relative to image base |
||
85 | dword OptBaseOfCode=0x1000;// Address realtive to image base |
||
86 | dword OptBaseOfData=0;//Address realtive to image base |
||
87 | dword OptImageBase=0x00400000;// Preferred address of first byte of image |
||
88 | dword OptSectionAlignment=0x1000; |
||
89 | dword OptFileAlignment=0x200; |
||
90 | word OptOSmajor=1; |
||
91 | word OptOSminor=0; |
||
92 | dword OptUserVersion=0; |
||
93 | word OptSubSysMajor=4; |
||
94 | word OptSubSysMinor=0; |
||
95 | dword OptReserved=0; |
||
96 | dword OptImageSize=0x0; // Size of image, including all headers |
||
97 | dword OptHeaderSize=0x200; //DOSheader+PEheader+ObjectTable |
||
98 | dword OptFileChecksum=0; // Image file checksum |
||
99 | word OptSubSystem=3; // 2-GUI; 3-console |
||
100 | word OptDLLflag=0; |
||
101 | dword OptStackReserveSize=0x100000; |
||
102 | dword OptStackCommitSixe=0x1000; |
||
103 | dword OptHeapReserveSize=0x100000; |
||
104 | dword OptHeapCommitSize=0x1000; |
||
105 | dword OptLoaderSize=0; |
||
106 | dword OptNumOfDataDirectories=16; |
||
107 | // Optional header Data Directories |
||
108 | dword OptExportTableAdr=0; |
||
109 | dword OptExportTableSize=0; |
||
110 | dword OptImportTableAdr=0; |
||
111 | dword OptImportTableSize=0; |
||
112 | dword OptResourceTableAdr=0; |
||
113 | dword OptResourceTablesize=0; |
||
114 | dword OptExceptionTableAdr=0; |
||
115 | dword OptExceptionTableSize=0; |
||
116 | dword OptSecurityTableAdr=0; |
||
117 | dword OptSecurityTableSize=0; |
||
118 | dword OptBaseRelocationTableAdr=0; |
||
119 | dword OptBaseRelocationTableSize=0; |
||
120 | dword OptDebugAdr=0; |
||
121 | dword OptDebugSize=0; |
||
122 | dword OptCopyrightAdr=0; |
||
123 | dword OptCopyrightSize=0; |
||
124 | dword OptGlobalPtrAdr=0; |
||
125 | dword OptGlobalPtrSize=0; |
||
126 | dword OptTLStableAdr=0; |
||
127 | dword OptTLStablesize=0; |
||
128 | dword OptLoadConfigTableAdr=0; |
||
129 | dword OptLoadConfigTableSize=0; |
||
130 | dword OptReserved2[10]={0,0,0,0,0,0,0,0,0,0}; |
||
131 | // Sections Table |
||
132 | // TEXT section header |
||
133 | byte TxtSectionName[8]=".text"; |
||
134 | dword TxtVirtualSize=0; |
||
135 | dword TxtRVAoffset=0x1000; |
||
136 | dword TxtSizeOfRawData=0; |
||
137 | dword TxtPointerToRawData=0x200; |
||
138 | dword TxtPointerToRelocs=0; |
||
139 | dword TxtPointerToLinenumbers=0; |
||
140 | word TxtNumberOfRelocs=0; |
||
141 | word TxtNumberOfLinenumbers=0; |
||
142 | dword TxtSectionFlags=0xE00000E0; // can be executed + contain executable code |
||
143 | // ---- Неиниц руемые данные |
||
144 | dword stdout; // Handle to stdout |
||
145 | byte cha,cha2; |
||
146 | dword numberofids; |
||
147 | dword current_proc_type; // Тип текущей процедуры (cpt_near, cpt_far) |
||
148 | dword returntype; // Тип возвращаемого значения (void, byte, word, ...) |
||
149 | dword paramsize; |
||
150 | dword relation; |
||
151 | dword startlabel,endlabel; |
||
152 | byte modules[MAXMDL*FILENAMESIZE]; |
||
153 | dword St_Mnemonics[26]; |
||
154 | dword St_Registers[26]; |
||
155 | dword St_Directives[26]; |
||
156 | dword St_Sizes[26]; |
||
157 | byte Buffer16[64]; // Буфер для сортировк строк |