0,0 → 1,157 |
//===== «®¡ «ìë¥ ¯¥à¥¬¥ë¥ |
// ---- ä®à¬ æ¨ï ¯® tokens |
dword tok=0; |
dword type=0; |
dword src=0; |
dword post=0; |
dword number=0; |
byte string[STRLEN]=0; |
dword tok2=0; |
dword type2=0; |
dword src2=0; |
dword post2=0; |
dword number2=0; |
dword modline=0; |
byte string2[STRLEN]=0; |
// ---- ãä¥à ã¯à ¢«ïî騥 ä« £¨ |
dword currmod=0; // ®¬¥à ⥪ã饣® ä ©« |
dword displaytokerrors=1;// « £ ¢ë¢®¤ á®®¡é¥ © ®¡ ®è ¡ª¥ |
dword error=0; // ®¤¥à¦¨â ®¬¥à ⥪ã饩 ®è¨¡ª |
dword maxerrors = 16; // ।¥« ¯® ª®«¨ç¥áâ¢ã ®è¨¡®ª |
dword makemapfile=0; // « £ £¥¥à æ ¨ MAP-ä ©« |
dword dbg=0; // « £ £¥¥à æ ¨ TDS-ä ©« ¤«ï TD32 |
dword dbginfo=0; // ª § â¥«ì ¡ãä¥à dbg ¨ä®à¬ 樥© (á¬.®¯¨á ¨¥ ¢ enum dbg_...) |
dword dbgs=0; // ¥ªã騩 㪠§ â¥«ì ¢ dbginfo |
dword input=0; // ª § ⥫ì ç «® ¤¨ ¬¨ç¥áª®£® ¡ãä¥à á ¢å®¤ë¬ ä ©«®¬ |
dword inptr=0; // ª § ⥫ì ⥪ãé ᨬ¢®« ¢ ¡ãä¥à¥ input |
dword inptr2=0; // ®¯¨ï inptr |
dword endoffile=0; // « £ ª®æ ä ©« |
dword totallines=1; // ¡é¥¥ ª®«¨ç¥á⢮ ®âª®¬¯¨«¨à®¢ ëå áâப |
dword linenumber=0; // ®¬¥à ⥪ã饩 áâப¨ |
dword linenum2=0; // ®¬¥à á«¥¤ãî饩 áâப¨ |
dword list=0; // « £ ¢ë¤ ç¨ «¨á⨣ |
dword label=0; // ª¢®§®© ®¬¥à ¤«ï «®ª «ìëå ¬¥â®ª |
dword mapfile=0; // Handle ¤«ï MAP ä ©« |
dword module=0; // ç¥â稪 ®âª®¬¯¨«¨à®¢ ëå ¬®¤ã«¥© |
dword outptr=0; // ¤¥ªá ¢ output |
dword output=0; // ª § â¥«ì ¡ãä¥à á ª®¤®¬ |
dword localsize=0; // §¬¥à á⥪ ¯®¤ «®ª «ì묨 ¯¥à¥¬¥ë¬¨ |
dword posttype=0; // ª § ⥫ì ⨯ POST |
dword postloc=0; // ª § â¥«ì ¯®«®¦¥¨¥ ¢ output |
dword postnum=0; // ª § â¥«ì § 票¥ ¯® postloc |
dword posts=0; // ®¬¥à ⥪ã饩 § ¯¨á¨ ¢ posttype, postloc ¨ postnum |
dword postsize=0; // 㬬 àë© à §¬¥à ¢á¥å post-¯¥à¥¬¥ëå |
dword poststrptr=MAXDATA-1; // ¤¥ªá ¤«ï ¢ë¢®¤ post-áâப |
dword procedure_start=0;// ¤à¥á ç « ¯à®æ¥¤ãàë |
dword runfilesize=0; |
dword startptr=0; // ª § ⥫ì main() |
dword treestart=0; // ª § ⥫ì ç «® ᯨ᪠¨¤¥â¨ä¨ª â®à®¢ |
dword treeptr=0; // ª § ⥫ì ⥪ãéã § ¯¨áì ¢ ᯨ᪥ ¨¤¥â ª â®à®¢ |
dword locallist = NULL; // ª § ⥫ì ç «® ᯨ᪠«®ª «ìëå ¯¥à¥¬¥ëå |
dword localptr=NULL; // ª § ⥫ì ⥪ãéãî § ¯¨áì ¢ ᯨ᪥ «®ª «ìëå |
dword DLLcount=0; // ç¥â稪 ¨¬¯®àâ¨à®¢ ëå DLL |
dword APIcount=0; // ç¥â稪 ¨á¯®«ì§ã¥¬ëå API |
dword importFlag=0; // « £ ¨¬¯®àâ ¨§ DLL |
dword DLLlist[MAXDLLS]; |
byte currentfilename[FILENAMESIZE] = 0; |
byte inputfile[FILENAMESIZE]=0; |
byte rawfilename[FILENAMESIZE]=0; |
byte mapstr[120]=0; |
// ---- DOS&PE headers |
word exeheader[34]={ |
0x5A4D,0x40,1,0,2,0,0xFFFF,0, |
0,0,0,0,0x40,0,0,0, |
0xC88C,0xD88E,0x0FBA,0xB400,0xCD09,0xB821,0x4C00,0x21CD, |
0x6957,0x336E,0x2032,0x6E6F,0x796C,0x2421,0x40,0, |
0x4550,0}; |
// PE Header |
//unsigned dword PEsign = 0x4550; |
word PEmachine=0x14C; // target machine = Intel 386 |
word PEnSections=1; // XAC - only .text!!! number of sections in Sections table |
word PEDate=0; |
word PEtime=0; |
dword PEpSymbolTable=0; // Offset within COFF file of the symbol table |
dword PEnSymbols=0; // number of entries in the symbol table |
word PEOptHeaderSize=0xE0; // Size of optional header |
word PECharacteristics=0x30E; //0x30E 32-bit+... |
// Optional header (only in EX image) |
word OptMagic=0x10B; // normal executable |
byte OptLmajor=2; // Linker major version number |
byte OptLminor=0x37; // Linker minor version number |
dword OptCodeSize=0; // Size of the code section |
dword OptInitDataSize=0; // Size of the initialized data section |
dword OptUninitDataSize=0;// Size of the uninitialized data section (BSS) |
dword OptEntryPointRVA=0x1000;// Address of entry point, relative to image base |
dword OptBaseOfCode=0x1000;// Address realtive to image base |
dword OptBaseOfData=0;//Address realtive to image base |
dword OptImageBase=0x00400000;// Preferred address of first byte of image |
dword OptSectionAlignment=0x1000; |
dword OptFileAlignment=0x200; |
word OptOSmajor=1; |
word OptOSminor=0; |
dword OptUserVersion=0; |
word OptSubSysMajor=4; |
word OptSubSysMinor=0; |
dword OptReserved=0; |
dword OptImageSize=0x0; // Size of image, including all headers |
dword OptHeaderSize=0x200; //DOSheader+PEheader+ObjectTable |
dword OptFileChecksum=0; // Image file checksum |
word OptSubSystem=3; // 2-GUI; 3-console |
word OptDLLflag=0; |
dword OptStackReserveSize=0x100000; |
dword OptStackCommitSixe=0x1000; |
dword OptHeapReserveSize=0x100000; |
dword OptHeapCommitSize=0x1000; |
dword OptLoaderSize=0; |
dword OptNumOfDataDirectories=16; |
// Optional header Data Directories |
dword OptExportTableAdr=0; |
dword OptExportTableSize=0; |
dword OptImportTableAdr=0; |
dword OptImportTableSize=0; |
dword OptResourceTableAdr=0; |
dword OptResourceTablesize=0; |
dword OptExceptionTableAdr=0; |
dword OptExceptionTableSize=0; |
dword OptSecurityTableAdr=0; |
dword OptSecurityTableSize=0; |
dword OptBaseRelocationTableAdr=0; |
dword OptBaseRelocationTableSize=0; |
dword OptDebugAdr=0; |
dword OptDebugSize=0; |
dword OptCopyrightAdr=0; |
dword OptCopyrightSize=0; |
dword OptGlobalPtrAdr=0; |
dword OptGlobalPtrSize=0; |
dword OptTLStableAdr=0; |
dword OptTLStablesize=0; |
dword OptLoadConfigTableAdr=0; |
dword OptLoadConfigTableSize=0; |
dword OptReserved2[10]={0,0,0,0,0,0,0,0,0,0}; |
// Sections Table |
// TEXT section header |
byte TxtSectionName[8]=".text"; |
dword TxtVirtualSize=0; |
dword TxtRVAoffset=0x1000; |
dword TxtSizeOfRawData=0; |
dword TxtPointerToRawData=0x200; |
dword TxtPointerToRelocs=0; |
dword TxtPointerToLinenumbers=0; |
word TxtNumberOfRelocs=0; |
word TxtNumberOfLinenumbers=0; |
dword TxtSectionFlags=0xE00000E0; // can be executed + contain executable code |
// ---- ¥¨¨æ àã¥¬ë¥ ¤ ë¥ |
dword stdout; // Handle to stdout |
byte cha,cha2; |
dword numberofids; |
dword current_proc_type; // ¨¯ ⥪ã饩 ¯à®æ¥¤ãàë (cpt_near, cpt_far) |
dword returntype; // ¨¯ ¢®§¢à é ¥¬®£® § 票ï (void, byte, word, ...) |
dword paramsize; |
dword relation; |
dword startlabel,endlabel; |
byte modules[MAXMDL*FILENAMESIZE]; |
dword St_Mnemonics[26]; |
dword St_Registers[26]; |
dword St_Directives[26]; |
dword St_Sizes[26]; |
byte Buffer16[64]; // ãä¥à ¤«ï á®àâ¨à®¢ª áâப |