moving on

This commit is contained in:
Artur K 2012-02-22 11:17:54 +01:00
parent fa2eac979d
commit ed6f24a79a
29 changed files with 1662 additions and 1656 deletions

View File

@ -83,7 +83,9 @@ public:
public: public:
static Function *Create(void *ty=0,int Linkage=0,const std::string &nm="",void *module=0) static Function *Create(void *ty=0,int Linkage=0,const std::string &nm="",void *module=0)
{ {
return new Function(ty); Function *r=new Function(ty);
strncpy(r->name,nm.c_str(),SYMLEN);
return r;
} }
void compoundCond(); void compoundCond();
void writeProcComments(); void writeProcComments();

View File

@ -194,13 +194,7 @@ Int hlTypeSize (const COND_EXPR *, Function *);
hlType expType (const COND_EXPR *, Function *); hlType expType (const COND_EXPR *, Function *);
boolT insertSubTreeReg (COND_EXPR *, COND_EXPR **, byte, LOCAL_ID *); boolT insertSubTreeReg (COND_EXPR *, COND_EXPR **, byte, LOCAL_ID *);
boolT insertSubTreeLongReg (COND_EXPR *, COND_EXPR **, Int); boolT insertSubTreeLongReg (COND_EXPR *, COND_EXPR **, Int);
//COND_EXPR *concatExps (SEQ_COND_EXPR *, COND_EXPR *, condNodeType);
void initExpStk();
void pushExpStk (COND_EXPR *);
COND_EXPR *popExpStk();
Int numElemExpStk();
boolT emptyExpStk();
/* Exported functions from hlicode.c */ /* Exported functions from hlicode.c */
std::string writeCall (Function *, STKFRAME *, Function *, Int *); std::string writeCall (Function *, STKFRAME *, Function *, Int *);

View File

@ -6,16 +6,8 @@
/* High level icodes opcodes - def in file icode.h */ /* High level icodes opcodes - def in file icode.h */
/*typedef enum { struct HLICODE
HLI_ASSIGN, {
INC,
DEC,
HLI_JCOND,
} hlIcode; */
typedef struct {
hlIcode opcode; /* hlIcode opcode */ hlIcode opcode; /* hlIcode opcode */
union { /* different operands */ union { /* different operands */
struct { struct {
@ -25,12 +17,4 @@ typedef struct {
COND_EXPR *exp; /* for HLI_JCOND, INC, DEC */ COND_EXPR *exp; /* for HLI_JCOND, INC, DEC */
} oper; /* operand */ } oper; /* operand */
boolT valid; /* has a valid hlIcode */ boolT valid; /* has a valid hlIcode */
} HLICODE; };
//typedef struct {
// Int numIcodes; /* No. of hlIcode reocrds written */
// Int numAlloc; /* No. of hlIcode records allocated */
// HLICODE *hlIcode; /* Array of high-level icodes */
//} HLICODEREC;

View File

@ -293,8 +293,8 @@ struct LLTYPE
union { /* Source operand if (flg & I) */ union { /* Source operand if (flg & I) */
dword op; /* idx of immed src op */ dword op; /* idx of immed src op */
struct { /* Call & # actual arg bytes */ struct { /* Call & # actual arg bytes */
Function *proc; /* ^ target proc (for CALL(F))*/ Function *proc; /* pointer to target proc (for CALL(F))*/
Int cb; /* # actual arg bytes */ int cb; /* # actual arg bytes */
} proc; } proc;
} immed; } immed;
DU flagDU; /* def/use of flags */ DU flagDU; /* def/use of flags */
@ -312,12 +312,12 @@ struct LLTYPE
/* Icode definition: LOW_LEVEL and HIGH_LEVEL */ /* Icode definition: LOW_LEVEL and HIGH_LEVEL */
struct ICODE struct ICODE
{ {
struct DU1 struct DU1
{ {
Int numRegsDef; /* # registers defined by this inst */ Int numRegsDef; /* # registers defined by this inst */
byte regi[MAX_REGS_DEF]; /* registers defined by this inst */ byte regi[MAX_REGS_DEF]; /* registers defined by this inst */
Int idx[MAX_REGS_DEF][MAX_USES]; /* inst that uses this def */ Int idx[MAX_REGS_DEF][MAX_USES]; /* inst that uses this def */
}; };
icodeType type; /* Icode type */ icodeType type; /* Icode type */
boolT invalid; /* Has no HIGH_LEVEL equivalent */ boolT invalid; /* Has no HIGH_LEVEL equivalent */
BB *inBB; /* BB to which this icode belongs */ BB *inBB; /* BB to which this icode belongs */
@ -351,6 +351,7 @@ struct DU1
void copyDU(const ICODE &duIcode, operDu _du, operDu duDu); void copyDU(const ICODE &duIcode, operDu _du, operDu duDu);
public: public:
boolT removeDefRegi(byte regi, Int thisDefIdx, LOCAL_ID *locId); boolT removeDefRegi(byte regi, Int thisDefIdx, LOCAL_ID *locId);
void checkHlCall();
}; };
// This is the icode array object. // This is the icode array object.

View File

@ -29,9 +29,6 @@ static const char *condOpSym[] = { " <= ", " < ", " == ", " != ", " > ", " >= ",
// COND_EXPR *exp; // COND_EXPR *exp;
// struct _EXP_STK *next; // struct _EXP_STK *next;
//} EXP_STK; //} EXP_STK;
typedef std::list<COND_EXPR *> EXP_STK;
static EXP_STK expStk; /* local expression stack */
/* Returns the integer i in C hexadecimal format */ /* Returns the integer i in C hexadecimal format */
static char *hexStr (uint16_t i) static char *hexStr (uint16_t i)
@ -950,47 +947,3 @@ void COND_EXPR::release()
} }
delete (this); delete (this);
} }
/***************************************************************************
* Expression stack functions
**************************************************************************/
/* Reinitalizes the expression stack (expStk) to NULL, by freeing all the
* space allocated (if any). */
void initExpStk()
{
expStk.clear();
}
/* Pushes the given expression onto the local stack (expStk). */
void pushExpStk (COND_EXPR *expr)
{
expStk.push_back(expr);
}
/* Returns the element on the top of the local expression stack (expStk),
* and deallocates the space allocated by this node.
* If there are no elements on the stack, returns NULL. */
COND_EXPR *popExpStk()
{
if(expStk.empty())
return 0;
COND_EXPR *topExp = expStk.back();
expStk.pop_back();
return topExp;
}
/* Returns the number of elements available in the expression stack */
Int numElemExpStk()
{
return expStk.size();
}
/* Returns whether the expression stack is empty or not */
boolT emptyExpStk()
{
return expStk.empty();
}

