Skip to content

Commit

Permalink
compute alias values before crunching sections
Browse files Browse the repository at this point in the history
  • Loading branch information
EdouardBERGE committed Feb 10, 2021
1 parent 154cb88 commit 496467d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define TRACE_GENERALE 0
#define TRACE_PREPRO 0
#define TRACE_ASSEMBLE 0
#define TRACE_POPEXPR 0
#define TRACE_COMPUTE_EXPRESSION 0
#define TRACE_HEXBIN 0
#define TRACE_MAKEAMSDOSREAL 0
Expand Down Expand Up @@ -370,6 +371,9 @@ struct s_alias {
int crc,len,autorise_export;
int iw;
int used;
/* v1.5 */
int ptr;
float v;
};

struct s_ticker {
Expand Down Expand Up @@ -6332,6 +6336,8 @@ printf("MakeAlias (2) EXPR=[%s EQU %s]\n",expr,ptr_exp2);
curalias.alias=TxtStrDup(expr);
}
curalias.crc=GetCRC(curalias.alias);
curalias.ptr=ae->codeadr;

if ((ialias=SearchAlias(ae,curalias.crc,curalias.alias))>=0) {
MakeError(ae,GetCurrentFile(ae),GetExpLine(ae,0),"Duplicate alias [%s]\n",expr);
MemFree(curalias.alias);
Expand Down Expand Up @@ -8227,6 +8233,11 @@ void PopAllExpression(struct s_assenv *ae, int crunched_zone)
} else {
expr=ae->wl[ae->expression[i].iw].w;
}

#if TRACE_POPEXPR
printf("PopAll (%d) expr=[%s] ptr=%X\n",crunched_zone,expr,ae->expression[i].ptr);
#endif

v=ComputeExpressionCore(ae,expr,ae->expression[i].ptr,i);
r=(long)floor(v+ae->rough);
switch (ae->expression[i].zetype) {
Expand Down Expand Up @@ -16251,6 +16262,18 @@ printf("crunch if any %d blocks\n",ae->ilz);
c r u n c h L Z s e c t i o n s
***************************************************/
if (!ae->stop || !ae->nberr) {

for (i=0;i<ae->ialias;i++) {
char alias_value[128];
float v;
//printf("alias[%d] [%s]=>[%s]\n",i,ae->alias[i].alias,ae->alias[i].translation);
v=ComputeExpressionCore(ae,ae->alias[i].translation,ae->alias[i].ptr,ae->alias[i].iw);
//printf(" => computed to %.2lf\n",v);
sprintf(alias_value,"%.8lf",v);
MemFree(ae->alias[i].translation);
ae->alias[i].translation=TxtStrDup(alias_value);
}

for (i=0;i<ae->ilz;i++) {
/* on d�pile les symboles dans l'ordre mais on ne reloge pas sur les zones interm�diaires ou post-crunched */
if (ae->lzsection[i].lzversion!=0) {
Expand Down

0 comments on commit 496467d

Please sign in to comment.