-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
73 additions
and
31 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
22 changes: 22 additions & 0 deletions
22
src/MimaSim/MimaSim/MIMA/Instructions/SysCallInstruction.cs
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,22 @@ | ||
using System.Text; | ||
using MimaSim.Core; | ||
using MimaSim.MIMA.Components; | ||
|
||
namespace MimaSim.MIMA.Instructions; | ||
|
||
public class SysCallInstruction : IInstruction, IDisassemblyInstruction | ||
{ | ||
public OpCodes OpCode => OpCodes.SYSCALL; | ||
|
||
public bool Invoke(CPU cpu) | ||
{ | ||
cpu.ControlUnit.InvokeSysCall((SysCall)cpu.Fetch16()); | ||
|
||
return true; | ||
} | ||
|
||
public void Dissassemble(StringBuilder builder, Disassembler disassembler) | ||
{ | ||
builder.AppendLine($"syscall 0x{disassembler.Fetch16():X2}"); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -18,5 +18,6 @@ public enum Mnemnonics | |
CLK, | ||
FLAG, | ||
UNFLAG, | ||
HASFLAG | ||
HASFLAG, | ||
SYSCALL | ||
} |
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
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 |
---|---|---|
|
@@ -14,4 +14,5 @@ public enum Registers | |
DX, | ||
DY, | ||
FLAG, | ||
SCR // Register to store syscall result | ||
} |
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,6 @@ | ||
namespace MimaSim.MIMA; | ||
|
||
public enum SysCall | ||
{ | ||
|
||
} |
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 |
---|---|---|
|
@@ -54,6 +54,8 @@ | |
<Word>unflag</Word> | ||
<Word>hasflag</Word> | ||
|
||
<Word>syscall</Word> | ||
|
||
<Word>macro</Word> | ||
</Keywords> | ||
|
||
|