This commit is contained in:
Artur K 2011-12-13 02:02:02 +01:00
parent 9b9df8be6e
commit 10bcaa2caf
24 changed files with 1160 additions and 1172 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
tests/outputs/*
bld

View File

@ -20,7 +20,12 @@ typedef lFunction::iterator ilFunction;
/* SYMBOL TABLE */
struct SYM {
struct SYM
{
SYM() : label(0),size(0),flg(0),type(TYPE_UNKNOWN)
{
}
char name[10]; /* New name for this variable */
dword label; /* physical address (20 bit) */
Int size; /* maximum size */
@ -29,13 +34,7 @@ struct SYM {
eDuVal duVal; /* DEF, USE, VAL */
};
struct SYMTAB
{
Int csym; /* No. of symbols in table */
Int alloc; /* Allocation */
SYM * sym; /* Symbols */
};
typedef std::vector<SYM> SYMTAB;
/* CALL GRAPH NODE */
struct CALL_GRAPH
{

View File

@ -332,7 +332,7 @@ struct DU1
bool isLlFlag(dword flg) {return (ic.ll.flg&flg)==flg;}
llIcode GetLlOpcode() const { return ic.ll.opcode; }
void writeIntComment(char *s);
void writeIntComment(std::ostringstream &s);
void setRegDU(byte regi, operDu du_in);
void invalidate();
void newCallHl();
@ -343,7 +343,7 @@ struct DU1
void setUnary(hlIcode op, COND_EXPR *exp);
void setJCond(COND_EXPR *cexp);
void emitGotoLabel(Int indLevel);
void copyDU(const ICODE &duIcode, operDu _du, operDu duDu);
void copyDU(const ICODE &duIcode, operDu _du, operDu duDu);
public:
boolT removeDefRegi(byte regi, Int thisDefIdx, LOCAL_ID *locId);
};

View File

@ -12,10 +12,6 @@ struct SYMTABLE
std::string pSymName; /* Ptr to symbolic name or comment */
dword symOff; /* Symbol image offset */
Function *symProc; /* Procedure pointer */
word preHash; /* Hash value before the modulo */
word postHash; /* Hash value after the modulo */
word nextOvf; /* Next entry this hash bucket, or -1 */
word prevOvf; /* Back link in Ovf chain */
SYMTABLE() : symOff(0),symProc(0) {}
SYMTABLE(dword _sym,Function *_proc) : symOff(_sym),symProc(_proc)
{}
@ -36,6 +32,6 @@ enum tableType /* The table types */
void createSymTables(void);
void destroySymTables(void);
boolT readVal (char *symName, dword symOff, Function *symProc);
boolT readVal (std::ostringstream &symName, dword symOff, Function *symProc);
void selectTable(tableType); /* Select a particular table */

View File

@ -58,6 +58,10 @@ typedef unsigned char boolT; /* 8 bits */
/* duVal FLAGS */
struct eDuVal
{
eDuVal()
{
def=use=val=0;
}
enum flgs
{
DEF=1,

View File

@ -14,7 +14,7 @@ def perform_test(exepath,filepath,outname)
filepath=path_local(filepath)
printf("calling:" + "#{exepath} -a1 -o#{output_path}.a1 #{filepath}\n")
result = `#{exepath} -a1 -o#{output_path}.a1 #{filepath}`
result = `#{exepath} -a2 -o#{output_path}.a2 #{filepath}`
result = `#{exepath} -a2msc -o#{output_path}.a2 #{filepath}`
puts result
p $?
end

View File

@ -151,10 +151,10 @@ COND_EXPR *COND_EXPR::idGlob (int16 segValue, int16 off)
newExp = newCondExp (IDENTIFIER);
newExp->expr.ident.idType = GLOB_VAR;
adr = opAdr(segValue, off);
for (i = 0; i < symtab.csym; i++)
if (symtab.sym[i].label == adr)
for (i = 0; i < symtab.size(); i++)
if (symtab[i].label == adr)
break;
if (i == symtab.csym)
if (i == symtab.size())
printf ("Error, glob var not found in symtab\n");
newExp->expr.ident.idNode.globIdx = i;
return (newExp);
@ -511,7 +511,7 @@ Int hlTypeSize (const COND_EXPR *expr, Function * pproc)
switch (expr->expr.ident.idType)
{
case GLOB_VAR:
return (symtab.sym[expr->expr.ident.idNode.globIdx].size);
return (symtab[expr->expr.ident.idNode.globIdx].size);
case REGISTER:
if (expr->expr.ident.regiType == BYTE_REG)
return (1);
@ -574,7 +574,7 @@ hlType expType (const COND_EXPR *expr, Function * pproc)
switch (expr->expr.ident.idType)
{
case GLOB_VAR:
return (symtab.sym[expr->expr.ident.idNode.globIdx].type);
return (symtab[expr->expr.ident.idNode.globIdx].type);
case REGISTER:
if (expr->expr.ident.regiType == BYTE_REG)
return (TYPE_BYTE_SIGN);
@ -734,7 +734,7 @@ string walkCondExpr (const COND_EXPR* expr, Function * pProc, Int* numLoc)
switch (expr->expr.ident.idType)
{
case GLOB_VAR:
o << symtab.sym[expr->expr.ident.idNode.globIdx].name;
o << symtab[expr->expr.ident.idNode.globIdx].name;
break;
case REGISTER:
id = &pProc->localId.id_arr[expr->expr.ident.idNode.regiIdx];

View File

@ -146,14 +146,14 @@ static void writeGlobSymTable()
char type[10];
SYM * pSym;
if (symtab.csym)
if (not symtab.empty())
{
cCode.appendDecl( "/* Global variables */\n");
for (idx = 0; idx < symtab.csym; idx++)
for (idx = 0; idx < symtab.size(); idx++)
{
pSym = &symtab.sym[idx];
if (symtab.sym[idx].duVal.isUSE_VAL()) /* first used */
printGlobVar (&(symtab.sym[idx]));
pSym = &symtab[idx];
if (symtab[idx].duVal.isUSE_VAL()) /* first used */
printGlobVar (&symtab[idx]);
else { /* first defined */
switch (pSym->size) {
case 1: strcpy (type, "byte\t"); break;

View File

@ -694,7 +694,7 @@ void STATE::checkStartup()
but decides the model required. Note: must do the far data models
(large and compact) before the others, since they are the same pattern
as near data, just more pushes at the start. */
if(prog.cbImage>0x180+sizeof(pattMainLarge))
if(prog.cbImage>startOff+0x180+sizeof(pattMainLarge))
{
if (locatePattern(prog.Image, startOff, startOff+0x180, pattMainLarge,sizeof(pattMainLarge), &i))
{

View File

@ -8,118 +8,121 @@
#include "dcc.h"
#include <string.h>
#include <sstream>
using namespace std;
#define intSize 40
static const char *int21h[] =
{"Terminate process",
"Character input with echo",
"Character output",
"Auxiliary input",
"Auxiliary output",
"Printer output",
"Direct console i/o",
"Unfiltered char i w/o echo",
"Character input without echo",
"Display string",
"Buffered keyboard input",
"Check input status",
"Flush input buffer and then input",
"Disk reset",
"Select disk",
"Open file",
"Close file",
"Find first file",
"Find next file",
"Delete file",
"Sequential read",
"Sequential write",
"Create file",
"Rename file",
"Reserved",
"Get current disk",
"Set DTA address",
"Get default drive data",
"Get drive data",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Random read",
"Random write",
"Get file size",
"Set relative record number",
"Set interrupt vector",
"Create new PSP",
"Random block read",
"Random block write",
"Parse filename",
"Get date",
"Set date",
"Get time",
"Set time",
"Set verify flag",
"Get DTA address",
"Get MSDOS version number",
"Terminate and stay resident",
"Reserved",
"Get or set break flag",
"Reserved",
"Get interrupt vector",
"Get drive allocation info",
"Reserved",
"Get or set country info",
"Create directory",
"Delete directory",
"Set current directory",
"Create file",
"Open file",
"Close file",
"Read file or device",
"Write file or device",
"Delete file",
"Set file pointer",
"Get or set file attributes",
"IOCTL (i/o control)",
"Duplicate handle",
"Redirect handle",
"Get current directory",
"Alloate memory block",
"Release memory block",
"Resize memory block",
"Execute program (exec)",
"Terminate process with return code",
"Get return code",
"Find first file",
"Find next file",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Get verify flag",
"Reserved",
"Rename file",
"Get or set file date & time",
"Get or set allocation strategy",
"Get extended error information",
"Create temporary file",
"Create new file",
"Lock or unlock file region",
"Reserved",
"Get machine name",
"Device redirection",
"Reserved",
"Reserved",
"Get PSP address",
"Get DBCS lead byte table",
"Reserved",
"Get extended country information",
"Get or set code page",
"Set handle count",
"Commit file",
"Reserved",
"Reserved",
"Reserved",
"Extended open file"
{
"Terminate process",
"Character input with echo",
"Character output",
"Auxiliary input",
"Auxiliary output",
"Printer output",
"Direct console i/o",
"Unfiltered char i w/o echo",
"Character input without echo",
"Display string",
"Buffered keyboard input",
"Check input status",
"Flush input buffer and then input",
"Disk reset",
"Select disk",
"Open file",
"Close file",
"Find first file",
"Find next file",
"Delete file",
"Sequential read",
"Sequential write",
"Create file",
"Rename file",
"Reserved",
"Get current disk",
"Set DTA address",
"Get default drive data",
"Get drive data",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Random read",
"Random write",
"Get file size",
"Set relative record number",
"Set interrupt vector",
"Create new PSP",
"Random block read",
"Random block write",
"Parse filename",
"Get date",
"Set date",
"Get time",
"Set time",
"Set verify flag",
"Get DTA address",
"Get MSDOS version number",
"Terminate and stay resident",
"Reserved",
"Get or set break flag",
"Reserved",
"Get interrupt vector",
"Get drive allocation info",
"Reserved",
"Get or set country info",
"Create directory",
"Delete directory",
"Set current directory",
"Create file",
"Open file",
"Close file",
"Read file or device",
"Write file or device",
"Delete file",
"Set file pointer",
"Get or set file attributes",
"IOCTL (i/o control)",
"Duplicate handle",
"Redirect handle",
"Get current directory",
"Alloate memory block",
"Release memory block",
"Resize memory block",
"Execute program (exec)",
"Terminate process with return code",
"Get return code",
"Find first file",
"Find next file",
"Reserved",
"Reserved",
"Reserved",
"Reserved",
"Get verify flag",
"Reserved",
"Rename file",
"Get or set file date & time",
"Get or set allocation strategy",
"Get extended error information",
"Create temporary file",
"Create new file",
"Lock or unlock file region",
"Reserved",
"Get machine name",
"Device redirection",
"Reserved",
"Reserved",
"Get PSP address",
"Get DBCS lead byte table",
"Reserved",
"Get extended country information",
"Get or set code page",
"Set handle count",
"Commit file",
"Reserved",
"Reserved",
"Reserved",
"Extended open file"
};
@ -144,33 +147,37 @@ static const char *intOthers[] = {
/* Writes the description of the current interrupt. Appends it to the
* string s. */
void ICODE::writeIntComment (char *s)
void ICODE::writeIntComment (std::ostringstream &s)
{
char *t;
t = (char *)allocMem(intSize * sizeof(char));
s<<"\t/* ";
if (ic.ll.immed.op == 0x21)
{ sprintf (t, "\t/* %s */\n", int21h[ic.ll.dst.off]);
strcat (s, t);
{
s <<int21h[ic.ll.dst.off];
}
else if (ic.ll.immed.op > 0x1F && ic.ll.immed.op < 0x2F)
{
sprintf (t, "\t/* %s */\n", intOthers[ic.ll.immed.op - 0x20]);
strcat (s, t);
s <<intOthers[ic.ll.immed.op - 0x20];
}
else if (ic.ll.immed.op == 0x2F)
{
switch (ic.ll.dst.off)
{
case 0x01 : strcat (s, "\t/* Print spooler */\n");
case 0x01 :
s << "Print spooler";
break;
case 0x02: strcat (s, "\t/* Assign */\n");
case 0x02:
s << "Assign";
break;
case 0x10: strcat (s, "\t/* Share */\n");
case 0x10:
s << "Share";
break;
case 0xB7: strcat (s, "\t/* Append */\n");
case 0xB7:
s << "Append";
}
}
else
strcat (s, "\n");
s<<"Unknown int";
s<<" */\n";
}
@ -247,7 +254,7 @@ void Function::writeProcComments()
if (this->flg & (PROC_BADINST | PROC_IJMP))
cCode.appendDecl(" * Incomplete due to an %s.\n",
(this->flg & PROC_BADINST)? "untranslated opcode":
"indirect JMP");
"indirect JMP");
if (this->flg & PROC_ICALL)
cCode.appendDecl(" * Indirect call procedure.\n");
if (this->flg & IMPURE)

View File

@ -56,14 +56,14 @@ int main(int argc, char *argv[])
* analysis, data flow etc. and outputs it to output file ready for
* re-compilation.
*/
BackEnd(option.filename, callGraph);
BackEnd(option.filename, callGraph);
callGraph->write();
callGraph->write();
if (option.Stats)
displayTotalStats();
if (option.Stats)
displayTotalStats();
/*
/*
freeDataStructures(pProcList);
*/
return 0;
@ -77,62 +77,64 @@ static char *initargs(int argc, char *argv[])
char *pc;
progname = *argv; /* Save invocation name for error messages */
while (--argc > 0 && (*++argv)[0] == '-') {
while (--argc > 0 && (*++argv)[0] == '-')
{
for (pc = argv[0]+1; *pc; pc++)
switch (*pc) {
case 'a': /* Print assembler listing */
if (*(pc+1) == '2')
option.asm2 = TRUE;
else
option.asm1 = TRUE;
if (*(pc+1) == '1' || *(pc+1) == '2')
pc++;
break;
case 'c':
option.Calls = TRUE;
break;
case 'i':
option.Interact = TRUE;
break;
case 'm': /* Print memory map */
option.Map = TRUE;
break;
case 's': /* Print Stats */
option.Stats = TRUE;
break;
case 'V': /* Very verbose => verbose */
option.VeryVerbose = TRUE;
case 'v': /* Make everything verbose */
option.verbose = TRUE;
break;
case 'o': /* assembler output file */
if (*(pc+1)) {
asm1_name = asm2_name = pc+1;
goto NextArg;
}
else if (--argc > 0) {
asm1_name = asm2_name = *++argv;
goto NextArg;
}
default:
fatalError(INVALID_ARG, *pc);
return *argv;
switch (*pc)
{
case 'a': /* Print assembler listing */
if (*(pc+1) == '2')
option.asm2 = TRUE;
else
option.asm1 = TRUE;
if (*(pc+1) == '1' || *(pc+1) == '2')
pc++;
break;
case 'c':
option.Calls = TRUE;
break;
case 'i':
option.Interact = TRUE;
break;
case 'm': /* Print memory map */
option.Map = TRUE;
break;
case 's': /* Print Stats */
option.Stats = TRUE;
break;
case 'V': /* Very verbose => verbose */
option.VeryVerbose = TRUE;
case 'v': /* Make everything verbose */
option.verbose = TRUE;
break;
case 'o': /* assembler output file */
if (*(pc+1)) {
asm1_name = asm2_name = pc+1;
goto NextArg;
}
else if (--argc > 0) {
asm1_name = asm2_name = *++argv;
goto NextArg;
}
default:
fatalError(INVALID_ARG, *pc);
return *argv;
}
NextArg:;
NextArg:;
}
if (argc == 1)
{
{
if (option.asm1 || option.asm2)
{
{
if (! asm1_name)
{
{
asm1_name = strcpy((char*)allocMem(strlen(*argv)+4), *argv);
pc = strrchr(asm1_name, '.');
if (pc > strrchr(asm1_name, '/'))
{
{
*pc = '\0';
}
}
asm2_name = (char*)allocMem(strlen(asm1_name)+4) ;
strcat(strcpy(asm2_name, asm1_name), ".a2");
unlink(asm2_name);
@ -141,7 +143,7 @@ static char *initargs(int argc, char *argv[])
unlink(asm1_name); /* Remove asm output files */
}
return *argv; /* filename of the program to decompile */
}
}
fatalError(USAGE);
return *argv;
@ -151,11 +153,11 @@ static void
displayTotalStats ()
/* Displays final statistics for the complete program */
{
printf ("\nFinal Program Statistics\n");
printf (" Total number of low-level Icodes : %ld\n", stats.totalLL);
printf (" Total number of high-level Icodes: %ld\n", stats.totalHL);
printf (" Total reduction of instructions : %2.2f%%\n", 100.0 -
(stats.totalHL * 100.0) / stats.totalLL);
printf ("\nFinal Program Statistics\n");
printf (" Total number of low-level Icodes : %ld\n", stats.totalLL);
printf (" Total number of high-level Icodes: %ld\n", stats.totalHL);
printf (" Total reduction of instructions : %2.2f%%\n", 100.0 -
(stats.totalHL * 100.0) / stats.totalLL);
}

View File

@ -9,6 +9,8 @@
#include <string.h>
#include <malloc.h> /* For free() */
#include <vector>
#include <sstream>
#include <iomanip>
#ifdef _CONSOLE
#include <windows.h> /* For console mode routines */
#endif
@ -122,24 +124,24 @@ static const char *szIndex[8] = {"bx+si", "bx+di", "bp+si", "bp+di", "si", "di",
static const char *szBreg[8] = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
static const char *szWreg[12] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
"es", "cs", "ss", "ds" };
static const char *szPtr[2] = { " word ptr ", " byte ptr " };
static const char *szPtr[2] = { "word ptr ", "byte ptr " };
static void dis1Line (Int i, Int pass);
void dis1LineOp(Int i, boolT fWin, char attr, word *len, Function * pProc);
static void formatRM(char *p, flags32 flg, ICODEMEM* pm);
static char *strDst(flags32 flg, ICODEMEM *pm);
static char *strSrc(ICODE * pc);
static void formatRM(ostringstream &p, flags32 flg, ICODEMEM* pm);
static ostringstream &strDst(ostringstream &os, flags32 flg, ICODEMEM *pm);
static ostringstream &strSrc(ostringstream &os, ICODE *pc, bool skip_comma=false);
static char *strHex(dword d);
static Int checkScanned(dword pcCur);
static void setProc(Function * proc);
static void dispData(word dataSeg);
static void flops(ICODE * pi);
void flops(ICODE *pIcode,std::ostringstream &out);
boolT callArg(word off, char *temp); /* Check for procedure name */
static FILE *fp;
static CIcodeRec pc;
static char buf[200], *p;
static std::ostringstream buf;
static Int cb, j, numIcode, allocIcode, eop;
static vector<int> pl;
static dword nextInst;
@ -192,7 +194,7 @@ void disassem(Int pass, Function * ppProc)
/* Open the output file (.a1 or .a2 only) */
if (pass != 3)
{
p = (pass == 1)? asm1_name: asm2_name;
auto p = (pass == 1)? asm1_name: asm2_name;
fp = fopen(p, "a+");
if (!fp)
{
@ -260,8 +262,12 @@ void disassem(Int pass, Function * ppProc)
****************************************************************************/
static void dis1Line(Int i, Int pass)
{
ostringstream oper_stream;
ostringstream hex_bytes;
ostringstream result_stream;
ICODE * pIcode = &pc[i];
oper_stream << uppercase;
hex_bytes << uppercase;
/* Disassembly stage 1 --
* Do not try to display NO_CODE entries or synthetic instructions,
* other than JMPs, that have been introduced for def/use analysis. */
@ -275,10 +281,6 @@ static void dis1Line(Int i, Int pass)
{
return;
}
/* p points to the current position in buf[] */
p = (char*)memset(buf, ' ', sizeof(buf));
if (pIcode->ic.ll.flg & (TARGET | CASE))
{
if (pass == 3)
@ -298,97 +300,91 @@ static void dis1Line(Int i, Int pass)
/* Output hexa code in program image */
if (pass != 3)
{
for (j = 0; j < cb; j++, p += 2)
sprintf(p, "%02X", prog.Image[pIcode->ic.ll.label + j]);
*p = ' ';
for (j = 0; j < cb; j++)
{
hex_bytes << hex << setw(2) << setfill('0') << uint16_t(prog.Image[pIcode->ic.ll.label + j]);
}
hex_bytes << ' ';
}
}
oper_stream << setw(POS_LAB) << left<< hex_bytes.str();
/* Check if there is a symbol here */
selectTable(Label);
if (readVal(&buf[POS_LAB], pIcode->ic.ll.label, 0))
oper_stream << setw(5)<<left; // align for the labels
{
buf[strlen(buf)] = ':'; /* Also removes the null */
}
else if (pIcode->ic.ll.flg & TARGET) /* Symbols override Lnn labels */
{ /* Print label */
if (! pl[i])
ostringstream lab_contents;
if (readVal(lab_contents, pIcode->ic.ll.label, 0))
{
pl[i] = ++lab;
lab_contents << ':'; /* Also removes the null */
}
if (pass == 3)
sprintf(buf, "L%ld", pl[i]);
else
sprintf(&buf[15], "L%ld", pl[i]);
buf[strlen(buf)] = ':'; /* Also removes the null */
else if (pIcode->ic.ll.flg & TARGET) /* Symbols override Lnn labels */
{
/* Print label */
if (! pl[i])
{
pl[i] = ++lab;
}
lab_contents<< "L"<<pl[i]<<':';
}
oper_stream<< lab_contents.str();
}
if (pIcode->ic.ll.opcode == iSIGNEX && (pIcode->ic.ll.flg & B))
{
pIcode->ic.ll.opcode = iCBW;
}
if (pass == 3)
{
strcpy (&buf[8], szOps[pIcode->ic.ll.opcode]);
buf[eop = strlen(buf)] = ' ';
p = buf + 8 + (POS_OPR - POS_OPC);
}
else
{
strcpy(&buf[POS_OPC], szOps[pIcode->ic.ll.opcode]);
buf[eop = strlen(buf)] = ' ';
p = buf + POS_OPR;
}
oper_stream << setw(15) << left <<szOps[pIcode->ic.ll.opcode];
switch (pIcode->ic.ll.opcode)
{
case iADD: case iADC: case iSUB: case iSBB: case iAND: case iOR:
case iXOR: case iTEST: case iCMP: case iMOV: case iLEA: case iXCHG:
strcpy(p, strDst(pIcode->ic.ll.flg, &pIcode->ic.ll.dst));
strcat(p, strSrc(pIcode));
strDst(oper_stream,pIcode->ic.ll.flg, &pIcode->ic.ll.dst);
strSrc(oper_stream,pIcode);
break;
case iESC:
flops(pIcode);
flops(pIcode,oper_stream);
break;
case iSAR: case iSHL: case iSHR: case iRCL: case iRCR: case iROL:
case iROR:
strcpy(p, strDst(pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst));
strcat(p, (pIcode->ic.ll.flg & I)? strSrc(pIcode): ", cl");
strDst(oper_stream,pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst);
if(pIcode->ic.ll.flg & I)
strSrc(oper_stream,pIcode);
else
oper_stream<<", cl";
break;
case iINC: case iDEC: case iNEG: case iNOT: case iPOP:
strcpy(p, strDst(pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst));
strDst(oper_stream,pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst);
break;
case iPUSH:
if (pIcode->ic.ll.flg & I)
{
strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
oper_stream<<strHex(pIcode->ic.ll.immed.op);
// strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
}
else
{
strcpy(p, strDst(pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst));
strDst(oper_stream,pIcode->ic.ll.flg | I, &pIcode->ic.ll.dst);
}
break;
case iDIV: case iIDIV: case iMUL: case iIMUL: case iMOD:
if (pIcode->ic.ll.flg & I)
{
strcat(strcpy(p, strDst(pIcode->ic.ll.flg, &pIcode->ic.ll.dst)),", ");
formatRM(p + strlen(p), pIcode->ic.ll.flg, &pIcode->ic.ll.src);
strcat(p, strSrc(pIcode));
strDst(oper_stream,pIcode->ic.ll.flg, &pIcode->ic.ll.dst) <<", ";
formatRM(oper_stream, pIcode->ic.ll.flg, &pIcode->ic.ll.src);
strSrc(oper_stream,pIcode);
}
else
strcpy(p, strDst(pIcode->ic.ll.flg | I, &pIcode->ic.ll.src));
strDst(oper_stream,pIcode->ic.ll.flg | I, &pIcode->ic.ll.src);
break;
case iLDS: case iLES: case iBOUND:
strcpy(p, strDst(pIcode->ic.ll.flg, &pIcode->ic.ll.dst));
strcat(strcat(p, ", dword ptr"), strSrc(pIcode)+1);
strDst(oper_stream,pIcode->ic.ll.flg, &pIcode->ic.ll.dst)<<", dword ptr";
strSrc(oper_stream,pIcode,true);
break;
case iJB: case iJBE: case iJAE: case iJA:
@ -401,14 +397,15 @@ static void dis1Line(Int i, Int pass)
/* Check if there is a symbol here */
selectTable(Label);
if ((pIcode->ic.ll.immed.op < (dword)numIcode) && /* Ensure in range */
readVal(p+WID_PTR, pc[pIcode->ic.ll.immed.op].ic.ll.label, 0))
readVal(oper_stream, pc[pIcode->ic.ll.immed.op].ic.ll.label, 0))
{
break; /* Symbolic label. Done */
}
if (pIcode->ic.ll.flg & NO_LABEL)
{
strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
//strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
oper_stream<<strHex(pIcode->ic.ll.immed.op);
}
else if (pIcode->ic.ll.flg & I)
{
@ -419,51 +416,48 @@ static void dis1Line(Int i, Int pass)
}
if (pIcode->ic.ll.opcode == iJMPF)
{
sprintf(p, " far ptr L%ld", pl[j]);
}
else
{
sprintf(p + WID_PTR, "L%ld", pl[j]);
oper_stream<<" far ptr ";
}
oper_stream<<"L"<<pl[j];
}
else if (pIcode->ic.ll.opcode == iJMPF)
{
strcat(strcpy(p-1, "dword ptr"), strSrc(pIcode)+1);
oper_stream<<"dword ptr";
strSrc(oper_stream,pIcode,true);
}
else
{
strcpy(p, strDst(I, &pIcode->ic.ll.src));
strDst(oper_stream,I, &pIcode->ic.ll.src);
}
break;
case iCALL: case iCALLF:
if (pIcode->ic.ll.flg & I)
{
sprintf(p, "%s ptr %s",(pIcode->ic.ll.opcode == iCALL) ?" near":" far",(pIcode->ic.ll.immed.proc.proc)->name);
if((pIcode->ic.ll.opcode == iCALL))
oper_stream<< "near";
else
oper_stream<< " far";
oper_stream<<" ptr "<<(pIcode->ic.ll.immed.proc.proc)->name;
}
else if (pIcode->ic.ll.opcode == iCALLF)
{
strcat(strcpy(p, "dword ptr"),strSrc(pIcode)+1);
oper_stream<<"dword ptr ";
strSrc(oper_stream,pIcode,true);
}
else
{
strcpy(p, strDst(I, &pIcode->ic.ll.src));
}
strDst(oper_stream,I, &pIcode->ic.ll.src);
break;
case iENTER:
strcat(strcpy(p + WID_PTR, strHex(pIcode->ic.ll.dst.off)), ", ");
strcat(p, strHex(pIcode->ic.ll.immed.op));
oper_stream<<strHex(pIcode->ic.ll.dst.off)<<", ";
oper_stream<<strHex(pIcode->ic.ll.immed.op);
break;
case iRET: case iRETF: case iINT:
if (pIcode->ic.ll.flg & I)
{
strcpy(p + WID_PTR, strHex(pIcode->ic.ll.immed.op));
}
else
{
buf[eop] = '\0';
oper_stream<<strHex(pIcode->ic.ll.immed.op);
}
break;
@ -476,46 +470,47 @@ static void dis1Line(Int i, Int pass)
case iOUTS: case iREP_OUTS:
if (pIcode->ic.ll.src.segOver)
{
(pIcode->ic.ll.opcode == iOUTS || pIcode->ic.ll.opcode == iREP_OUTS)
? strcat(strcpy(p+WID_PTR,"dx, "), szPtr[pIcode->ic.ll.flg & B])
: strcpy(&buf[eop+1], szPtr[pIcode->ic.ll.flg & B]);
bool is_dx_src=(pIcode->ic.ll.opcode == iOUTS || pIcode->ic.ll.opcode == iREP_OUTS);
if(is_dx_src)
oper_stream<<"dx, "<<szPtr[pIcode->ic.ll.flg & B];
else
oper_stream<<szPtr[pIcode->ic.ll.flg & B];
if (pIcode->ic.ll.opcode == iLODS ||
pIcode->ic.ll.opcode == iREP_LODS ||
pIcode->ic.ll.opcode == iOUTS ||
pIcode->ic.ll.opcode == iREP_OUTS)
{
strcat(p, szWreg[pIcode->ic.ll.src.segOver-rAX]);
oper_stream<<szWreg[pIcode->ic.ll.src.segOver-rAX];
}
else
{
strcat(strcat(p, "es:[di], "),szWreg[pIcode->ic.ll.src.segOver - rAX]);
oper_stream<<"es:[di], "<<szWreg[pIcode->ic.ll.src.segOver - rAX];
}
strcat(p, ":[si]");
oper_stream<<":[si]";
}
else strcpy(&buf[eop], (pIcode->ic.ll.flg & B)? "B": "W");
else
oper_stream<<(pIcode->ic.ll.flg & B)? "B": "W";
break;
case iXLAT:
if (pIcode->ic.ll.src.segOver)
{
strcpy(&buf[eop+1], szPtr[1]);
strcat(strcat(p, szWreg[pIcode->ic.ll.src.segOver-rAX]), ":[bx]");
oper_stream<<" "<<szPtr[1];
oper_stream<<szWreg[pIcode->ic.ll.src.segOver-rAX]<<":[bx]";
}
else buf[eop] = '\0';
break;
case iIN:
strcpy(p+WID_PTR, (pIcode->ic.ll.flg & B)?"al, ": "ax, ");
strcat(p+WID_PTR, (pIcode->ic.ll.flg & I)? strHex(pIcode->ic.ll.immed.op): "dx");
oper_stream<<(pIcode->ic.ll.flg & B)?"al, ": "ax, ";
oper_stream<<(pIcode->ic.ll.flg & I)? strHex(pIcode->ic.ll.immed.op): "dx";
break;
case iOUT:
strcpy(p+WID_PTR, (pIcode->ic.ll.flg & I)? strHex(pIcode->ic.ll.immed.op): "dx");
strcat(p+WID_PTR, (pIcode->ic.ll.flg & B)?", al": ", ax");
oper_stream<<(pIcode->ic.ll.flg & I)? strHex(pIcode->ic.ll.immed.op): "dx";
oper_stream<<(pIcode->ic.ll.flg & B)?", al": ", ax";
break;
default:
buf[eop] = '\0';
break;
}
@ -526,76 +521,73 @@ static void dis1Line(Int i, Int pass)
}
else
{
for (j = pIcode->ic.ll.label, fImpure = 0; j > 0 && j < (Int)nextInst;
j++)
for (j = pIcode->ic.ll.label, fImpure = 0; j > 0 && j < (Int)nextInst; j++)
{
fImpure |= BITMAP(j, BM_DATA);
}
}
result_stream << setw(54) << left << oper_stream.str();
/* Check for user supplied comment */
selectTable(Comment);
ostringstream cbuf;
if (readVal(cbuf, pIcode->ic.ll.label, 0))
{
buf[strlen(buf)] = ' '; /* Removes the null */
buf[POS_CMT] = ';';
strcpy(buf+POS_CMT+1, cbuf);
result_stream <<"; "<<cbuf.str();
}
else if (fImpure || (pIcode->ic.ll.flg & (SWITCH | CASE | SEG_IMMED |
IMPURE | SYNTHETIC | TERMINATES)))
else if (fImpure || (pIcode->ic.ll.flg & (SWITCH | CASE | SEG_IMMED | IMPURE | SYNTHETIC | TERMINATES)))
{
buf[strlen(buf)] = ' ';
buf[POS_CMT] = '\0';
if (pIcode->ic.ll.flg & CASE)
{
sprintf(buf+POS_CMT, ";Case l%ld", pIcode->ic.ll.caseTbl.numEntries);
result_stream << ";Case l"<< pIcode->ic.ll.caseTbl.numEntries;
}
if (pIcode->ic.ll.flg & SWITCH)
{
strcat(buf, ";Switch ");
result_stream << ";Switch ";
}
if (fImpure)
{
strcat(buf, ";Accessed as data ");
result_stream << ";Accessed as data ";
}
if (pIcode->ic.ll.flg & IMPURE)
{
strcat(buf, ";Impure operand ");
result_stream << ";Impure operand ";
}
if (pIcode->ic.ll.flg & SEG_IMMED)
{
strcat(buf, ";Segment constant");
result_stream << ";Segment constant";
}
if (pIcode->ic.ll.flg & TERMINATES)
{
strcat(buf, ";Exit to DOS");
result_stream << ";Exit to DOS";
}
}
/* Comment on iINT icodes */
if (pIcode->ic.ll.opcode == iINT)
pIcode->writeIntComment (buf);
pIcode->writeIntComment (result_stream);
/* Display output line */
if (! (pIcode->ic.ll.flg & SYNTHETIC))
if(pass==3)
{
/* output to .b code buffer */
if (pIcode->isLlFlag(SYNTHETIC))
result_stream<<";Synthetic inst";
if (pass == 3) /* output to .b code buffer */
cCode.appendCode("%s\n", buf);
else /* output to .a1 or .a2 file */
fprintf (fp, "%03ld %06lX %s\n", i, pIcode->ic.ll.label, buf);
cCode.appendCode("%s\n", result_stream.str().c_str());
}
else /* SYNTHETIC instruction */
else
{
strcat (buf, ";Synthetic inst");
if (pass == 3) /* output to .b code buffer */
if (! (pIcode->ic.ll.flg & SYNTHETIC))
{
cCode.appendCode("%s\n", buf);
/* output to .a1 or .a2 file */
fprintf (fp, "%03ld %06lX %s\n", i, pIcode->ic.ll.label, result_stream.str().c_str());
}
else /* output to .a1 or .a2 file */
else /* SYNTHETIC instruction */
{
fprintf (fp, "%03ld %s\n", i, buf);
result_stream<<";Synthetic inst";
fprintf (fp, "%03ld %s\n", i, result_stream.str().c_str());
}
}
}
@ -605,7 +597,7 @@ static void dis1Line(Int i, Int pass)
/****************************************************************************
* formatRM
***************************************************************************/
static void formatRM(char *p, flags32 flg, ICODEMEM *pm)
static void formatRM(std::ostringstream &p, flags32 flg, ICODEMEM *pm)
{
char seg[4];
@ -617,71 +609,68 @@ static void formatRM(char *p, flags32 flg, ICODEMEM *pm)
if (pm->regi == 0)
{
sprintf(p,"%s[%s]", seg, strHex((dword)pm->off));
p<<seg<<"["<<strHex((dword)pm->off)<<"]";
}
else if (pm->regi == (INDEXBASE - 1))
{
strcpy (p, "tmp");
p<<"tmp";
}
else if (pm->regi < INDEXBASE)
{
strcpy(p, (flg & B)? szBreg[pm->regi - rAL]: szWreg[pm->regi - rAX]);
if(flg & B)
p << szBreg[pm->regi - rAL];
else
p << szWreg[pm->regi - rAX];
}
else if (pm->off)
{
if (pm->off < 0)
{
sprintf(p,"%s[%s-%s]", seg, szIndex[pm->regi - INDEXBASE],strHex((dword)(- pm->off)));
p <<seg<<"["<<szIndex[pm->regi - INDEXBASE]<<"-"<<strHex((dword)(- pm->off))<<"]";
}
else
{
sprintf(p,"%s[%s+%s]", seg, szIndex[pm->regi - INDEXBASE],strHex((dword)pm->off));
p <<seg<<"["<<szIndex[pm->regi - INDEXBASE]<<"+"<<strHex((dword)(pm->off))<<"]";
}
}
else sprintf(p,"%s[%s]", seg, szIndex[pm->regi - INDEXBASE]);
else
p <<seg<<"["<<szIndex[pm->regi - INDEXBASE]<<"]";
}
/*****************************************************************************
* strDst
****************************************************************************/
static char *strDst(flags32 flg, ICODEMEM *pm)
static ostringstream & strDst(ostringstream &os,flags32 flg, ICODEMEM *pm)
{
static char buf[30];
/* Immediates to memory require size descriptor */
//os << setw(WID_PTR);
if ((flg & I) && (pm->regi == 0 || pm->regi >= INDEXBASE))
{
memcpy(buf, szPtr[flg & B], WID_PTR);
}
else
{
memset(buf, ' ', WID_PTR);
}
formatRM(buf + WID_PTR, flg, pm);
return buf;
os << szPtr[flg & B];
formatRM(os, flg, pm);
return os;
}
/****************************************************************************
* strSrc *
****************************************************************************/
static char *strSrc(ICODE *pc)
static ostringstream &strSrc(ostringstream &os,ICODE *pc,bool skip_comma)
{
static char buf[30] = {", "};
if(false==skip_comma)
os<<", ";
if (pc->ic.ll.flg & I)
strcpy(buf + 2, strHex(pc->ic.ll.immed.op));
os<<strHex(pc->ic.ll.immed.op);
else if (pc->ic.ll.flg & IM_SRC) /* level 2 */
strcpy (buf + 2, "dx:ax");
os<<"dx:ax";
else
formatRM(buf + 2, pc->ic.ll.flg, &pc->ic.ll.src);
formatRM(os, pc->ic.ll.flg, &pc->ic.ll.src);
return buf;
return os;
}
@ -707,7 +696,7 @@ void interactDis(Function * initProc, Int initIC)
}
/* Handle the floating point opcodes (icode iESC) */
static void flops(ICODE *pIcode)
void flops(ICODE *pIcode,std::ostringstream &out)
{
char bf[30];
byte op = (byte)pIcode->ic.ll.immed.op;
@ -717,11 +706,9 @@ static void flops(ICODE *pIcode)
if ((pIcode->ic.ll.dst.regi == 0) || (pIcode->ic.ll.dst.regi >= INDEXBASE))
{
/* The mod/rm mod bits are not set to 11 (i.e. register).
This is the normal floating point opcode */
strcpy(&buf[POS_OPC], szFlops1[op]);
buf[strlen(buf)] = ' ';
/* The mod/rm mod bits are not set to 11 (i.e. register). This is the normal floating point opcode */
out<<szFlops1[op]<<' ';
out <<setw(10);
if ((op == 0x29) || (op == 0x1F))
{
strcpy(bf, "tbyte ptr ");
@ -753,8 +740,7 @@ static void flops(ICODE *pIcode)
}
}
formatRM(bf + 10, pIcode->ic.ll.flg, &pIcode->ic.ll.dst);
strcpy(p, bf);
formatRM(out, pIcode->ic.ll.flg, &pIcode->ic.ll.dst);
}
else
{
@ -763,44 +749,44 @@ static void flops(ICODE *pIcode)
normal opcodes. Because the opcodes are slightly different for
this case (e.g. op=04 means FSUB if reg != 3, but FSUBR for
reg == 3), a separate table is used (szFlops2). */
switch (op)
{
case 0x0C:
strcpy(&buf[POS_OPC], szFlops0C[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops0C[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x0D:
strcpy(&buf[POS_OPC], szFlops0D[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops0D[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x0E:
strcpy(&buf[POS_OPC], szFlops0E[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops0E[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x0F:
strcpy(&buf[POS_OPC], szFlops0F[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops0F[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x15:
strcpy(&buf[POS_OPC], szFlops15[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops15[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x1C:
strcpy(&buf[POS_OPC], szFlops1C[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops1C[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x33:
strcpy(&buf[POS_OPC], szFlops33[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops33[pIcode->ic.ll.dst.regi - rAX];
break;
case 0x3C:
strcpy(&buf[POS_OPC], szFlops3C[pIcode->ic.ll.dst.regi - rAX]);
out << szFlops3C[pIcode->ic.ll.dst.regi - rAX];
break;
default:
strcpy(&buf[POS_OPC], szFlops2[op]);
buf[strlen(buf)] = ' ';
out << szFlops2[op];
if ((op >= 0x20) && (op <= 0x27))
{
/* This is the ST(i), ST form. */
sprintf(&buf[POS_OPR2], "ST(%d),ST", pIcode->ic.ll.dst.regi - rAX);
out << "ST("<<pIcode->ic.ll.dst.regi - rAX<<"),ST";
}
else
{
/* ST, ST(i) */
sprintf(&buf[POS_OPR2], "ST,ST(%d)", pIcode->ic.ll.dst.regi - rAX);
out << "ST,ST("<<pIcode->ic.ll.dst.regi - rAX;
}
break;

View File

@ -164,7 +164,7 @@ void Function::markImpure()
{
if (Icode.GetLlFlag(i) & (SYM_USE | SYM_DEF))
{
psym = &symtab.sym[Icode.GetIcode(i)->ic.ll.caseTbl.numEntries];
psym = &symtab[Icode.GetIcode(i)->ic.ll.caseTbl.numEntries];
for (int c = (Int)psym->label; c < (Int)psym->label+psym->size; c++)
{
if (BITMAP(c, BM_CODE))

View File

@ -90,12 +90,12 @@ void parse (CALL_GRAPH * *pcallGraph)
static void updateSymType (dword symbol, hlType symType, Int size)
{ Int i;
for (i = 0; i < symtab.csym; i++)
if (symtab.sym[i].label == symbol)
for (i = 0; i < symtab.size(); i++)
if (symtab[i].label == symbol)
{
symtab.sym[i].type = symType;
symtab[i].type = symType;
if (size != 0)
symtab.sym[i].size = size;
symtab[i].size = size;
break;
}
}
@ -691,35 +691,34 @@ static SYM * updateGlobSym (dword operand, Int size, word duFlag)
Int i;
/* Check for symbol in symbol table */
for (i = 0; i < symtab.csym; i++)
if (symtab.sym[i].label == operand) {
if (symtab.sym[i].size < size)
symtab.sym[i].size = size;
for (i = 0; i < symtab.size(); i++)
if (symtab[i].label == operand)
{
if (symtab[i].size < size)
symtab[i].size = size;
break;
}
/* New symbol, not in symbol table */
if (i == symtab.csym) {
if (++symtab.csym > symtab.alloc) {
symtab.alloc += 5;
symtab.sym = (SYM *)reallocVar(symtab.sym, symtab.alloc * sizeof(SYM));
memset (&symtab.sym[i], 0, 5 * sizeof(SYM));
}
sprintf (symtab.sym[i].name, "var%05lX", operand);
symtab.sym[i].label = operand;
symtab.sym[i].size = size;
symtab.sym[i].type = cbType[size];
if (i == symtab.size())
{
SYM v;
sprintf (v.name, "var%05lX", operand);
v.label = operand;
v.size = size;
v.type = cbType[size];
if (duFlag == eDuVal::USE) /* must already have init value */
{
symtab.sym[i].duVal.use =1; // USEVAL;
symtab.sym[i].duVal.val =1;
v.duVal.use =1; // USEVAL;
v.duVal.val =1;
}
else
{
symtab.sym[i].duVal.setFlags(duFlag);
v.duVal.setFlags(duFlag);
}
symtab.push_back(v);
}
return (&symtab.sym[i]);
return (&symtab[i]);
}
@ -792,11 +791,12 @@ static SYM * lookupAddr (ICODEMEM *pm, STATE *pstate, Int size, word duFlag)
else if (pstate->f[pm->seg]) { /* new value */
pm->segValue = pstate->r[pm->seg];
operand = opAdr(pm->segValue, pm->off);
i = symtab.csym;
i = symtab.size();
psym = updateGlobSym (operand, size, duFlag);
/* Flag new memory locations that are segment values */
if (symtab.csym > i) {
if (symtab.size() > i)
{
if (size == 4)
operand += 2; /* High word */
for (i = 0; i < prog.cReloc; i++)
@ -939,7 +939,7 @@ static void use (opLoc d, ICODE * pIcode, Function * pProc, STATE * pstate, Int
{
setBits (BM_DATA, psym->label, (dword)size);
pIcode->ic.ll.flg |= SYM_USE;
pIcode->ic.ll.caseTbl.numEntries = psym - symtab.sym;
pIcode->ic.ll.caseTbl.numEntries = psym - &symtab[0];
}
}
@ -988,7 +988,7 @@ static void def (opLoc d, ICODE * pIcode, Function * pProc, STATE * pstate, Int
{
setBits(BM_DATA, psym->label, (dword)size);
pIcode->ic.ll.flg |= SYM_DEF;
pIcode->ic.ll.caseTbl.numEntries = psym - symtab.sym;
pIcode->ic.ll.caseTbl.numEntries = psym - &symtab[0];
}
}

View File

@ -28,7 +28,7 @@
#include "symtab.h"
#define TABLESIZE 16 /* Number of entries added each expansion */
/* Probably has to be a power of 2 */
/* Probably has to be a power of 2 */
#define STRTABSIZE 256 /* Size string table is inc'd by */
#define NIL ((word)-1)
using namespace std;
@ -51,6 +51,10 @@ struct hash<SYMTABLE> : public unary_function<const SYMTABLE &,size_t>
static tableType curTableType; /* Which table is current */
struct TABLEINFO_TYPE
{
TABLEINFO_TYPE()
{
symTab=valTab=0;
}
void deleteVal(dword symOff, Function *symProc, boolT bSymToo);
void create(tableType type);
void destroy();
@ -75,21 +79,16 @@ void TABLEINFO_TYPE::create(tableType type)
case Comment:
numEntry = 0;
tableSize = TABLESIZE;
valTab = (SYMTABLE*)allocMem(sizeof(SYMTABLE) * TABLESIZE);
valTab = new SYMTABLE [TABLESIZE];
symTab = 0;
memset(valTab, 0, sizeof(SYMTABLE) * TABLESIZE);
break;
case Label:
currentTabInfo.numEntry = 0;
currentTabInfo.tableSize = TABLESIZE;
currentTabInfo.symTab = (SYMTABLE*)allocMem(sizeof(SYMTABLE) * TABLESIZE);
memset(currentTabInfo.symTab, 0, sizeof(SYMTABLE) * TABLESIZE);
currentTabInfo.valTab = (SYMTABLE*)allocMem(sizeof(SYMTABLE) * TABLESIZE);
memset(currentTabInfo.valTab, 0, sizeof(SYMTABLE) * TABLESIZE);
currentTabInfo.symTab = new SYMTABLE [TABLESIZE];
currentTabInfo.valTab = new SYMTABLE [TABLESIZE];
break;
}
}
void createSymTables(void)
@ -109,10 +108,6 @@ void createSymTables(void)
strTabNext = 0;
pStrTab = (char *)allocMem(STRTABSIZE);
// tableInfo[Label].symTab = currentTabInfo.symTab;
// tableInfo[Label].valTab = currentTabInfo.valTab;
// tableInfo[Label].numEntry = currentTabInfo.numEntry;
// tableInfo[Label].tableSize = currentTabInfo.tableSize;
curTableType = Label;
}
@ -126,11 +121,8 @@ void selectTable(tableType tt)
}
void TABLEINFO_TYPE::destroy()
{
if(symTab)
free(symTab); // The symbol hashed label table
if(valTab)
free(valTab); // And the value hashed label table
delete [] symTab; // The symbol hashed label table
delete [] valTab; // And the value hashed label table
}
void destroySymTables(void)
{
@ -141,7 +133,7 @@ void destroySymTables(void)
}
/* Using the value, read the symbolic name */
boolT readVal(char *symName, dword symOff, Function * symProc)
boolT readVal(std::ostringstream &symName, dword symOff, Function * symProc)
{
return false; // no symbolic names for now
}

View File

@ -9,16 +9,16 @@
proc_3 PROC NEAR
000 0002FF 55 PUSH bp
001 000300 8BEC MOV bp, sp
002 000302 E8F5FF CALL near ptr proc_4
003 000305 E8F2FF CALL near ptr proc_4
004 000308 E8EFFF CALL near ptr proc_4
005 00030B E8ECFF CALL near ptr proc_4
006 00030E E8E9FF CALL near ptr proc_4
007 000311 E8E6FF CALL near ptr proc_4
008 000314 E8E3FF CALL near ptr proc_4
009 000317 E8E0FF CALL near ptr proc_4
010 00031A E8DDFF CALL near ptr proc_4
011 00031D E8DAFF CALL near ptr proc_4
002 000302 E8F5FF CALL near ptr proc_4
003 000305 E8F2FF CALL near ptr proc_4
004 000308 E8EFFF CALL near ptr proc_4
005 00030B E8ECFF CALL near ptr proc_4
006 00030E E8E9FF CALL near ptr proc_4
007 000311 E8E6FF CALL near ptr proc_4
008 000314 E8E3FF CALL near ptr proc_4
009 000317 E8E0FF CALL near ptr proc_4
010 00031A E8DDFF CALL near ptr proc_4
011 00031D E8DAFF CALL near ptr proc_4
012 000320 5D POP bp
013 000321 C3 RET
@ -27,16 +27,16 @@
proc_2 PROC NEAR
000 000322 55 PUSH bp
001 000323 8BEC MOV bp, sp
002 000325 E8D7FF CALL near ptr proc_3
003 000328 E8D4FF CALL near ptr proc_3
004 00032B E8D1FF CALL near ptr proc_3
005 00032E E8CEFF CALL near ptr proc_3
006 000331 E8CBFF CALL near ptr proc_3
007 000334 E8C8FF CALL near ptr proc_3
008 000337 E8C5FF CALL near ptr proc_3
009 00033A E8C2FF CALL near ptr proc_3
010 00033D E8BFFF CALL near ptr proc_3
011 000340 E8BCFF CALL near ptr proc_3
002 000325 E8D7FF CALL near ptr proc_3
003 000328 E8D4FF CALL near ptr proc_3
004 00032B E8D1FF CALL near ptr proc_3
005 00032E E8CEFF CALL near ptr proc_3
006 000331 E8CBFF CALL near ptr proc_3
007 000334 E8C8FF CALL near ptr proc_3
008 000337 E8C5FF CALL near ptr proc_3
009 00033A E8C2FF CALL near ptr proc_3
010 00033D E8BFFF CALL near ptr proc_3
011 000340 E8BCFF CALL near ptr proc_3
012 000343 5D POP bp
013 000344 C3 RET
@ -45,15 +45,15 @@
proc_1 PROC NEAR
000 000345 55 PUSH bp
001 000346 8BEC MOV bp, sp
002 000348 E8D7FF CALL near ptr proc_2
003 00034B E8D4FF CALL near ptr proc_2
004 00034E E8D1FF CALL near ptr proc_2
005 000351 E8CEFF CALL near ptr proc_2
006 000354 E8CBFF CALL near ptr proc_2
007 000357 E8C8FF CALL near ptr proc_2
008 00035A E8C5FF CALL near ptr proc_2
009 00035D E8C2FF CALL near ptr proc_2
010 000360 E8BFFF CALL near ptr proc_2
002 000348 E8D7FF CALL near ptr proc_2
003 00034B E8D4FF CALL near ptr proc_2
004 00034E E8D1FF CALL near ptr proc_2
005 000351 E8CEFF CALL near ptr proc_2
006 000354 E8CBFF CALL near ptr proc_2
007 000357 E8C8FF CALL near ptr proc_2
008 00035A E8C5FF CALL near ptr proc_2
009 00035D E8C2FF CALL near ptr proc_2
010 000360 E8BFFF CALL near ptr proc_2
011 000363 5D POP bp
012 000364 C3 RET
@ -65,23 +65,23 @@
002 000368 83EC08 SUB sp, 8
003 00036B B89401 MOV ax, 194h
004 00036E 50 PUSH ax
005 00036F E8D90B CALL near ptr printf
005 00036F E8D90B CALL near ptr printf
006 000372 59 POP cx
007 000373 8D46FC LEA ax, [bp-4]
008 000376 50 PUSH ax
009 000377 B8B001 MOV ax, 1B0h
010 00037A 50 PUSH ax
011 00037B E85614 CALL near ptr scanf
011 00037B E85614 CALL near ptr scanf
012 00037E 59 POP cx
013 00037F 59 POP cx
014 000380 FF76FE PUSH word ptr [bp-2]
015 000383 FF76FC PUSH word ptr [bp-4]
014 000380 FF76FE PUSH word ptr [bp-2]
015 000383 FF76FC PUSH word ptr [bp-4]
016 000386 B8B401 MOV ax, 1B4h
017 000389 50 PUSH ax
018 00038A E8BE0B CALL near ptr printf
018 00038A E8BE0B CALL near ptr printf
019 00038D 83C406 ADD sp, 6
020 000390 C746FA0000 MOV word ptr [bp-6], 0
021 000395 C746F80100 MOV word ptr [bp-8], 1
020 000390 C746FA0000 MOV word ptr [bp-6], 0
021 000395 C746F80100 MOV word ptr [bp-8], 1
023 0003A7 8B56FA L1: MOV dx, [bp-6]
024 0003AA 8B46F8 MOV ax, [bp-8]
@ -93,15 +93,15 @@
030 0003B9 B8CE01 L3: MOV ax, 1CEh
031 0003BC 50 PUSH ax
032 0003BD E88B0B CALL near ptr printf
032 0003BD E88B0B CALL near ptr printf
033 0003C0 59 POP cx
034 0003C1 8BE5 MOV sp, bp
035 0003C3 5D POP bp
036 0003C4 C3 RET
037 00039C E8A6FF L2: CALL near ptr proc_1
038 00039F 8346F801 ADD word ptr [bp-8], 1
039 0003A3 8356FA00 ADC word ptr [bp-6], 0
037 00039C E8A6FF L2: CALL near ptr proc_1
038 00039F 8346F801 ADD word ptr [bp-8], 1
039 0003A3 8356FA00 ADC word ptr [bp-6], 0
040 JMP L1 ;Synthetic inst
main ENDP

View File

@ -91,41 +91,41 @@
004 000303 50 PUSH ax
005 000304 B89401 MOV ax, 194h
006 000307 50 PUSH ax
007 000308 E85D15 CALL near ptr scanf
007 000308 E85D15 CALL near ptr scanf
008 00030B 59 POP cx
009 00030C 59 POP cx
010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4]
010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4]
012 000313 B89801 MOV ax, 198h
013 000316 50 PUSH ax
014 000317 E8C50C CALL near ptr printf
014 000317 E8C50C CALL near ptr printf
015 00031A 83C406 ADD sp, 6
016 00031D 8D46EC LEA ax, [bp-14h]
017 000320 50 PUSH ax
018 000321 B8B201 MOV ax, 1B2h
019 000324 50 PUSH ax
020 000325 E84015 CALL near ptr scanf
020 000325 E84015 CALL near ptr scanf
021 000328 59 POP cx
022 000329 59 POP cx
023 00032A 8D46F0 LEA ax, [bp-10h]
024 00032D 50 PUSH ax
025 00032E B8B601 MOV ax, 1B6h
026 000331 50 PUSH ax
027 000332 E83315 CALL near ptr scanf
027 000332 E83315 CALL near ptr scanf
028 000335 59 POP cx
029 000336 59 POP cx
030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1
030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1
033 00042D 8B56FA L11: MOV dx, [bp-6]
034 000430 8B46F8 MOV ax, [bp-8]
035 000433 3B56FE CMP dx, [bp-2]
036 000436 7D03 JGE L12
038 000344 C746F60000 L13: MOV word ptr [bp-0Ah], 0
039 000349 C746F40100 MOV word ptr [bp-0Ch], 1
038 000344 C746F60000 L13: MOV word ptr [bp-0Ah], 0
039 000349 C746F40100 MOV word ptr [bp-0Ch], 1
041 000411 837EF600 L14: CMP word ptr [bp-0Ah], 0
041 000411 837EF600 L14: CMP word ptr [bp-0Ah], 0
042 000415 7D03 JGE L15
044 000351 8B56EE L16: MOV dx, [bp-12h]
@ -146,9 +146,9 @@
059 00037B B80A00 MOV ax, 0Ah
060 00037E 52 PUSH dx
061 00037F 50 PUSH ax
062 000380 FF76F2 PUSH word ptr [bp-0Eh]
063 000383 FF76F0 PUSH word ptr [bp-10h]
064 000386 9AEB1D1000 CALL far ptr LMOD@
062 000380 FF76F2 PUSH word ptr [bp-0Eh]
063 000383 FF76F0 PUSH word ptr [bp-10h]
064 000386 9AEB1D1000 CALL far ptr LMOD@
065 00038B 8956EE MOV [bp-12h], dx
066 00038E 8946EC MOV [bp-14h], ax
067 000391 8B56F2 MOV dx, [bp-0Eh]
@ -195,8 +195,8 @@
107 000402 99 L23: CWD
108 000403 8956EE MOV [bp-12h], dx
109 000406 8946EC MOV [bp-14h], ax
110 000409 8346F401 ADD word ptr [bp-0Ch], 1
111 00040D 8356F600 ADC word ptr [bp-0Ah], 0
110 000409 8346F401 ADD word ptr [bp-0Ch], 1
111 00040D 8356F600 ADC word ptr [bp-0Ah], 0
112 JMP L14 ;Synthetic inst
113 000400 33C0 L21: XOR ax, ax
@ -209,22 +209,22 @@
118 JMP L18 ;Synthetic inst
119 00041A 7F09 L15: JG L24
120 00041C 837EF428 CMP word ptr [bp-0Ch], 28h
120 00041C 837EF428 CMP word ptr [bp-0Ch], 28h
121 000420 7703 JA L24
123 000425 8346F801 L24: ADD word ptr [bp-8], 1
124 000429 8356FA00 ADC word ptr [bp-6], 0
123 000425 8346F801 L24: ADD word ptr [bp-8], 1
124 000429 8356FA00 ADC word ptr [bp-6], 0
125 JMP L11 ;Synthetic inst
126 00043B 7F08 L12: JG L25
127 00043D 3B46FC CMP ax, [bp-4]
128 000440 7703 JA L25
130 000445 FF76EE L25: PUSH word ptr [bp-12h]
131 000448 FF76EC PUSH word ptr [bp-14h]
130 000445 FF76EE L25: PUSH word ptr [bp-12h]
131 000448 FF76EC PUSH word ptr [bp-14h]
132 00044B B8BA01 MOV ax, 1BAh
133 00044E 50 PUSH ax
134 00044F E88D0B CALL near ptr printf
134 00044F E88D0B CALL near ptr printf
135 000452 83C406 ADD sp, 6
136 000455 8BE5 MOV sp, bp
137 000457 5D POP bp

View File

@ -14,87 +14,87 @@ long LMOD@ (long arg0, int arg2, int arg3)
* Pascal calling convention.
*/
{
MOV cx, 2
PUSH bp
PUSH si
PUSH di
MOV bp, sp
MOV di, cx
MOV ax, [bp+0Ah]
MOV dx, [bp+0Ch]
MOV bx, [bp+0Eh]
MOV cx, [bp+10h]
CMP cx, 0
JNE L1
OR dx, dx
JE L2
OR bx, bx
JE L2
MOV cx, 2
PUSH bp
PUSH si
PUSH di
MOV bp, sp
MOV di, cx
MOV ax, [bp+0Ah]
MOV dx, [bp+0Ch]
MOV bx, [bp+0Eh]
MOV cx, [bp+10h]
CMP cx, 0
JNE L1
OR dx, dx
JE L2
OR bx, bx
JE L2
L1: TEST di, 1
JNE L3
OR dx, dx
JNS L4
NEG dx
NEG ax
SBB dx, 0
OR di, 0Ch
L1: TEST di, 1
JNE L3
OR dx, dx
JNS L4
NEG dx
NEG ax
SBB dx, 0
OR di, 0Ch
L4: OR cx, cx
JNS L3
NEG cx
NEG bx
SBB cx, 0
XOR di, 4
L4: OR cx, cx
JNS L3
NEG cx
NEG bx
SBB cx, 0
XOR di, 4
L3: MOV bp, cx
MOV cx, 20h
PUSH di
XOR di, 0
XOR si, 0
L3: MOV bp, cx
MOV cx, 20h
PUSH di
XOR di, 0
XOR si, 0
L5: SHL ax, 1
RCL dx, 1
RCL si, 1
RCL di, 1
CMP di, bp
JB L6
JA L7
CMP si, bx
JB L6
L5: SHL ax, 1
RCL dx, 1
RCL si, 1
RCL di, 1
CMP di, bp
JB L6
JA L7
CMP si, bx
JB L6
L7: SUB si, bx
SBB di, bp
INC ax
L7: SUB si, bx
SBB di, bp
INC ax
L6: LOOP L5
POP bx
TEST bx, 2
JE L8
MOV ax, si
MOV dx, di
SHR bx, 1
L6: LOOP L5
POP bx
TEST bx, 2
JE L8
MOV ax, si
MOV dx, di
SHR bx, 1
L8: TEST bx, 4
JE L9
NEG dx
NEG ax
SBB dx, 0
L8: TEST bx, 4
JE L9
NEG dx
NEG ax
SBB dx, 0
L9: POP di
POP si
POP bp
RETF 8
L9: POP di
POP si
POP bp
RETF 8
L2: MOV tmp, dx:ax ;Synthetic inst
DIV bx
MOD bx ;Synthetic inst
TEST di, 2
JE L10
MOV ax, dx
L2: MOV tmp, dx:ax ;Synthetic inst
DIV bx
MOD bx ;Synthetic inst
TEST di, 2
JE L10
MOV ax, dx
L10: XOR dx, dx
JMP L9
L10: XOR dx, dx
JMP L9
}

View File

@ -5,37 +5,37 @@
003 000300 56 PUSH si
004 000301 B89401 MOV ax, 194h
005 000304 50 PUSH ax
006 000305 E8530C CALL near ptr printf
006 000305 E8530C CALL near ptr printf
007 000308 59 POP cx
008 000309 8D46FC LEA ax, [bp-4]
009 00030C 50 PUSH ax
010 00030D B8B001 MOV ax, 1B0h
011 000310 50 PUSH ax
012 000311 E8D014 CALL near ptr scanf
012 000311 E8D014 CALL near ptr scanf
013 000314 59 POP cx
014 000315 59 POP cx
015 000316 FF76FE PUSH word ptr [bp-2]
016 000319 FF76FC PUSH word ptr [bp-4]
015 000316 FF76FE PUSH word ptr [bp-2]
016 000319 FF76FC PUSH word ptr [bp-4]
017 00031C B8B401 MOV ax, 1B4h
018 00031F 50 PUSH ax
019 000320 E8380C CALL near ptr printf
019 000320 E8380C CALL near ptr printf
020 000323 83C406 ADD sp, 6
021 000326 8D46F4 LEA ax, [bp-0Ch]
022 000329 50 PUSH ax
023 00032A B8CE01 MOV ax, 1CEh
024 00032D 50 PUSH ax
025 00032E E8B314 CALL near ptr scanf
025 00032E E8B314 CALL near ptr scanf
026 000331 59 POP cx
027 000332 59 POP cx
028 000333 8D46F6 LEA ax, [bp-0Ah]
029 000336 50 PUSH ax
030 000337 B8D101 MOV ax, 1D1h
031 00033A 50 PUSH ax
032 00033B E8A614 CALL near ptr scanf
032 00033B E8A614 CALL near ptr scanf
033 00033E 59 POP cx
034 00033F 59 POP cx
035 000340 C746FA0000 MOV word ptr [bp-6], 0
036 000345 C746F80100 MOV word ptr [bp-8], 1
035 000340 C746FA0000 MOV word ptr [bp-6], 0
036 000345 C746F80100 MOV word ptr [bp-8], 1
038 0003B2 8B56FA L1: MOV dx, [bp-6]
039 0003B5 8B46F8 MOV ax, [bp-8]
@ -45,10 +45,10 @@
043 0003BF 3B46FC CMP ax, [bp-4]
044 0003C2 7688 JBE L2
045 0003C4 FF76F4 L3: PUSH word ptr [bp-0Ch]
045 0003C4 FF76F4 L3: PUSH word ptr [bp-0Ch]
046 0003C7 B8D401 MOV ax, 1D4h
047 0003CA 50 PUSH ax
048 0003CB E88D0B CALL near ptr printf
048 0003CB E88D0B CALL near ptr printf
049 0003CE 59 POP cx
050 0003CF 59 POP cx
051 0003D0 5E POP si
@ -60,35 +60,35 @@
057 0003A5 83FE28 L4: CMP si, 28h
058 0003A8 7EA7 JLE L5
059 0003AA 8346F801 ADD word ptr [bp-8], 1
060 0003AE 8356FA00 ADC word ptr [bp-6], 0
059 0003AA 8346F801 ADD word ptr [bp-8], 1
060 0003AE 8356FA00 ADC word ptr [bp-6], 0
061 JMP L1 ;Synthetic inst
062 000351 8B46F4 L5: MOV ax, [bp-0Ch]
063 000354 F766F4 MUL word ptr [bp-0Ch]
064 000357 F766F4 MUL word ptr [bp-0Ch]
065 00035A F766F4 MUL word ptr [bp-0Ch]
066 00035D F766F4 MUL word ptr [bp-0Ch]
067 000360 F766F4 MUL word ptr [bp-0Ch]
068 000363 F766F4 MUL word ptr [bp-0Ch]
069 000366 F766F4 MUL word ptr [bp-0Ch]
070 000369 F766F4 MUL word ptr [bp-0Ch]
071 00036C F766F4 MUL word ptr [bp-0Ch]
072 00036F F766F4 MUL word ptr [bp-0Ch]
073 000372 F766F4 MUL word ptr [bp-0Ch]
074 000375 F766F4 MUL word ptr [bp-0Ch]
075 000378 F766F4 MUL word ptr [bp-0Ch]
076 00037B F766F4 MUL word ptr [bp-0Ch]
077 00037E F766F4 MUL word ptr [bp-0Ch]
078 000381 F766F4 MUL word ptr [bp-0Ch]
079 000384 F766F4 MUL word ptr [bp-0Ch]
080 000387 F766F4 MUL word ptr [bp-0Ch]
081 00038A F766F4 MUL word ptr [bp-0Ch]
082 00038D F766F4 MUL word ptr [bp-0Ch]
083 000390 F766F4 MUL word ptr [bp-0Ch]
084 000393 F766F4 MUL word ptr [bp-0Ch]
085 000396 F766F4 MUL word ptr [bp-0Ch]
086 000399 F766F4 MUL word ptr [bp-0Ch]
063 000354 F766F4 MUL word ptr [bp-0Ch]
064 000357 F766F4 MUL word ptr [bp-0Ch]
065 00035A F766F4 MUL word ptr [bp-0Ch]
066 00035D F766F4 MUL word ptr [bp-0Ch]
067 000360 F766F4 MUL word ptr [bp-0Ch]
068 000363 F766F4 MUL word ptr [bp-0Ch]
069 000366 F766F4 MUL word ptr [bp-0Ch]
070 000369 F766F4 MUL word ptr [bp-0Ch]
071 00036C F766F4 MUL word ptr [bp-0Ch]
072 00036F F766F4 MUL word ptr [bp-0Ch]
073 000372 F766F4 MUL word ptr [bp-0Ch]
074 000375 F766F4 MUL word ptr [bp-0Ch]
075 000378 F766F4 MUL word ptr [bp-0Ch]
076 00037B F766F4 MUL word ptr [bp-0Ch]
077 00037E F766F4 MUL word ptr [bp-0Ch]
078 000381 F766F4 MUL word ptr [bp-0Ch]
079 000384 F766F4 MUL word ptr [bp-0Ch]
080 000387 F766F4 MUL word ptr [bp-0Ch]
081 00038A F766F4 MUL word ptr [bp-0Ch]
082 00038D F766F4 MUL word ptr [bp-0Ch]
083 000390 F766F4 MUL word ptr [bp-0Ch]
084 000393 F766F4 MUL word ptr [bp-0Ch]
085 000396 F766F4 MUL word ptr [bp-0Ch]
086 000399 F766F4 MUL word ptr [bp-0Ch]
087 00039C BA0300 MOV dx, 3
088 00039F F7E2 MUL dx
089 0003A1 8946F4 MOV [bp-0Ch], ax

View File

@ -6,25 +6,25 @@
004 000301 57 PUSH di
005 000302 B8A801 MOV ax, 1A8h
006 000305 50 PUSH ax
007 000306 E8240C CALL near ptr printf
007 000306 E8240C CALL near ptr printf
008 000309 59 POP cx
009 00030A 8D46FC LEA ax, [bp-4]
010 00030D 50 PUSH ax
011 00030E B8C401 MOV ax, 1C4h
012 000311 50 PUSH ax
013 000312 E8A114 CALL near ptr scanf
013 000312 E8A114 CALL near ptr scanf
014 000315 59 POP cx
015 000316 59 POP cx
016 000317 FF76FE PUSH word ptr [bp-2]
017 00031A FF76FC PUSH word ptr [bp-4]
016 000317 FF76FE PUSH word ptr [bp-2]
017 00031A FF76FC PUSH word ptr [bp-4]
018 00031D B8C801 MOV ax, 1C8h
019 000320 50 PUSH ax
020 000321 E8090C CALL near ptr printf
020 000321 E8090C CALL near ptr printf
021 000324 83C406 ADD sp, 6
022 000327 BE1400 MOV si, 14h
023 00032A 8976F6 MOV [bp-0Ah], si
024 00032D C746FA0000 MOV word ptr [bp-6], 0
025 000332 C746F80100 MOV word ptr [bp-8], 1
024 00032D C746FA0000 MOV word ptr [bp-6], 0
025 000332 C746F80100 MOV word ptr [bp-8], 1
027 000385 8B56FA L1: MOV dx, [bp-6]
028 000388 8B46F8 MOV ax, [bp-8]
@ -37,7 +37,7 @@
034 000397 56 L3: PUSH si
035 000398 B8E201 MOV ax, 1E2h
036 00039B 50 PUSH ax
037 00039C E88E0B CALL near ptr printf
037 00039C E88E0B CALL near ptr printf
038 00039F 59 POP cx
039 0003A0 59 POP cx
040 0003A1 5F POP di
@ -50,8 +50,8 @@
047 000378 83FF28 L4: CMP di, 28h
048 00037B 7EC1 JLE L5
049 00037D 8346F801 ADD word ptr [bp-8], 1
050 000381 8356FA00 ADC word ptr [bp-6], 0
049 00037D 8346F801 ADD word ptr [bp-8], 1
050 000381 8356FA00 ADC word ptr [bp-6], 0
051 JMP L1 ;Synthetic inst
052 00033E 8BC6 L5: MOV ax, si

View File

@ -6,43 +6,43 @@
004 000303 50 PUSH ax
005 000304 B89401 MOV ax, 194h
006 000307 50 PUSH ax
007 000308 E8E914 CALL near ptr scanf
007 000308 E8E914 CALL near ptr scanf
008 00030B 59 POP cx
009 00030C 59 POP cx
010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4]
010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4]
012 000313 B89801 MOV ax, 198h
013 000316 50 PUSH ax
014 000317 E8510C CALL near ptr printf
014 000317 E8510C CALL near ptr printf
015 00031A 83C406 ADD sp, 6
016 00031D 8D46F2 LEA ax, [bp-0Eh]
017 000320 50 PUSH ax
018 000321 B8B201 MOV ax, 1B2h
019 000324 50 PUSH ax
020 000325 E8CC14 CALL near ptr scanf
020 000325 E8CC14 CALL near ptr scanf
021 000328 59 POP cx
022 000329 59 POP cx
023 00032A 8D46F4 LEA ax, [bp-0Ch]
024 00032D 50 PUSH ax
025 00032E B8B601 MOV ax, 1B6h
026 000331 50 PUSH ax
027 000332 E8BF14 CALL near ptr scanf
027 000332 E8BF14 CALL near ptr scanf
028 000335 59 POP cx
029 000336 59 POP cx
030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1
030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1
033 0003BD 8B56FA L1: MOV dx, [bp-6]
034 0003C0 8B46F8 MOV ax, [bp-8]
035 0003C3 3B56FE CMP dx, [bp-2]
036 0003C6 7D03 JGE L2
038 000344 C746F60100 L3: MOV word ptr [bp-0Ah], 1
038 000344 C746F60100 L3: MOV word ptr [bp-0Ah], 1
040 0003AF 837EF628 L4: CMP word ptr [bp-0Ah], 28h
040 0003AF 837EF628 L4: CMP word ptr [bp-0Ah], 28h
041 0003B3 7E96 JLE L5
042 0003B5 8346F801 ADD word ptr [bp-8], 1
043 0003B9 8356FA00 ADC word ptr [bp-6], 0
042 0003B5 8346F801 ADD word ptr [bp-8], 1
043 0003B9 8356FA00 ADC word ptr [bp-6], 0
044 JMP L1 ;Synthetic inst
045 00034B 8B46F2 L5: MOV ax, [bp-0Eh]
@ -82,7 +82,7 @@
079 0003A2 B80100 MOV ax, 1
081 0003A9 8946F2 L9: MOV [bp-0Eh], ax
082 0003AC FF46F6 INC word ptr [bp-0Ah]
082 0003AC FF46F6 INC word ptr [bp-0Ah]
083 JMP L4 ;Synthetic inst
084 0003A7 33C0 L8: XOR ax, ax
@ -95,10 +95,10 @@
089 0003CD 3B46FC CMP ax, [bp-4]
090 0003D0 7703 JA L10
092 0003D5 FF76F2 L10: PUSH word ptr [bp-0Eh]
092 0003D5 FF76F2 L10: PUSH word ptr [bp-0Eh]
093 0003D8 B8BA01 MOV ax, 1BAh
094 0003DB 50 PUSH ax
095 0003DC E88C0B CALL near ptr printf
095 0003DC E88C0B CALL near ptr printf
096 0003DF 59 POP cx
097 0003E0 59 POP cx
098 0003E1 8BE5 MOV sp, bp

View File

@ -2,8 +2,8 @@
000 0002FA 55 PUSH bp
001 0002FB 8BEC MOV bp, sp
002 0002FD 83EC02 SUB sp, 2
003 000300 C646FEFF MOV byte ptr [bp-2], 0FFh
004 000304 C646FF8F MOV byte ptr [bp-1], 8Fh
003 000300 C646FEFF MOV byte ptr [bp-2], 0FFh
004 000304 C646FF8F MOV byte ptr [bp-1], 8Fh
005 000308 8A46FE MOV al, [bp-2]
006 00030B 0246FF ADD al, [bp-1]
007 00030E 8846FF MOV [bp-1], al
@ -52,7 +52,7 @@
050 00036D 50 PUSH ax
051 00036E B89401 MOV ax, 194h
052 000371 50 PUSH ax
053 000372 E8AB06 CALL near ptr printf
053 000372 E8AB06 CALL near ptr printf
054 000375 83C406 ADD sp, 6
055 000378 8BE5 MOV sp, bp
056 00037A 5D POP bp

View File

@ -8,13 +8,13 @@
006 000367 8BC6 MOV ax, si
007 000369 48 DEC ax
008 00036A 50 PUSH ax
009 00036B E8EDFF CALL near ptr proc_1
009 00036B E8EDFF CALL near ptr proc_1
010 00036E 59 POP cx
011 00036F 50 PUSH ax
012 000370 8BC6 MOV ax, si
013 000372 05FEFF ADD ax, 0FFFEh
014 000375 50 PUSH ax
015 000376 E8E2FF CALL near ptr proc_1
015 000376 E8E2FF CALL near ptr proc_1
016 000379 59 POP cx
017 00037A 8BD0 MOV dx, ax
018 00037C 58 POP ax
@ -37,13 +37,13 @@
004 000301 57 PUSH di
005 000302 B89401 MOV ax, 194h
006 000305 50 PUSH ax
007 000306 E8080C CALL near ptr printf
007 000306 E8080C CALL near ptr printf
008 000309 59 POP cx
009 00030A 8D46FC LEA ax, [bp-4]
010 00030D 50 PUSH ax
011 00030E B8B101 MOV ax, 1B1h
012 000311 50 PUSH ax
013 000312 E88514 CALL near ptr scanf
013 000312 E88514 CALL near ptr scanf
014 000315 59 POP cx
015 000316 59 POP cx
016 000317 BE0100 MOV si, 1
@ -52,7 +52,7 @@
019 00034C 7ECE JLE L4
020 00034E 33C0 XOR ax, ax
021 000350 50 PUSH ax
022 000351 E87300 CALL near ptr exit
022 000351 E87300 CALL near ptr exit
023 000354 59 POP cx
024 000355 5F POP di
025 000356 5E POP si
@ -62,24 +62,24 @@
029 00031C B8B401 L4: MOV ax, 1B4h
030 00031F 50 PUSH ax
031 000320 E8EE0B CALL near ptr printf
031 000320 E8EE0B CALL near ptr printf
032 000323 59 POP cx
033 000324 8D46FE LEA ax, [bp-2]
034 000327 50 PUSH ax
035 000328 B8C301 MOV ax, 1C3h
036 00032B 50 PUSH ax
037 00032C E86B14 CALL near ptr scanf
037 00032C E86B14 CALL near ptr scanf
038 00032F 59 POP cx
039 000330 59 POP cx
040 000331 FF76FE PUSH word ptr [bp-2]
041 000334 E82400 CALL near ptr proc_1
040 000331 FF76FE PUSH word ptr [bp-2]
041 000334 E82400 CALL near ptr proc_1
042 000337 59 POP cx
043 000338 8BF8 MOV di, ax
044 00033A 57 PUSH di
045 00033B FF76FE PUSH word ptr [bp-2]
045 00033B FF76FE PUSH word ptr [bp-2]
046 00033E B8C601 MOV ax, 1C6h
047 000341 50 PUSH ax
048 000342 E8CC0B CALL near ptr printf
048 000342 E8CC0B CALL near ptr printf
049 000345 83C406 ADD sp, 6
050 000348 46 INC si
051 JMP L3 ;Synthetic inst

View File

@ -2,13 +2,13 @@
000 000100 55 PUSH bp
001 000101 8BEC MOV bp, sp
002 000103 83EC02 SUB sp, 2
003 000106 C746FE0000 MOV word ptr [bp-2], 0
003 000106 C746FE0000 MOV word ptr [bp-2], 0
004 00010B 8B46FE MOV ax, [bp-2]
005 00010E 3D0600 CMP ax, 6
006 000111 7735 JA L1
007 000113 8BD8 MOV bx, ax
008 000115 D1E3 SHL bx, 1
009 000117 2EFFA71C00 JMP word ptr cs:[bx+1Ch] ;Switch
009 000117 2EFFA71C00 JMP word ptr cs:[bx+1Ch];Switch
010 00012A B80200 MOV ax, 2 ;Case l0