diff --git a/compiler/scasm/amx_compiler.cpp b/compiler/scasm/amx_compiler.cpp index 223577d6..17473747 100755 --- a/compiler/scasm/amx_compiler.cpp +++ b/compiler/scasm/amx_compiler.cpp @@ -1241,8 +1241,7 @@ Start: } case OP_SDIV_ALT: { - CHK_PARAMS(1); - PUSH_PARAM(1, Sym_Dat); + CHK_PARAMS(0); break; } case OP_UMUL: @@ -1257,8 +1256,7 @@ Start: } case OP_UDIV_ALT: { - CHK_PARAMS(1); - PUSH_PARAM(1, Sym_Dat); + CHK_PARAMS(0); break; } case OP_ADD: @@ -2310,7 +2308,7 @@ int Compiler::DerefSymbol(std::string &str, SymbolType sym) { ProcMngr::AsmProc *p = 0; - if ( ((p = PROC->FindProc(str)) == NULL) || p->ASM == NULL) + if ( ((p = PROC->FindProc(str)) == NULL) ) { /* Labels we handle differently. Add it to the label queue @@ -2318,6 +2316,9 @@ int Compiler::DerefSymbol(std::string &str, SymbolType sym) p = PROC->AddProc(S, NULL); PROC->QueueProc(str, CurAsm()); val = ProcMngr::ncip; + } else if (p->ASM == NULL) { + PROC->QueueProc(str, CurAsm()); + val = ProcMngr::ncip; } else { val = p->ASM->cip; } @@ -2355,6 +2356,9 @@ int Compiler::DerefSymbol(std::string &str, SymbolType sym) L = CLabels->AddLabel(S, LabelMngr::ncip); CLabels->QueueLabel(str, CurAsm()); LabelStack.push(str); + } else if (L->cip == LabelMngr::ncip) { + //if we don't queue the label the jump won't be resolved! + CLabels->QueueLabel(str, CurAsm()); } val = L->cip; diff --git a/compiler/scasm/amxasm.cpp b/compiler/scasm/amxasm.cpp index 59c112ad..c65ef5a2 100755 --- a/compiler/scasm/amxasm.cpp +++ b/compiler/scasm/amxasm.cpp @@ -126,7 +126,7 @@ void get_options(int argc, char **argv, Compiler &Prog) void print_version() { - printf("Small/AMX Assembler 1.01\n"); + printf("Small/AMX Assembler 1.02\n"); printf("(C)2004 David 'BAILOPAN' Anderson\n"); } diff --git a/compiler/scasm/cexpr.cpp b/compiler/scasm/cexpr.cpp index b23541b4..556ad85e 100755 --- a/compiler/scasm/cexpr.cpp +++ b/compiler/scasm/cexpr.cpp @@ -98,7 +98,7 @@ void CExpr::Set(std::string &text) int CExpr::DeHex(std::string blk) { - size_t pos = 0, xc = 0, xpos = 0; + size_t pos = 0, xc = 0, xpos = 0, ms = 0; /* run through the characters */ for (pos = 0; pos < blk.size(); pos++) { @@ -108,6 +108,9 @@ int CExpr::DeHex(std::string blk) if (xc > 1) break; xpos = pos; + } else if (blk[pos] == '-') { + if (pos != 0) + ms = 1; } else if (blk[pos] != ' ' && (blk[pos] < '0' || blk[pos] > '9') && (!xc || (xc && !IsHex(blk[pos])))) { @@ -120,6 +123,11 @@ int CExpr::DeHex(std::string blk) CError->ErrorMsg(Err_Unexpected_Char, 'x'); return 0; } + if (ms) + { + CError->ErrorMsg(Err_Unexpected_Char, '-'); + return 0; + } if (xc) { if (xpos == 0 || blk[xpos-1] != '0') @@ -139,9 +147,10 @@ int CExpr::DeHex(std::string blk) blk[pos] -= 32; if (blk[pos] >= 16 || blk[pos] < 0) { - assert(0); if (CError) + { CError->ErrorMsg(Err_Unexpected_Char, blk[pos]); + } return 0; } j *= 16; diff --git a/compiler/scasm/sasm.exe b/compiler/scasm/sasm.exe index 75d963da..6ce48619 100755 Binary files a/compiler/scasm/sasm.exe and b/compiler/scasm/sasm.exe differ