Skip to content

Commit

Permalink
Update to clarify that INT12 only reports on the first 640k conventio…
Browse files Browse the repository at this point in the history
…nal memory
  • Loading branch information
JorisVanEijden committed Jan 23, 2024
1 parent ca27cbb commit ed1c233
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public SystemBiosInt12Handler(IMemory memory, Cpu cpu, BiosDataArea biosDataArea

/// <inheritdoc />
public override void Run() {
_state.AX = _biosDataArea.MemSizeKb;
_state.AX = _biosDataArea.ConventionalMemorySizeKb;
}
}
5 changes: 4 additions & 1 deletion src/Spice86.Core/Emulator/Memory/BiosDataArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public BiosDataArea(IByteReaderWriter byteReaderWriter) : base(byteReaderWriter,

// Padding at 0x12

public ushort MemSizeKb { get => UInt16[0x13]; set => UInt16[0x13] = value; }
/// <summary>
/// Gets or sets the amount of installed conventional memory in KB.
/// </summary>
public ushort ConventionalMemorySizeKb { get => UInt16[0x13]; init => UInt16[0x13] = value; }

// Padding at 0x15

Expand Down
2 changes: 1 addition & 1 deletion src/Spice86.Core/Emulator/VM/Machine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public Machine(IGui? gui, State cpuState, IOPortDispatcher ioPortDispatcher, ILo
}
IoPortDispatcher = ioPortDispatcher;
BiosDataArea = new BiosDataArea(Memory) {
MemSizeKb = (ushort)Math.Clamp(Memory.Ram.Size / 1024, 0, 1024) // max 1mb.
ConventionalMemorySizeKb = (ushort)Math.Clamp(Memory.Ram.Size / 1024, 0, 640) // max 640k conventional memory
};
CpuState = cpuState;
DualPic = new(CpuState, configuration.FailOnUnhandledPort, configuration.InitializeDOS is false, loggerService);
Expand Down

0 comments on commit ed1c233

Please sign in to comment.