Updated the opcode listing and 'fixed' the code to at least compile, but obviously I'll need to rework how the new copy instructions are to be parsed. Fixed some errors in the documentation where I skipped some hex numbers and added a copy immediate op.
This commit is contained in:
+34
-31
@@ -130,42 +130,42 @@ void HandleAssemblerDirective() {
|
||||
|
||||
if (PeekToken()->Class == NumberClass) {
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Value.Mnemonic = LODWI;
|
||||
directive->Lemexe = "LODWI";
|
||||
directive->Value.Mnemonic = COPYI;
|
||||
directive->Lemexe = "copyi";
|
||||
AdvanceParser(); //Number, register or identifier
|
||||
}
|
||||
else if (PeekToken()->Class == RegisterClass) {
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Value.Mnemonic = LODW;
|
||||
directive->Lemexe = "LODW";
|
||||
directive->Value.Mnemonic = COPY;
|
||||
directive->Lemexe = "copy";
|
||||
AdvanceParser(); //Number, register or identifier
|
||||
}
|
||||
else {
|
||||
ExpectIdentifier(0, ForwardParser);
|
||||
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Value.Mnemonic = LAA;
|
||||
directive->Lemexe = "LAA";
|
||||
directive->Value.Mnemonic = COPYA;
|
||||
directive->Lemexe = "copya";
|
||||
}
|
||||
}
|
||||
else if (reg->Class == DirectiveClass) {
|
||||
if (reg->Value.Directive != Byte) {
|
||||
fprintf(stderr, "[Line %d] Syntax error, expected keyword 'byte'.\n", reg->LineNumber);
|
||||
exit(3);
|
||||
}
|
||||
// else if (reg->Class == DirectiveClass) {
|
||||
// if (reg->Value.Directive != Byte) {
|
||||
// fprintf(stderr, "[Line %d] Syntax error, expected keyword 'byte'.\n", reg->LineNumber);
|
||||
// exit(3);
|
||||
// }
|
||||
|
||||
RemoveCurrentToken(); //byte
|
||||
// RemoveCurrentToken(); //byte
|
||||
|
||||
ExpectRegister();
|
||||
// ExpectRegister();
|
||||
|
||||
ExpectPuncuation(Comma, ForwardParser);
|
||||
// ExpectPuncuation(Comma, ForwardParser);
|
||||
|
||||
ExpectRegister();
|
||||
// ExpectRegister();
|
||||
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Value.Mnemonic = LODB;
|
||||
directive->Lemexe = "LODB";
|
||||
}
|
||||
// directive->Class = MnemonicClass;
|
||||
// directive->Value.Mnemonic = LODB;
|
||||
// directive->Lemexe = "LODB";
|
||||
// }
|
||||
|
||||
ExpectLineEndOrFileEnd(ForwardParser);
|
||||
}
|
||||
@@ -180,9 +180,9 @@ void HandleAssemblerDirective() {
|
||||
if (next->Class != DirectiveClass) {
|
||||
//If the token after the current one is invalid then the expect function ahead will exit, so we can
|
||||
//go ahead and change the STORE directive into a proper opcode here.
|
||||
directive->Value.Mnemonic = STOW;
|
||||
directive->Value.Mnemonic = COPY;
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Lemexe = "STOW";
|
||||
directive->Lemexe = "copy";
|
||||
}
|
||||
else {
|
||||
if (next->Value.Directive != Byte) {
|
||||
@@ -192,9 +192,9 @@ void HandleAssemblerDirective() {
|
||||
|
||||
RemoveCurrentToken(); //Remove byte modifier token.
|
||||
|
||||
directive->Value.Mnemonic = STOB;
|
||||
directive->Value.Mnemonic = COPYB;
|
||||
directive->Class = MnemonicClass;
|
||||
directive->Lemexe = "STOB";
|
||||
directive->Lemexe = "copyb";
|
||||
}
|
||||
|
||||
ExpectRegister();
|
||||
@@ -272,11 +272,14 @@ void HandleOpcode(void) {
|
||||
{
|
||||
Token* arg = PeekToken();
|
||||
|
||||
opcode->Value.Mnemonic = JMPI;
|
||||
opcode->Lemexe = "jmpi";
|
||||
|
||||
if (arg->Class == IdentifierClass) {
|
||||
ExpectIdentifier(0, ForwardParser);
|
||||
|
||||
opcode->Value.Mnemonic = JMPA;
|
||||
opcode->Lemexe = "JMPA";
|
||||
opcode->Value.Mnemonic = JMP;
|
||||
opcode->Lemexe = "jmp";
|
||||
}
|
||||
else ExpectRegister();
|
||||
}
|
||||
@@ -288,8 +291,8 @@ void HandleOpcode(void) {
|
||||
if (arg->Class == IdentifierClass) {
|
||||
ExpectIdentifier(0, ForwardParser);
|
||||
|
||||
opcode->Value.Mnemonic = JZA;
|
||||
opcode->Lemexe = "JZA";
|
||||
opcode->Value.Mnemonic = JZ;
|
||||
opcode->Lemexe = "jz";
|
||||
}
|
||||
else ExpectRegister();
|
||||
}
|
||||
@@ -301,8 +304,8 @@ void HandleOpcode(void) {
|
||||
if (arg->Class == IdentifierClass) {
|
||||
ExpectIdentifier(0, ForwardParser);
|
||||
|
||||
opcode->Value.Mnemonic = JGA;
|
||||
opcode->Lemexe = "JGA";
|
||||
opcode->Value.Mnemonic = JG;
|
||||
opcode->Lemexe = "jg";
|
||||
}
|
||||
else ExpectRegister();
|
||||
}
|
||||
@@ -314,8 +317,8 @@ void HandleOpcode(void) {
|
||||
if (arg->Class == IdentifierClass) {
|
||||
ExpectIdentifier(0, ForwardParser);
|
||||
|
||||
opcode->Value.Mnemonic = JLA;
|
||||
opcode->Lemexe = "JLA";
|
||||
opcode->Value.Mnemonic = JL;
|
||||
opcode->Lemexe = "jl";
|
||||
}
|
||||
else ExpectRegister();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user