1
0
mirror of synced 2026-04-30 05:24:50 +00:00

fixes for later tss

This commit is contained in:
brad
2016-01-01 21:52:21 +00:00
parent ae715df32d
commit 538ee18f3f

View File

@@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/******************************************************************************/ /******************************************************************************/
/* */ /* */
/* Program: MACRO8X */ /* Program: MACRO8X */
@@ -1173,11 +1174,12 @@ void onePass()
{ {
/* Use lookup so symbol will not be counted as reference. */ /* Use lookup so symbol will not be counted as reference. */
sym = lookup( lexemeToName( name, lexstart, lexterm )); sym = lookup( lexemeToName( name, lexstart, lexterm ));
//printf("pass %d, name %s clc %o reloc %o\n", pass, name, clc, reloc);
if( M_DEFINED( sym->type )) if( M_DEFINED( sym->type ))
{ {
if( sym->val != (clc & 07777) && pass == 2 ) if( sym->val != (clc & 07777) && pass == 2 )
{ {
printf("pass %d, val %o, clc %o\n", pass, sym->val, clc); //printf("pass %d, val %o, clc %o\n", pass, sym->val, clc);
errorSymbol( &duplicate_label, sym->name, lexstart ); errorSymbol( &duplicate_label, sym->name, lexstart );
} }
sym->type = sym->type | DUPLICATE; sym->type = sym->type | DUPLICATE;
@@ -1411,6 +1413,10 @@ SYM_T *getExpr()
/* assert line[lexstart] == delimiter */ /* assert line[lexstart] == delimiter */
if( is_blank( delimiter )) if( is_blank( delimiter ))
{ {
#if 1
if( M_UNDEFINED( sym_getexpr.type ))
sym_getexpr.val = 0;
#endif
return( &sym_getexpr ); return( &sym_getexpr );
} }
@@ -1449,6 +1455,10 @@ SYM_T *getExpr()
default: default:
if( isend( line[lexstart] )) if( isend( line[lexstart] ))
{ {
#if 1
if( M_UNDEFINED( sym_getexpr.type ))
sym_getexpr.val = 0;
#endif
return( &sym_getexpr ); return( &sym_getexpr );
} }
@@ -1475,6 +1485,10 @@ SYM_T *getExpr()
sym_getexpr.val = 0; sym_getexpr.val = 0;
break; break;
} }
#if 1
if( M_UNDEFINED( sym_getexpr.type ))
sym_getexpr.val = 0;
#endif
return( &sym_getexpr ); return( &sym_getexpr );
} }
} /* end while */ } /* end while */
@@ -1502,6 +1516,7 @@ SYM_T *eval()
if( isalpha( line[lexstart] )) if( isalpha( line[lexstart] ))
{ {
sym = evalSymbol(); sym = evalSymbol();
//printf("eval; pass %d, sym %p (0%o 0x%x %d) '%s'\n", pass, sym, sym->val, sym->val, sym->val, &line[lexstart]);
if( M_UNDEFINED( sym->type )) if( M_UNDEFINED( sym->type ))
{ {
if( pass == 2 ) if( pass == 2 )
@@ -1539,6 +1554,7 @@ SYM_T *eval()
sym_eval.type = sym->type; sym_eval.type = sym->type;
sym_eval.val = 0; sym_eval.val = 0;
nextLexeme(); nextLexeme();
//printf("eval; pass %d, return sym %p\n", pass, sym);
return( &sym_eval ); return( &sym_eval );
} }
else else
@@ -1576,6 +1592,7 @@ SYM_T *eval()
} }
nextLexeme(); nextLexeme();
sym_eval.val = val; sym_eval.val = val;
//printf("eval; pass %d, return val 0x%x\n", pass, val);
return( &sym_eval ); return( &sym_eval );
} }
else else
@@ -1583,6 +1600,7 @@ SYM_T *eval()
switch( line[lexstart] ) switch( line[lexstart] )
{ {
case '"': /* Character literal */ case '"': /* Character literal */
//printf("eval; pass %d, quotes '%s'\n", pass, &line[lexstart]);
if( lexstart + 2 < maxcc ) if( lexstart + 2 < maxcc )
{ {
val = line[lexstart + 1] | 0200; val = line[lexstart + 1] | 0200;
@@ -1656,6 +1674,7 @@ SYM_T *eval()
nextLexBlank(); /* Go past illegal character. */ nextLexBlank(); /* Go past illegal character. */
} }
} }
//printf("eval; pass %d, return val 0x%x\n", pass, val);
sym_eval.val = val; sym_eval.val = val;
return( &sym_eval ); return( &sym_eval );
} /* eval() */ } /* eval() */
@@ -3780,7 +3799,7 @@ BOOL pseudoOperators( PSEUDO_T val )
{ {
sym = evalSymbol(); sym = evalSymbol();
nextLexeme(); nextLexeme();
if( M_DEFINED_CONDITIONALLY( sym->type )) if( M_DEFINED/*_CONDITIONALLY*/( sym->type ))
{ {
conditionTrue(); conditionTrue();
} }
@@ -3816,24 +3835,52 @@ BOOL pseudoOperators( PSEUDO_T val )
break; break;
case IFNZERO: case IFNZERO:
if( (getExpr())->val == 0 ) // if( (getExpr())->val == 0 )
// {
// conditionFalse();
// }
// else
// {
// conditionTrue();
// }
{ {
conditionFalse(); int v;
} v = (getExpr())->val;
else v &= 0xfff; if (v & 0x800) v |= -1 << 12;
{ //printf("IFNZERO pass=%d, v=0x%x (%d)\n", pass, v, v);
conditionTrue(); if( v == 0 )
{
conditionFalse();
}
else
{
conditionTrue();
}
} }
break; break;
case IFZERO: case IFZERO:
if( (getExpr())->val == 0 ) // if( (getExpr())->val == 0 )
// {
// conditionTrue();
// }
// else
// {
// conditionFalse();
// }
{ {
conditionTrue(); int v;
} v = (getExpr())->val;
else v &= 0xfff; if (v & 0x800) v |= -1 << 12;
{ //printf("IFZERO pass=%d, v=0x%x (%d)\n", pass, v, v);
conditionFalse(); if( v == 0 )
{
conditionTrue();
}
else
{
conditionFalse();
}
} }
break; break;
@@ -4074,6 +4121,8 @@ BOOL pseudoOperators( PSEUDO_T val )
case ZBLOCK: case ZBLOCK:
value = (getExpr())->val; value = (getExpr())->val;
value &= 0xfff; if (value & 0x800) value |= -1 << 12;
//printf("pseudoOperators; ZBLOCK value 0%o 0x%x %d\n", value, value, value);
if( value < 0 ) if( value < 0 )
{ {
errorMessage( &zblock_too_small, lexstartprev ); errorMessage( &zblock_too_small, lexstartprev );
@@ -4119,10 +4168,27 @@ void conditionFalse()
level = 1; level = 1;
while( level > 0 ) while( level > 0 )
{ {
if( isend( line[cc] ) || ( line[cc] == '/' )) // if( isend( line[cc] ) || ( line[cc] == '/' ))
// {
// readLine();
// }
if( isend( line[cc] ))
{ {
readLine(); readLine();
} }
else if( line[cc] == '/' && line[cc-1] != '"' )
{
/* macro end can occur at end of comment */
for (; !isend( line[cc] ); cc++) {
// if (line[cc] == '<')
// level++;
// if (line[cc] == '>' && (line[cc+1] == '>' || isend(line[cc+1])))
// level--;
if (line[cc] == '>' && line[cc-1] == ' ')
level--;
}
readLine();
}
else else
{ {
switch( line[cc] ) switch( line[cc] )
@@ -4147,6 +4213,7 @@ void conditionFalse()
break; break;
} /* end switch */ } /* end switch */
} /* end if */ } /* end if */
//printf("level %d '%s'\n", level, &line[cc]);
} /* end while */ } /* end while */
nextLexeme(); nextLexeme();
} }