-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from rbaker26/seq_json
Added Addition OpCode Support
- Loading branch information
Showing
20 changed files
with
771 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using SAP1EMU.Lib; | ||
|
||
namespace SAP1EMU.Assembler | ||
{ | ||
public class InstructionValidator | ||
{ | ||
public static bool IsValidInstruction(string instruction, InstructionSet iset) | ||
{ | ||
if(instruction.ToLower() == "nop") | ||
{ | ||
return true; | ||
} | ||
try | ||
{ | ||
return !string.IsNullOrEmpty(iset.instructions.Find(x => x.OpCode.ToLower().Equals(instruction.ToLower())).OpCode); | ||
} | ||
catch(NullReferenceException) | ||
{ | ||
return false; | ||
} | ||
} | ||
public static string GetUpperNibble(string instruction, InstructionSet iset) | ||
{ | ||
if (instruction.ToLower() == "nop") | ||
{ | ||
return "0000"; | ||
} | ||
return iset.instructions.Find(x => x.OpCode.ToLower().Equals(instruction.ToLower())).BinCode; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.