View File

@ -426,9 +426,6 @@ void
CleanupLibCheck(void) CleanupLibCheck(void)
{ {
/* Deallocate all the stuff allocated in SetupLibCheck() */ /* Deallocate all the stuff allocated in SetupLibCheck() */
if (T1base) free(T1base);
if (T1base) free(T2base);
if (g) free(g);
if (ht) free(ht); if (ht) free(ht);
if (pFunc)free(pFunc); if (pFunc)free(pFunc);
} }
@ -456,7 +453,7 @@ boolT LibCheck(Function & pProc)
{ {
/* Easy - this function is called main! */ /* Easy - this function is called main! */
strcpy(pProc.name, "main"); strcpy(pProc.name, "main");
return FALSE; return false;
} }
memmove(pat, &prog.Image[fileOffset], PATLEN); memmove(pat, &prog.Image[fileOffset], PATLEN);

View File

@ -7,8 +7,65 @@
#include "dcc.h" #include "dcc.h"
#include <string.h> #include <string.h>
#include <iostream>
#include <iomanip>
#include <stdio.h> #include <stdio.h>
struct ExpStack
{
typedef std::list<COND_EXPR *> EXP_STK;
EXP_STK expStk; /* local expression stack */
void init();
void push(COND_EXPR *);
COND_EXPR *pop();
Int numElem();
boolT empty();
};
/***************************************************************************
* Expression stack functions
**************************************************************************/
/* Reinitalizes the expression stack (expStk) to NULL, by freeing all the
* space allocated (if any). */
void ExpStack::init()
{
expStk.clear();
}
/* Pushes the given expression onto the local stack (expStk). */
void ExpStack::push(COND_EXPR *expr)
{
expStk.push_back(expr);
}
/* Returns the element on the top of the local expression stack (expStk),
* and deallocates the space allocated by this node.
* If there are no elements on the stack, returns NULL. */
COND_EXPR *ExpStack::pop()
{
if(expStk.empty())
return 0;
COND_EXPR *topExp = expStk.back();
expStk.pop_back();
return topExp;
}
/* Returns the number of elements available in the expression stack */
Int ExpStack::numElem()
{
return expStk.size();
}
/* Returns whether the expression stack is empty or not */
boolT ExpStack::empty()
{
return expStk.empty();
}
using namespace std;
ExpStack g_exp_stk;
/* Returns the index of the local variable or parameter at offset off, if it /* Returns the index of the local variable or parameter at offset off, if it
* is in the stack frame provided. */ * is in the stack frame provided. */
@ -114,13 +171,13 @@ void Function::elimCondCodes ()
default: default:
notSup = TRUE; notSup = TRUE;
std::cout << hex<<defAt->loc_ip;
reportError (JX_NOT_DEF, defAt->GetLlOpcode()); reportError (JX_NOT_DEF, defAt->GetLlOpcode());
flg |= PROC_ASM; /* generate asm */ flg |= PROC_ASM; /* generate asm */
} }
if (! notSup) if (! notSup)
{ {
exp = COND_EXPR::boolOp (lhs, rhs, exp = COND_EXPR::boolOp (lhs, rhs,condOpJCond[useAt->GetLlOpcode()-iJB]);
condOpJCond[useAt->GetLlOpcode()-iJB]);
useAt->setJCond(exp); useAt->setJCond(exp);
} }
} }
@ -602,7 +659,7 @@ static void processCArg (Function * pp, Function * pProc, ICODE * picode, Int nu
/* if (numArgs == 0) /* if (numArgs == 0)
return; */ return; */
exp = popExpStk(); exp = g_exp_stk.pop();
if (pp->flg & PROC_ISLIB) /* library function */ if (pp->flg & PROC_ISLIB) /* library function */
{ {
if (pp->args.numArgs > 0) if (pp->args.numArgs > 0)
@ -628,7 +685,6 @@ static void processCArg (Function * pp, Function * pProc, ICODE * picode, Int nu
*k += hlTypeSize (exp, pProc); *k += hlTypeSize (exp, pProc);
} }
/* Eliminates extraneous intermediate icode instructions when finding /* Eliminates extraneous intermediate icode instructions when finding
* expressions. Generates new hlIcodes in the form of expression trees. * expressions. Generates new hlIcodes in the form of expression trees.
* For HLI_CALL hlIcodes, places the arguments in the argument list. */ * For HLI_CALL hlIcodes, places the arguments in the argument list. */
@ -647,7 +703,7 @@ void Function::findExps()
ID *retVal; /* function return value */ ID *retVal; /* function return value */
/* Initialize expression stack */ /* Initialize expression stack */
initExpStk(); g_exp_stk.init();
/* Traverse tree in dfsLast order */ /* Traverse tree in dfsLast order */
for (i = 0; i < numBBs; i++) for (i = 0; i < numBBs; i++)
@ -726,7 +782,7 @@ void Function::findExps()
(ticode->ic.hl.opcode != HLI_RET))) (ticode->ic.hl.opcode != HLI_RET)))
continue; continue;
exp = popExpStk(); /* pop last exp pushed */ exp = g_exp_stk.pop(); /* pop last exp pushed */
switch (ticode->ic.hl.opcode) { switch (ticode->ic.hl.opcode) {
case HLI_ASSIGN: case HLI_ASSIGN:
forwardSubs (picode->ic.hl.oper.exp, exp, forwardSubs (picode->ic.hl.oper.exp, exp,
@ -866,7 +922,7 @@ void Function::findExps()
(ticode->ic.hl.opcode != HLI_RET))) (ticode->ic.hl.opcode != HLI_RET)))
continue; continue;
exp = popExpStk(); /* pop last exp pushed */ exp = g_exp_stk.pop(); /* pop last exp pushed */
switch (ticode->ic.hl.opcode) { switch (ticode->ic.hl.opcode) {
case HLI_ASSIGN: case HLI_ASSIGN:
forwardSubsLong (picode->ic.hl.oper.exp->expr.ident.idNode.longIdx, forwardSubsLong (picode->ic.hl.oper.exp->expr.ident.idNode.longIdx,
@ -945,7 +1001,7 @@ void Function::findExps()
* expression stack */ * expression stack */
else if (picode->ic.hl.opcode == HLI_PUSH) else if (picode->ic.hl.opcode == HLI_PUSH)
{ {
pushExpStk (picode->ic.hl.oper.exp); g_exp_stk.push(picode->ic.hl.oper.exp);
picode->invalidate(); picode->invalidate();
numHlIcodes--; numHlIcodes--;
} }
@ -965,7 +1021,7 @@ void Function::findExps()
cb = pp->cbParam; /* fixed # arguments */ cb = pp->cbParam; /* fixed # arguments */
for (k = 0, numArgs = 0; k < cb; numArgs++) for (k = 0, numArgs = 0; k < cb; numArgs++)
{ {
exp = popExpStk(); exp = g_exp_stk.pop();
if (pp->flg & PROC_ISLIB) /* library function */ if (pp->flg & PROC_ISLIB) /* library function */
{ {
if (pp->args.numArgs > 0) if (pp->args.numArgs > 0)
@ -990,7 +1046,7 @@ void Function::findExps()
for (k = 0; k < cb; numArgs++) for (k = 0; k < cb; numArgs++)
processCArg (pp, this, &(*picode), numArgs, &k); processCArg (pp, this, &(*picode), numArgs, &k);
else if ((cb == 0) && (picode->ic.ll.flg & REST_STK)) else if ((cb == 0) && (picode->ic.ll.flg & REST_STK))
while (! emptyExpStk()) while (! g_exp_stk.empty())
{ {
processCArg (pp, this, &(*picode), numArgs, &k); processCArg (pp, this, &(*picode), numArgs, &k);
numArgs++; numArgs++;

View File

@ -37,6 +37,10 @@ void ICODE::setAsgn(COND_EXPR *lhs, COND_EXPR *rhs)
ic.hl.oper.asgn.lhs = lhs; ic.hl.oper.asgn.lhs = lhs;
ic.hl.oper.asgn.rhs = rhs; ic.hl.oper.asgn.rhs = rhs;
} }
void ICODE::checkHlCall()
{
//assert((ic.ll.immed.proc.cb != 0)||ic.ll.immed.proc.proc!=0);
}
/* Places the new HLI_CALL high-level operand in the high-level icode array */ /* Places the new HLI_CALL high-level operand in the high-level icode array */
void ICODE::newCallHl() void ICODE::newCallHl()
{ {
@ -44,10 +48,16 @@ void ICODE::newCallHl()
ic.hl.opcode = HLI_CALL; ic.hl.opcode = HLI_CALL;
ic.hl.oper.call.proc = ic.ll.immed.proc.proc; ic.hl.oper.call.proc = ic.ll.immed.proc.proc;
ic.hl.oper.call.args = new STKFRAME; ic.hl.oper.call.args = new STKFRAME;
if (ic.ll.immed.proc.cb != 0) if (ic.ll.immed.proc.cb != 0)
ic.hl.oper.call.args->cb = ic.ll.immed.proc.cb; ic.hl.oper.call.args->cb = ic.ll.immed.proc.cb;
else else if(ic.hl.oper.call.proc)
ic.hl.oper.call.args->cb =ic.hl.oper.call.proc->cbParam; ic.hl.oper.call.args->cb =ic.hl.oper.call.proc->cbParam;
else
{
printf("Function with no cb set, and no valid oper.call.proc , probaby indirect call\n");
ic.hl.oper.call.args->cb = 0;
}
} }
@ -148,16 +158,20 @@ void Function::highLevelGen()
} }
switch (pIcode->ic.ll.opcode) { switch (pIcode->ic.ll.opcode) {
case iADD: rhs = COND_EXPR::boolOp (lhs, rhs, ADD); case iADD:
rhs = COND_EXPR::boolOp (lhs, rhs, ADD);
pIcode->setAsgn(lhs, rhs); pIcode->setAsgn(lhs, rhs);
break; break;
case iAND: rhs = COND_EXPR::boolOp (lhs, rhs, AND); case iAND:
rhs = COND_EXPR::boolOp (lhs, rhs, AND);
pIcode->setAsgn(lhs, rhs); pIcode->setAsgn(lhs, rhs);
break; break;
case iCALL: case iCALL:
case iCALLF: pIcode->newCallHl(); case iCALLF:
pIcode->checkHlCall();
pIcode->newCallHl();
break; break;
case iDEC: case iDEC:
@ -259,7 +273,8 @@ void Function::highLevelGen()
case iXCHG: case iXCHG:
break; break;
case iXOR: rhs = COND_EXPR::boolOp (lhs, rhs, XOR); case iXOR:
rhs = COND_EXPR::boolOp (lhs, rhs, XOR);
pIcode->setAsgn(lhs, rhs); pIcode->setAsgn(lhs, rhs);
break; break;
} }

View File

@ -64,6 +64,7 @@ void parse (CALL_GRAPH * *pcallGraph)
else else
{ {
/* Create initial procedure at program start address */ /* Create initial procedure at program start address */
strcpy(pProcList.front().name, "start");
pProcList.front().procEntry = (dword)state.IP; pProcList.front().procEntry = (dword)state.IP;
} }
/* The state info is for the first procedure */ /* The state info is for the first procedure */
@ -109,7 +110,7 @@ Int strSize (byte *sym, char delim)
for (i = 0; *sym++ != delim; i++) ; for (i = 0; *sym++ != delim; i++) ;
return (i+1); return (i+1);
} }
Function *fakeproc=Function::Create(0,0,"fake");
/* FollowCtrl - Given an initial procedure, state information and symbol table /* FollowCtrl - Given an initial procedure, state information and symbol table
* builds a list of procedures reachable from the initial procedure * builds a list of procedures reachable from the initial procedure
@ -513,6 +514,7 @@ boolT Function::process_JMP (ICODE * pIcode, STATE *pstate, CALL_GRAPH * pcallGr
* be assumed that if an assembler program contains a CALL that the * be assumed that if an assembler program contains a CALL that the
* programmer expected it to come back - otherwise surely a JMP would * programmer expected it to come back - otherwise surely a JMP would
* have been used. */ * have been used. */
boolT Function::process_CALL (ICODE * pIcode, CALL_GRAPH * pcallGraph, STATE *pstate) boolT Function::process_CALL (ICODE * pIcode, CALL_GRAPH * pcallGraph, STATE *pstate)
{ {
Int ip = Icode.GetNumIcodes() - 1; Int ip = Icode.GetNumIcodes() - 1;
@ -522,16 +524,17 @@ boolT Function::process_CALL (ICODE * pIcode, CALL_GRAPH * pcallGraph, STATE *ps
/* For Indirect Calls, find the function address */ /* For Indirect Calls, find the function address */
indirect = FALSE; indirect = FALSE;
if (! (pIcode->ic.ll.flg & I)) //pIcode->ic.ll.immed.proc.proc=fakeproc;
if ( not pIcode->isLlFlag(I) )
{ {
/* Not immediate, i.e. indirect call */ /* Not immediate, i.e. indirect call */
if (pIcode->ic.ll.dst.regi && (!option.Calls)) if (pIcode->ic.ll.dst.regi && (!option.Calls))
{ {
/* We have not set the brave option to attempt to follow /* We have not set the brave option to attempt to follow
the execution path through register indirect calls. the execution path through register indirect calls.
So we just exit this function, and ignore the call. So we just exit this function, and ignore the call.
We probably should not have parsed this deep, anyway. We probably should not have parsed this deep, anyway.
*/ */
return FALSE; return FALSE;
} }
@ -616,7 +619,8 @@ boolT Function::process_CALL (ICODE * pIcode, CALL_GRAPH * pcallGraph, STATE *ps
else else
pcallGraph->insertCallGraph (this, iter); pcallGraph->insertCallGraph (this, iter);
Icode.GetIcode(ip)->ic.ll.immed.proc.proc = &(*iter); // ^ target proc Icode[ip].ic.ll.immed.proc.proc = &(*iter); // ^ target proc
/* return ((p->flg & TERMINATES) != 0); */ /* return ((p->flg & TERMINATES) != 0); */
return FALSE; return FALSE;
} }
@ -905,8 +909,7 @@ dword duReg[] = { 0x00,
* pstate: ptr to current procedure state * pstate: ptr to current procedure state
* size : size of the operand * size : size of the operand
* ix : current index into icode array */ * ix : current index into icode array */
static void use (opLoc d, ICODE * pIcode, Function * pProc, STATE * pstate, Int size, static void use (opLoc d, ICODE * pIcode, Function * pProc, STATE * pstate, Int size, Int ix)
Int ix)
{ {
ICODEMEM * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst; ICODEMEM * pm = (d == SRC)? &pIcode->ic.ll.src: &pIcode->ic.ll.dst;
SYM * psym; SYM * psym;

View File

@ -380,109 +380,110 @@ void Function::propLongReg (Int i, ID *pLocId)
} }
/* If no definition backwards, check forward for a use of this long reg */ /* If no definition backwards, check forward for a use of this long reg */
if (idx <= 0) if (idx > 0)
for (idx = pLocId->idx[j] + 1; idx < this->Icode.GetNumIcodes() - 1; idx++) continue;
{ for (idx = pLocId->idx[j] + 1; idx < Icode.size() - 1; idx++)
pIcode = Icode.begin()+(idx); {
if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE)) pIcode = Icode.begin()+(idx);
continue; if ((pIcode->type == HIGH_LEVEL) || (pIcode->invalid == TRUE))
continue;
if (pIcode->ic.ll.opcode == (pIcode+1)->ic.ll.opcode) if (pIcode->ic.ll.opcode == (pIcode+1)->ic.ll.opcode)
switch (pIcode->ic.ll.opcode) { switch (pIcode->ic.ll.opcode) {
case iMOV: case iMOV:
if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) && if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId->id.longId.l == (pIcode+1)->ic.ll.src.regi)) (pLocId->id.longId.l == (pIcode+1)->ic.ll.src.regi))
{ {
rhs = COND_EXPR::idLongIdx (i); rhs = COND_EXPR::idLongIdx (i);
pIcode->setRegDU( (pIcode+1)->ic.ll.src.regi, eUSE); pIcode->setRegDU( (pIcode+1)->ic.ll.src.regi, eUSE);
lhs = COND_EXPR::idLong (&this->localId, DST, pIcode, lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,
HIGH_FIRST, idx, eDEF, 1); HIGH_FIRST, idx, eDEF, 1);
pIcode->setAsgn(lhs, rhs); pIcode->setAsgn(lhs, rhs);
(pIcode+1)->invalidate(); (pIcode+1)->invalidate();
idx = this->Icode.GetNumIcodes(); /* to exit the loop */ idx = this->Icode.GetNumIcodes(); /* to exit the loop */
} }
break; break;
case iPUSH: case iPUSH:
if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) && if ((pLocId->id.longId.h == pIcode->ic.ll.src.regi) &&
(pLocId->id.longId.l == (pIcode+1)->ic.ll.src.regi)) (pLocId->id.longId.l == (pIcode+1)->ic.ll.src.regi))
{ {
rhs = COND_EXPR::idLongIdx (i); rhs = COND_EXPR::idLongIdx (i);
pIcode->setRegDU( (pIcode+1)->ic.ll.src.regi, eUSE); pIcode->setRegDU( (pIcode+1)->ic.ll.src.regi, eUSE);
pIcode->setUnary(HLI_PUSH, lhs); pIcode->setUnary(HLI_PUSH, lhs);
(pIcode+1)->invalidate(); (pIcode+1)->invalidate();
} }
idx = this->Icode.GetNumIcodes(); /* to exit the loop */ idx = this->Icode.GetNumIcodes(); /* to exit the loop */
break; break;
/*** others missing ****/ /*** others missing ****/
case iAND: case iOR: case iXOR: case iAND: case iOR: case iXOR:
pmL = &pIcode->ic.ll.dst; pmL = &pIcode->ic.ll.dst;
pmH = &(pIcode+1)->ic.ll.dst; pmH = &(pIcode+1)->ic.ll.dst;
if ((pLocId->id.longId.h == pmH->regi) && if ((pLocId->id.longId.h == pmH->regi) &&
(pLocId->id.longId.l == pmL->regi)) (pLocId->id.longId.l == pmL->regi))
{ {
lhs = COND_EXPR::idLongIdx (i); lhs = COND_EXPR::idLongIdx (i);
pIcode->setRegDU( pmH->regi, USE_DEF); pIcode->setRegDU( pmH->regi, USE_DEF);
rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
LOW_FIRST, idx, eUSE, 1); LOW_FIRST, idx, eUSE, 1);
switch (pIcode->ic.ll.opcode) { switch (pIcode->ic.ll.opcode) {
case iAND: rhs = COND_EXPR::boolOp (lhs, rhs, AND); case iAND: rhs = COND_EXPR::boolOp (lhs, rhs, AND);
break; break;
case iOR: rhs = COND_EXPR::boolOp (lhs, rhs, OR); case iOR: rhs = COND_EXPR::boolOp (lhs, rhs, OR);
break; break;
case iXOR: rhs = COND_EXPR::boolOp (lhs, rhs, XOR); case iXOR: rhs = COND_EXPR::boolOp (lhs, rhs, XOR);
break; break;
}
pIcode->setAsgn(lhs, rhs);
(pIcode+1)->invalidate();
idx = 0;
} }
break; pIcode->setAsgn(lhs, rhs);
} /* eos */ (pIcode+1)->invalidate();
idx = 0;
}
break;
} /* eos */
/* Check long conditional (i.e. 2 CMPs and 3 branches */ /* Check long conditional (i.e. 2 CMPs and 3 branches */
else if ((pIcode->ic.ll.opcode == iCMP) && else if ((pIcode->ic.ll.opcode == iCMP) &&
(isLong23 (idx, pIcode->inBB, &off, &arc))) (isLong23 (idx, pIcode->inBB, &off, &arc)))
{ {
if (checkLongRegEq (pLocId->id.longId, pIcode, i, idx, this, if (checkLongRegEq (pLocId->id.longId, pIcode, i, idx, this,
&rhs, &lhs, off) == TRUE) &rhs, &lhs, off) == TRUE)
longJCond23 (rhs, lhs, pIcode, &idx, this, arc, off); longJCond23 (rhs, lhs, pIcode, &idx, this, arc, off);
} }
/* Check for long conditional equality or inequality. This requires /* Check for long conditional equality or inequality. This requires
* 2 CMPs and 2 branches */ * 2 CMPs and 2 branches */
else if ((pIcode->ic.ll.opcode == iCMP) && else if ((pIcode->ic.ll.opcode == iCMP) &&
(isLong22 (pIcode, pEnd, &off))) (isLong22 (pIcode, pEnd, &off)))
{ {
if (checkLongRegEq (pLocId->id.longId, pIcode, i, idx, this, if (checkLongRegEq (pLocId->id.longId, pIcode, i, idx, this,
&rhs, &lhs, off) == TRUE) &rhs, &lhs, off) == TRUE)
longJCond22 (rhs, lhs, pIcode, &idx); longJCond22 (rhs, lhs, pIcode, &idx);
} }
/* Check for OR regH, regL /* Check for OR regH, regL
* JX lab * JX lab
* => HLI_JCOND (regH:regL X 0) lab * => HLI_JCOND (regH:regL X 0) lab
* This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */ * This is better code than HLI_JCOND (HI(regH:regL) | LO(regH:regL)) */
else if ((pIcode->ic.ll.opcode == iOR) && ((pIcode+1) < pEnd) && else if ((pIcode->ic.ll.opcode == iOR) && ((pIcode+1) < pEnd) &&
(isJCond ((pIcode+1)->ic.ll.opcode))) (isJCond ((pIcode+1)->ic.ll.opcode)))
{
if ((pIcode->ic.ll.dst.regi == pLocId->id.longId.h) &&
(pIcode->ic.ll.src.regi == pLocId->id.longId.l))
{ {
if ((pIcode->ic.ll.dst.regi == pLocId->id.longId.h) && lhs = COND_EXPR::idLongIdx (i);
(pIcode->ic.ll.src.regi == pLocId->id.longId.l))
{
lhs = COND_EXPR::idLongIdx (i);
rhs = COND_EXPR::idKte (0, 4); /* long 0 */ rhs = COND_EXPR::idKte (0, 4); /* long 0 */
lhs = COND_EXPR::boolOp (lhs, rhs, lhs = COND_EXPR::boolOp (lhs, rhs,
condOpJCond[(pIcode+1)->ic.ll.opcode - iJB]); condOpJCond[(pIcode+1)->ic.ll.opcode - iJB]);
(pIcode+1)->setJCond(lhs); (pIcode+1)->setJCond(lhs);
(pIcode+1)->copyDU(*pIcode, eUSE, eUSE); (pIcode+1)->copyDU(*pIcode, eUSE, eUSE);
pIcode->invalidate(); pIcode->invalidate();
}
} }
}
} /* end for */ } /* end for */
} /* end for */ } /* end for */
} }

