Fixed a bug in the parser not setting an identifier when one is used with a CMP and fixed a bug in the example assembly program.
This commit is contained in:
@@ -28,7 +28,7 @@ _end:
|
|||||||
; Returns: R2 - Contains the length of the string
|
; Returns: R2 - Contains the length of the string
|
||||||
strlen:
|
strlen:
|
||||||
copy r2, 0 ; length
|
copy r2, 0 ; length
|
||||||
copy byte r4, [r1]
|
copy byte r3, [r1]
|
||||||
cmp r3, 0
|
cmp r3, 0
|
||||||
jz end ;The string is zero length
|
jz end ;The string is zero length
|
||||||
loop:
|
loop:
|
||||||
|
|||||||
+8
-2
@@ -167,7 +167,7 @@ void HandleOpcode(void) {
|
|||||||
opcode->Value.Mnemonic = isByte ? COPYAB : COPYA;
|
opcode->Value.Mnemonic = isByte ? COPYAB : COPYA;
|
||||||
opcode->Lemexe = isByte ? "copyab" : "copya";
|
opcode->Lemexe = isByte ? "copyab" : "copya";
|
||||||
|
|
||||||
AdvanceParser();
|
ExpectIdentifier(0, ForwardParser);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ExpectPuncuation(LBracket, ForwardParser);
|
ExpectPuncuation(LBracket, ForwardParser);
|
||||||
@@ -208,12 +208,18 @@ void HandleOpcode(void) {
|
|||||||
|
|
||||||
TokenClass class = PeekToken()->Class;
|
TokenClass class = PeekToken()->Class;
|
||||||
|
|
||||||
if (class == NumberClass || class & IdentifierClass) {
|
if (class == NumberClass) {
|
||||||
opcode->Value.Mnemonic = CMPI;
|
opcode->Value.Mnemonic = CMPI;
|
||||||
opcode->Lemexe = "CMPI";
|
opcode->Lemexe = "CMPI";
|
||||||
|
|
||||||
AdvanceParser();
|
AdvanceParser();
|
||||||
}
|
}
|
||||||
|
else if (class & IdentifierClass) {
|
||||||
|
opcode->Value.Mnemonic = CMPI;
|
||||||
|
opcode->Lemexe = "CMPI";
|
||||||
|
|
||||||
|
ExpectIdentifier(0, ForwardParser);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ExpectRegister();
|
ExpectRegister();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user