-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Bios INT 12h to report installed memory size. (#562)
* Add Bios INT 12h to report installed memory size. * Update to clarify that INT12 only reports on the first 640k conventional memory
- Loading branch information
1 parent
7f5114a
commit de0094b
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/Spice86.Core/Emulator/InterruptHandlers/Bios/SystemBiosInt12Handler.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,31 @@ | ||
namespace Spice86.Core.Emulator.InterruptHandlers.Bios; | ||
|
||
using Spice86.Core.Emulator.CPU; | ||
using Spice86.Core.Emulator.Memory; | ||
using Spice86.Shared.Interfaces; | ||
|
||
/// <summary> | ||
/// INT 12h handler. Reports how many kb of base memory is installed. | ||
/// </summary> | ||
public class SystemBiosInt12Handler : InterruptHandler { | ||
private readonly BiosDataArea _biosDataArea; | ||
|
||
/// <summary> | ||
/// Initializes a new instance. | ||
/// </summary> | ||
/// <param name="memory"></param> | ||
/// <param name="cpu"></param> | ||
/// <param name="biosDataArea"></param> | ||
/// <param name="loggerService"></param> | ||
public SystemBiosInt12Handler(IMemory memory, Cpu cpu, BiosDataArea biosDataArea, ILoggerService loggerService) : base(memory, cpu, loggerService) { | ||
_biosDataArea = biosDataArea; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override byte VectorNumber => 0x12; | ||
|
||
/// <inheritdoc /> | ||
public override void Run() { | ||
_state.AX = _biosDataArea.ConventionalMemorySizeKb; | ||
} | ||
} |
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