BIN
tests/inputs/ZORK2.COM Normal file

Binary file not shown.

View File

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

View File

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

View File

@ -6,31 +6,31 @@
004 000303 50 PUSH ax 004 000303 50 PUSH ax
005 000304 B89401 MOV ax, 194h 005 000304 B89401 MOV ax, 194h
006 000307 50 PUSH ax 006 000307 50 PUSH ax
007 000308 E85D15 CALL near ptr scanf 007 000308 E85D15 CALL near ptr scanf
008 00030B 59 POP cx 008 00030B 59 POP cx
009 00030C 59 POP cx 009 00030C 59 POP cx
010 00030D FF76FE PUSH word ptr [bp-2] 010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4] 011 000310 FF76FC PUSH word ptr [bp-4]
012 000313 B89801 MOV ax, 198h 012 000313 B89801 MOV ax, 198h
013 000316 50 PUSH ax 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 015 00031A 83C406 ADD sp, 6
016 00031D 8D46EC LEA ax, [bp-14h] 016 00031D 8D46EC LEA ax, [bp-14h]
017 000320 50 PUSH ax 017 000320 50 PUSH ax
018 000321 B8B201 MOV ax, 1B2h 018 000321 B8B201 MOV ax, 1B2h
019 000324 50 PUSH ax 019 000324 50 PUSH ax
020 000325 E84015 CALL near ptr scanf 020 000325 E84015 CALL near ptr scanf
021 000328 59 POP cx 021 000328 59 POP cx
022 000329 59 POP cx 022 000329 59 POP cx
023 00032A 8D46F0 LEA ax, [bp-10h] 023 00032A 8D46F0 LEA ax, [bp-10h]
024 00032D 50 PUSH ax 024 00032D 50 PUSH ax
025 00032E B8B601 MOV ax, 1B6h 025 00032E B8B601 MOV ax, 1B6h
026 000331 50 PUSH ax 026 000331 50 PUSH ax
027 000332 E83315 CALL near ptr scanf 027 000332 E83315 CALL near ptr scanf
028 000335 59 POP cx 028 000335 59 POP cx
029 000336 59 POP cx 029 000336 59 POP cx
030 000337 C746FA0000 MOV word ptr [bp-6], 0 030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1 031 00033C C746F80100 MOV word ptr [bp-8], 1
032 000341 E9E900 JMP L1 032 000341 E9E900 JMP L1
033 00042D 8B56FA L1: MOV dx, [bp-6] 033 00042D 8B56FA L1: MOV dx, [bp-6]
@ -39,11 +39,11 @@
036 000436 7D03 JGE L2 036 000436 7D03 JGE L2
037 000438 E909FF JMP L3 037 000438 E909FF JMP L3
038 000344 C746F60000 L3: MOV word ptr [bp-0Ah], 0 038 000344 C746F60000 L3: MOV word ptr [bp-0Ah], 0
039 000349 C746F40100 MOV word ptr [bp-0Ch], 1 039 000349 C746F40100 MOV word ptr [bp-0Ch], 1
040 00034E E9C000 JMP L4 040 00034E E9C000 JMP L4
041 000411 837EF600 L4: CMP word ptr [bp-0Ah], 0 041 000411 837EF600 L4: CMP word ptr [bp-0Ah], 0
042 000415 7D03 JGE L5 042 000415 7D03 JGE L5
043 000417 E937FF JMP L6 043 000417 E937FF JMP L6
@ -65,9 +65,9 @@
059 00037B B80A00 MOV ax, 0Ah 059 00037B B80A00 MOV ax, 0Ah
060 00037E 52 PUSH dx 060 00037E 52 PUSH dx
061 00037F 50 PUSH ax 061 00037F 50 PUSH ax
062 000380 FF76F2 PUSH word ptr [bp-0Eh] 062 000380 FF76F2 PUSH word ptr [bp-0Eh]
063 000383 FF76F0 PUSH word ptr [bp-10h] 063 000383 FF76F0 PUSH word ptr [bp-10h]
064 000386 9AEB1D1000 CALL far ptr LMOD@ 064 000386 9AEB1D1000 CALL far ptr LMOD@
065 00038B 8956EE MOV [bp-12h], dx 065 00038B 8956EE MOV [bp-12h], dx
066 00038E 8946EC MOV [bp-14h], ax 066 00038E 8946EC MOV [bp-14h], ax
067 000391 8B56F2 MOV dx, [bp-0Eh] 067 000391 8B56F2 MOV dx, [bp-0Eh]
@ -117,8 +117,8 @@
107 000402 99 L13: CWD 107 000402 99 L13: CWD
108 000403 8956EE MOV [bp-12h], dx 108 000403 8956EE MOV [bp-12h], dx
109 000406 8946EC MOV [bp-14h], ax 109 000406 8946EC MOV [bp-14h], ax
110 000409 8346F401 ADD word ptr [bp-0Ch], 1 110 000409 8346F401 ADD word ptr [bp-0Ch], 1
111 00040D 8356F600 ADC word ptr [bp-0Ah], 0 111 00040D 8356F600 ADC word ptr [bp-0Ah], 0
112 JMP L4 ;Synthetic inst 112 JMP L4 ;Synthetic inst
113 000400 33C0 L11: XOR ax, ax 113 000400 33C0 L11: XOR ax, ax
@ -131,12 +131,12 @@
118 JMP L8 ;Synthetic inst 118 JMP L8 ;Synthetic inst
119 00041A 7F09 L5: JG L14 119 00041A 7F09 L5: JG L14
120 00041C 837EF428 CMP word ptr [bp-0Ch], 28h 120 00041C 837EF428 CMP word ptr [bp-0Ch], 28h
121 000420 7703 JA L14 121 000420 7703 JA L14
122 000422 E92CFF JMP L6 122 000422 E92CFF JMP L6
123 000425 8346F801 L14: ADD word ptr [bp-8], 1 123 000425 8346F801 L14: ADD word ptr [bp-8], 1
124 000429 8356FA00 ADC word ptr [bp-6], 0 124 000429 8356FA00 ADC word ptr [bp-6], 0
125 JMP L1 ;Synthetic inst 125 JMP L1 ;Synthetic inst
126 00043B 7F08 L2: JG L15 126 00043B 7F08 L2: JG L15
@ -144,11 +144,11 @@
128 000440 7703 JA L15 128 000440 7703 JA L15
129 000442 E9FFFE JMP L3 129 000442 E9FFFE JMP L3
130 000445 FF76EE L15: PUSH word ptr [bp-12h] 130 000445 FF76EE L15: PUSH word ptr [bp-12h]
131 000448 FF76EC PUSH word ptr [bp-14h] 131 000448 FF76EC PUSH word ptr [bp-14h]
132 00044B B8BA01 MOV ax, 1BAh 132 00044B B8BA01 MOV ax, 1BAh
133 00044E 50 PUSH ax 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 135 000452 83C406 ADD sp, 6
136 000455 8BE5 MOV sp, bp 136 000455 8BE5 MOV sp, bp
137 000457 5D POP bp 137 000457 5D POP bp

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,31 +6,31 @@
004 000303 50 PUSH ax 004 000303 50 PUSH ax
005 000304 B89401 MOV ax, 194h 005 000304 B89401 MOV ax, 194h
006 000307 50 PUSH ax 006 000307 50 PUSH ax
007 000308 E8E914 CALL near ptr scanf 007 000308 E8E914 CALL near ptr scanf
008 00030B 59 POP cx 008 00030B 59 POP cx
009 00030C 59 POP cx 009 00030C 59 POP cx
010 00030D FF76FE PUSH word ptr [bp-2] 010 00030D FF76FE PUSH word ptr [bp-2]
011 000310 FF76FC PUSH word ptr [bp-4] 011 000310 FF76FC PUSH word ptr [bp-4]
012 000313 B89801 MOV ax, 198h 012 000313 B89801 MOV ax, 198h
013 000316 50 PUSH ax 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 015 00031A 83C406 ADD sp, 6
016 00031D 8D46F2 LEA ax, [bp-0Eh] 016 00031D 8D46F2 LEA ax, [bp-0Eh]
017 000320 50 PUSH ax 017 000320 50 PUSH ax
018 000321 B8B201 MOV ax, 1B2h 018 000321 B8B201 MOV ax, 1B2h
019 000324 50 PUSH ax 019 000324 50 PUSH ax
020 000325 E8CC14 CALL near ptr scanf 020 000325 E8CC14 CALL near ptr scanf
021 000328 59 POP cx 021 000328 59 POP cx
022 000329 59 POP cx 022 000329 59 POP cx
023 00032A 8D46F4 LEA ax, [bp-0Ch] 023 00032A 8D46F4 LEA ax, [bp-0Ch]
024 00032D 50 PUSH ax 024 00032D 50 PUSH ax
025 00032E B8B601 MOV ax, 1B6h 025 00032E B8B601 MOV ax, 1B6h
026 000331 50 PUSH ax 026 000331 50 PUSH ax
027 000332 E8BF14 CALL near ptr scanf 027 000332 E8BF14 CALL near ptr scanf
028 000335 59 POP cx 028 000335 59 POP cx
029 000336 59 POP cx 029 000336 59 POP cx
030 000337 C746FA0000 MOV word ptr [bp-6], 0 030 000337 C746FA0000 MOV word ptr [bp-6], 0
031 00033C C746F80100 MOV word ptr [bp-8], 1 031 00033C C746F80100 MOV word ptr [bp-8], 1
032 000341 E97900 JMP L1 032 000341 E97900 JMP L1
033 0003BD 8B56FA L1: MOV dx, [bp-6] 033 0003BD 8B56FA L1: MOV dx, [bp-6]
@ -39,13 +39,13 @@
036 0003C6 7D03 JGE L2 036 0003C6 7D03 JGE L2
037 0003C8 E979FF JMP L3 037 0003C8 E979FF JMP L3
038 000344 C746F60100 L3: MOV word ptr [bp-0Ah], 1 038 000344 C746F60100 L3: MOV word ptr [bp-0Ah], 1
039 000349 EB64 JMP L4 039 000349 EB64 JMP L4
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 041 0003B3 7E96 JLE L5
042 0003B5 8346F801 ADD word ptr [bp-8], 1 042 0003B5 8346F801 ADD word ptr [bp-8], 1
043 0003B9 8356FA00 ADC word ptr [bp-6], 0 043 0003B9 8356FA00 ADC word ptr [bp-6], 0
044 JMP L1 ;Synthetic inst 044 JMP L1 ;Synthetic inst
045 00034B 8B46F2 L5: MOV ax, [bp-0Eh] 045 00034B 8B46F2 L5: MOV ax, [bp-0Eh]
@ -85,7 +85,7 @@
080 0003A5 EB02 JMP L9 080 0003A5 EB02 JMP L9
081 0003A9 8946F2 L9: MOV [bp-0Eh], ax 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 083 JMP L4 ;Synthetic inst
084 0003A7 33C0 L8: XOR ax, ax 084 0003A7 33C0 L8: XOR ax, ax
@ -99,10 +99,10 @@
090 0003D0 7703 JA L10 090 0003D0 7703 JA L10
091 0003D2 E96FFF JMP L3 091 0003D2 E96FFF JMP L3
092 0003D5 FF76F2 L10: PUSH word ptr [bp-0Eh] 092 0003D5 FF76F2 L10: PUSH word ptr [bp-0Eh]
093 0003D8 B8BA01 MOV ax, 1BAh 093 0003D8 B8BA01 MOV ax, 1BAh
094 0003DB 50 PUSH ax 094 0003DB 50 PUSH ax
095 0003DC E88C0B CALL near ptr printf 095 0003DC E88C0B CALL near ptr printf
096 0003DF 59 POP cx 096 0003DF 59 POP cx
097 0003E0 59 POP cx 097 0003E0 59 POP cx
098 0003E1 8BE5 MOV sp, bp 098 0003E1 8BE5 MOV sp, bp

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
PROC NEAR start PROC NEAR
000 000100 55 PUSH bp 000 000100 55 PUSH bp
001 000101 8BEC MOV bp, sp 001 000101 8BEC MOV bp, sp
002 000103 83EC02 SUB sp, 2 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] 004 00010B 8B46FE MOV ax, [bp-2]
005 00010E 3D0600 CMP ax, 6 005 00010E 3D0600 CMP ax, 6
006 000111 7735 JA L1 006 000111 7735 JA L1
007 000113 8BD8 MOV bx, ax 007 000113 8BD8 MOV bx, ax
008 000115 D1E3 SHL bx, 1 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 010 00012A B80200 MOV ax, 2 ;Case l0
011 00012D EB1E JMP L2 011 00012D EB1E JMP L2
@ -35,5 +35,5 @@
025 000143 B80D00 MOV ax, 0Dh ;Case l6 025 000143 B80D00 MOV ax, 0Dh ;Case l6
026 000146 EB05 JMP L2 026 000146 EB05 JMP L2
ENDP start ENDP

View File

@ -1,14 +1,14 @@
PROC NEAR start PROC NEAR
000 000100 55 PUSH bp 000 000100 55 PUSH bp
001 000101 8BEC MOV bp, sp 001 000101 8BEC MOV bp, sp
002 000103 83EC02 SUB sp, 2 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] 004 00010B 8B46FE MOV ax, [bp-2]
005 00010E 3D0600 CMP ax, 6 005 00010E 3D0600 CMP ax, 6
006 000111 7735 JA L1 006 000111 7735 JA L1
007 000113 8BD8 MOV bx, ax 007 000113 8BD8 MOV bx, ax
008 000115 D1E3 SHL bx, 1 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 010 00012A B80200 MOV ax, 2 ;Case l0
@ -34,5 +34,5 @@
025 000143 B80D00 MOV ax, 0Dh ;Case l6 025 000143 B80D00 MOV ax, 0Dh ;Case l6
026 000146 EB05 JMP L2 026 000146 EB05 JMP L2
ENDP start ENDP

View File

@ -6,7 +6,7 @@
#include "dcc.h" #include "dcc.h"
void () void start ()
/* Takes no parameters. /* Takes no parameters.
* High-level language prologue code. * High-level language prologue code.
*/ */