mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-05 07:42:45 +00:00
This commit is contained in:
parent
c368698af4
commit
0a0d636910
2 changed files with 23 additions and 12 deletions
|
|
@ -139,17 +139,8 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
if (Signature != null && Signature.Length > 0) {
|
if (Signature != null && Signature.Length > 0) {
|
||||||
aOutputWriter.WriteLine("{0} db {1}", SignatureLabelName, Signature.Aggregate<byte, string>("", (r, b) => r + b + ",") + "0");
|
aOutputWriter.WriteLine("{0} db {1}", SignatureLabelName, Signature.Aggregate<byte, string>("", (r, b) => r + b + ",") + "0");
|
||||||
}
|
}
|
||||||
//TODO: Move this to call DebugStub and it it output this stuff.
|
DebugStub.EmitDataSection(aOutputWriter);
|
||||||
aOutputWriter.WriteLine("DebugTraceMode dd 0"); // Tracing: 0=Off, 1=On
|
|
||||||
aOutputWriter.WriteLine("DebugStatus dd 0"); // Run, Break, Stepping
|
|
||||||
aOutputWriter.WriteLine("DebugRunning dd 0"); // 0 = Not in, 1 = already running
|
|
||||||
aOutputWriter.WriteLine("DebugSuspendLevel dd 0"); // Nesting control for non steppable routines
|
|
||||||
aOutputWriter.WriteLine("DebugResumeLevel dd 0"); // Nesting control for non steppable routines
|
|
||||||
aOutputWriter.WriteLine("DebugEIP dd 0"); // Last EIP value
|
|
||||||
aOutputWriter.WriteLine("InterruptsEnabledFlag dd 0");
|
|
||||||
aOutputWriter.WriteLine("DebugTraceSent dd 0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void EmitDataSectionFooter(string aGroup, TextWriter aOutputWriter) {
|
protected override void EmitDataSectionFooter(string aGroup, TextWriter aOutputWriter) {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,24 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
// Current status of OS Debug Stub
|
// Current status of OS Debug Stub
|
||||||
public enum Status { Run = 0, Break = 1, Stepping = 2 }
|
public enum Status { Run = 0, Break = 1, Stepping = 2 }
|
||||||
|
|
||||||
|
// A bit of a hack as a static? Other ideas?
|
||||||
|
public static void EmitDataSection(System.IO.TextWriter aWriter) {
|
||||||
|
// Tracing: 0=Off, 1=On
|
||||||
|
aWriter.WriteLine("DebugTraceMode dd 0");
|
||||||
|
// Run, Break, Stepping
|
||||||
|
aWriter.WriteLine("DebugStatus dd 0");
|
||||||
|
// 0 = Not in, 1 = already running
|
||||||
|
aWriter.WriteLine("DebugRunning dd 0");
|
||||||
|
// Nesting control for non steppable routines
|
||||||
|
aWriter.WriteLine("DebugSuspendLevel dd 0");
|
||||||
|
// Nesting control for non steppable routines
|
||||||
|
aWriter.WriteLine("DebugResumeLevel dd 0");
|
||||||
|
// Last EIP value
|
||||||
|
aWriter.WriteLine("DebugEIP dd 0");
|
||||||
|
aWriter.WriteLine("InterruptsEnabledFlag dd 0");
|
||||||
|
aWriter.WriteLine("DebugTraceSent dd 0");
|
||||||
|
}
|
||||||
|
|
||||||
protected void Commands() {
|
protected void Commands() {
|
||||||
Label = "DebugStub_TraceOff";
|
Label = "DebugStub_TraceOff";
|
||||||
Memory["DebugTraceMode", 32] = (int)Tracing.Off;
|
Memory["DebugTraceMode", 32] = (int)Tracing.Off;
|
||||||
|
|
@ -112,9 +130,7 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
ECX.Compare(0);
|
ECX.Compare(0);
|
||||||
JumpIf(Flags.Equal, "DebugStub_SendTextExit");
|
JumpIf(Flags.Equal, "DebugStub_SendTextExit");
|
||||||
new X86.Move("AL", "[ESI]");
|
new X86.Move("AL", "[ESI]");
|
||||||
//AL = 0xFF;
|
|
||||||
EAX.Push();
|
EAX.Push();
|
||||||
//TODO: Change WriteByteToComPort to take an address to write to in a register
|
|
||||||
Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
new X86.Dec("ECX");
|
new X86.Dec("ECX");
|
||||||
// We are storing as 16 bits, but for now I will transmit 8 bits
|
// We are storing as 16 bits, but for now I will transmit 8 bits
|
||||||
|
|
@ -133,6 +149,10 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
// we need to read a port before we can write out the value to another port.
|
// we need to read a port before we can write out the value to another port.
|
||||||
// The overhead is a lot, but compared to the speed of the serial and the fact
|
// The overhead is a lot, but compared to the speed of the serial and the fact
|
||||||
// that we wait on the serial port anyways, its a wash.
|
// that we wait on the serial port anyways, its a wash.
|
||||||
|
//
|
||||||
|
// This could be changed to use interrupts, but that then copmlicates
|
||||||
|
// the code and causes interaction with other code. DebugStub should be
|
||||||
|
// as isolated as possible from any other code.
|
||||||
Label = "WriteByteToComPort";
|
Label = "WriteByteToComPort";
|
||||||
Label = "WriteByteToComPort_Wait";
|
Label = "WriteByteToComPort_Wait";
|
||||||
DX = mComStatusAddr;
|
DX = mComStatusAddr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue