-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: DOS INT21H 0x4B supporting structures
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
- Loading branch information
1 parent
cb583fb
commit a1d32fd
Showing
16 changed files
with
506 additions
and
28 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
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
25 changes: 25 additions & 0 deletions
25
src/Spice86.Core/Emulator/OperatingSystem/Enums/DosConstants.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,25 @@ | ||
namespace Spice86.Core.Emulator.OperatingSystem.Enums; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
internal static class DosConstants { | ||
public const ushort DosSdaSegment = 0xb2; | ||
public const ushort DosSdaOffset = 0x0; | ||
public const ushort DosCurrentDirectoryStructureSegment = 0x108; | ||
public const ushort DosInfoBlockSegment = 0x80; | ||
public const ushort DosConDrvSegment = 0Xa0; | ||
public const ushort DosConStringSegment = 0xa8; | ||
public const ushort DosFirstShell = 0x118; | ||
public const ushort DosFirstUsableMemorySegment = 0x16f; | ||
public const ushort DosPrivateSegmentStart = 0xc800; | ||
public const ushort DosPrivateSegmentEnd = 0xd000; | ||
public const int SftHeaderSize = 6; | ||
public const int SftEntrySize = 59; | ||
public const uint SftEndPointer = 0xffffffff; | ||
public const ushort SftNextTableOffset = 0x0; | ||
public const ushort SftNumberOfFilesOffset = 0x04; | ||
public const int FakeSftEntries = 16; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Spice86.Core/Emulator/OperatingSystem/Enums/DosReturnMode.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,13 @@ | ||
namespace Spice86.Core.Emulator.OperatingSystem.Enums; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
internal enum DosReturnMode : byte { | ||
Exit = 0, | ||
CtrlC = 1, | ||
Abort = 2, | ||
TerminateAndStayResident = 3 | ||
} |
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
88 changes: 75 additions & 13 deletions
88
src/Spice86.Core/Emulator/OperatingSystem/Structures/CountryInfo.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 |
---|---|---|
@@ -1,42 +1,104 @@ | ||
namespace Spice86.Core.Emulator.OperatingSystem.Structures; | ||
|
||
using Spice86.Core.Emulator.Memory.ReaderWriter; | ||
using Spice86.Core.Emulator.OperatingSystem.Enums; | ||
using Spice86.Core.Emulator.ReverseEngineer.DataStructure; | ||
|
||
using System.Diagnostics; | ||
|
||
/// <summary> | ||
/// Represents information about the formatting of dates, times, and numbers for a specific country. | ||
/// </summary> | ||
public class CountryInfo { | ||
[DebuggerDisplay("{CountryId}")] | ||
public class CountryInfo : MemoryBasedDataStructure { | ||
|
||
public CountryInfo(IByteReaderWriter byteReaderWriter) : base(byteReaderWriter, 0) { | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the country code for the specific country, where 1 represents the United States, 2 represents Canada, and so on. | ||
/// </summary> | ||
public byte Country { get; set; } = (byte)CountryId.UnitedStates; | ||
public byte Country { get => UInt8[0]; set => UInt8[0] = value; } | ||
|
||
public CountryId CountryId => (CountryId)Country; | ||
|
||
/// <summary> | ||
/// Gets or sets the format of the date in the specified country. | ||
/// </summary> | ||
public byte DateFormat { get; set; } | ||
public byte DateFormat { get => UInt8[1]; set => UInt8[1] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the currency string for the specified country. | ||
/// </summary> | ||
public string CurrencyString { get => GetZeroTerminatedString(2, 5); set => SetZeroTerminatedString(2, value, 5); } | ||
|
||
/// <summary> | ||
/// Gets or sets the thousands separator for the specified country. | ||
/// </summary> | ||
public byte ThousandsSeparator { get => UInt8[8]; set => UInt8[8] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the decimal separator for the specified country. | ||
/// </summary> | ||
public byte DecimalSeparator { get => UInt8[9]; set => UInt8[9] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the date separator for the specified country. | ||
/// </summary> | ||
public byte DateSeparator { get => UInt8[10]; set => UInt8[10] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the time separator for the specified country. | ||
/// </summary> | ||
public byte TimeSeparator { get => UInt8[11]; set => UInt8[11] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the currency format for the specified country. | ||
/// </summary> | ||
public byte CurrencyFormat { get => UInt8[12]; set => UInt8[12] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the number of digits after the decimal for the specified country. | ||
/// </summary> | ||
public byte DigitsAfterDecimal { get => UInt8[13]; set => UInt8[13] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the time format for the specified country. | ||
/// </summary> | ||
public byte TimeFormat { get => UInt8[14]; set => UInt8[14] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the casemap for the specified country. | ||
/// </summary> | ||
public byte Casemap { get => UInt8[15]; set => UInt8[15] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the data separator for the specified country. | ||
/// </summary> | ||
public byte DataSeparator { get => UInt8[19]; set => UInt8[19] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the character used to separate the components of a date in the specified country. | ||
/// Gets or sets the reserved value 1 for the specified country. | ||
/// </summary> | ||
public byte DateSeparator { get; set; } | ||
public byte Reserved1 { get => UInt8[20]; set => UInt8[20] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the format of the time in the specified country. | ||
/// Gets or sets the reserved value 2 for the specified country. | ||
/// </summary> | ||
public byte TimeFormat { get; set; } | ||
public byte Reserved2 { get => UInt8[21]; set => UInt8[21] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the character used to separate the components of a time in the specified country. | ||
/// Gets or sets the reserved value 3 for the specified country. | ||
/// </summary> | ||
public byte TimeSeparator { get; set; } | ||
public byte Reserved3 { get => UInt8[22]; set => UInt8[22] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the character used to separate thousands in a number in the specified country. | ||
/// Gets or sets the reserved value 4 for the specified country. | ||
/// </summary> | ||
public byte ThousandsSeparator { get; set; } | ||
public byte Reserved4 { get => UInt8[23]; set => UInt8[23] = value; } | ||
|
||
/// <summary> | ||
/// Gets or sets the character used to separate the whole number part from the fractional part in a number in the specified country. | ||
/// Gets or sets the reserved value 5 for the specified country. | ||
/// </summary> | ||
public byte DecimalSeparator { get; set; } | ||
public byte Reserved5 { get => UInt8[24]; set => UInt8[24] = value; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Spice86.Core/Emulator/OperatingSystem/Structures/DosCommandTail.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,16 @@ | ||
namespace Spice86.Core.Emulator.OperatingSystem.Structures; | ||
|
||
using Spice86.Core.Emulator.Memory.ReaderWriter; | ||
using Spice86.Core.Emulator.ReverseEngineer.DataStructure; | ||
|
||
public class DosCommandTail : MemoryBasedDataStructure { | ||
public DosCommandTail(IByteReaderWriter byteReaderWriter, uint baseAddress) : base(byteReaderWriter, baseAddress) { | ||
} | ||
|
||
public string Command { | ||
get => GetZeroTerminatedString(BaseAddress, MaxCharacterLength); | ||
set => SetZeroTerminatedString(BaseAddress, value, MaxCharacterLength); | ||
} | ||
|
||
public const int MaxCharacterLength = 128; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Spice86.Core/Emulator/OperatingSystem/Structures/DosEnvironmentBlock.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,13 @@ | ||
namespace Spice86.Core.Emulator.OperatingSystem.Structures; | ||
|
||
using Spice86.Core.Emulator.Memory.ReaderWriter; | ||
using Spice86.Core.Emulator.ReverseEngineer.DataStructure; | ||
|
||
public abstract class DosEnvironmentBlock : MemoryBasedDataStructure { | ||
protected DosEnvironmentBlock(IByteReaderWriter byteReaderWriter, uint baseAddress) : base(byteReaderWriter, baseAddress) { | ||
} | ||
|
||
public abstract string? GetEnvironmentVariable(string variableName); | ||
|
||
public abstract void SetEnvironmentVariable(string variableName, string value); | ||
} |
Oops, something went wrong.