Rewrote expression evaluation. More smaller changes.

git-svn-id: svn://svn.cc65.org/cc65/trunk@2638 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-11-11 13:57:30 +00:00
parent 3d1e244a8a
commit 4555fdcad1
14 changed files with 668 additions and 637 deletions

View File

@@ -144,10 +144,10 @@ void EmitData (const unsigned char* Data, unsigned Size)
void EmitByte (ExprNode* Expr)
/* Emit one byte */
{
if (IsConstExpr (Expr)) {
{
long Val;
if (IsConstExpr (Expr, &Val)) {
/* Constant expression, emit literal byte */
long Val = GetExprVal (Expr);
FreeExpr (Expr);
if ((Val & ~0xFF) != 0) {
Error ("Range error");
@@ -167,9 +167,9 @@ void EmitByte (ExprNode* Expr)
void EmitWord (ExprNode* Expr)
/* Emit one word */
{
if (IsConstExpr (Expr)) {
long Val;
if (IsConstExpr (Expr, &Val)) {
/* Constant expression, emit literal byte */
long Val = GetExprVal (Expr);
FreeExpr (Expr);
if ((Val & ~0xFFFF) != 0) {
Error ("Range error");
@@ -190,9 +190,9 @@ void EmitWord (ExprNode* Expr)
void EmitFarAddr (ExprNode* Expr)
/* Emit a 24 bit expression */
{
if (IsConstExpr (Expr)) {
long Val;
if (IsConstExpr (Expr, &Val)) {
/* Constant expression, emit literal byte */
long Val = GetExprVal (Expr);
FreeExpr (Expr);
if ((Val & ~0xFFFFFF) != 0) {
Error ("Range error");
@@ -214,9 +214,9 @@ void EmitFarAddr (ExprNode* Expr)
void EmitDWord (ExprNode* Expr)
/* Emit one dword */
{
if (IsConstExpr (Expr)) {
long Val;
if (IsConstExpr (Expr, &Val)) {
/* Constant expression, emit literal byte */
long Val = GetExprVal (Expr);
FreeExpr (Expr);
Emit0 (Val & 0xFF);
Emit0 ((Val >> 8) & 0xFF);