From 46b52a57f767b412a60bcb0c88e0eb9ab147f5f6 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:07:50 +0200 Subject: [PATCH] Add binary not operator to inline assembler operand parsing --- oscar64/Parser.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index 679dc2f..a2710dd 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -10467,6 +10467,22 @@ Expression* Parser::ParseAssemblerBaseOperand(Declaration* pcasm, int pcoffset) mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Cannot negate expression"); break; + case TK_BINARY_NOT: + mScanner->NextToken(); + exp = ParseAssemblerBaseOperand(pcasm, pcoffset); + if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER) + { + dec = new Declaration(mScanner->mLocation, DT_CONST_INTEGER); + dec->mInteger = ~exp->mDecValue->mInteger; + dec->mBase = TheUnsignedIntTypeDeclaration; + exp = new Expression(mScanner->mLocation, EX_CONSTANT); + exp->mDecValue = dec; + exp->mDecType = dec->mBase; + } + else + mErrors->Error(exp->mLocation, EERR_INCOMPATIBLE_OPERATOR, "Cannot negate expression"); + break; + case TK_MUL: mScanner->NextToken(); exp = new Expression(mScanner->mLocation, EX_CONSTANT);