Merge remote-tracking branch 'origin/main'

This commit is contained in:
OmniaX-Dev 2025-10-21 07:31:06 +02:00
commit 9a9de088c6
6 changed files with 22 additions and 2 deletions

Binary file not shown.

View file

@ -1,7 +1,16 @@
@guard _MEMORY_DSS_ @guard _MEMORY_DSS_
@define _REG_OFFSET 0x09
@define _REG_S1 0x07
@define _REG_S2 0x08
@define _USABLE_MEM_START 0x353F
@define _USABLE_MEM_SIZE 0xBAC0
@define _MEM_TABLE_ADDR 0x30FF
.code .code
_init_memory_handler: _init_memory_handler:
mov R6, 0xFAAA
ret ret
_alloc_memory:

View file

@ -32,6 +32,7 @@
SCREEN_WIDTH { MemoryAddresses.CMOS + 0x0007 } SCREEN_WIDTH { MemoryAddresses.CMOS + 0x0007 }
SCREEN_HEIGHT { MemoryAddresses.CMOS + 0x0009 } SCREEN_HEIGHT { MemoryAddresses.CMOS + 0x0009 }
BOOT_DISK { MemoryAddresses.CMOS + 0x0010 } BOOT_DISK { MemoryAddresses.CMOS + 0x0010 }
STACK_SIZE { MemoryAddresses.CMOS + 0x0011 }
DISK_LIST { MemoryAddresses.CMOS + 0x007E } DISK_LIST { MemoryAddresses.CMOS + 0x007E }
@end @end

View file

@ -61,6 +61,13 @@ namespace dragon
void VirtualCPU::pushToStack(int16_t value) void VirtualCPU::pushToStack(int16_t value)
{ {
uint16_t stackAddr = readRegister(data::Registers::SP); uint16_t stackAddr = readRegister(data::Registers::SP);
uint16_t stack_size = DragonRuntime::vCMOS.read16(data::CMOSRegisters::StackSize);
if (stackAddr <= 0xFFFF - stack_size)
{
data::ErrorHandler::pushError(data::ErrorCodes::CPU_StackOverflow, "Stack Overflow: ");
m_halt = true;
return;
}
m_memory.write16(stackAddr, value); m_memory.write16(stackAddr, value);
writeRegister16(data::Registers::SP, stackAddr - 2); writeRegister16(data::Registers::SP, stackAddr - 2);
m_stackFrameSize += 2; m_stackFrameSize += 2;

View file

@ -322,6 +322,7 @@ namespace dragon
vCMOS.write8(data::CMOSRegisters::ScreenRedrawRate, machine_config.screen_redraw_rate_per_second); vCMOS.write8(data::CMOSRegisters::ScreenRedrawRate, machine_config.screen_redraw_rate_per_second);
vCMOS.write16(data::CMOSRegisters::ScreenWidth, static_cast<int16_t>(RawTextRenderer::CONSOLE_CHARS_H)); vCMOS.write16(data::CMOSRegisters::ScreenWidth, static_cast<int16_t>(RawTextRenderer::CONSOLE_CHARS_H));
vCMOS.write16(data::CMOSRegisters::ScreenHeight, static_cast<int16_t>(RawTextRenderer::CONSOLE_CHARS_V)); vCMOS.write16(data::CMOSRegisters::ScreenHeight, static_cast<int16_t>(RawTextRenderer::CONSOLE_CHARS_V));
vCMOS.write16(data::CMOSRegisters::StackSize, 0x1000);
ostd::BitField_16 disk_list_bitfield; ostd::BitField_16 disk_list_bitfield;
disk_list_bitfield.value = 0; disk_list_bitfield.value = 0;
for (int32_t i = 0; i < 16; i++) for (int32_t i = 0; i < 16; i++)

View file

@ -20,6 +20,7 @@ namespace dragon
inline static constexpr uint64_t CPU_UnknownInstruction = 0x2000000000000000; inline static constexpr uint64_t CPU_UnknownInstruction = 0x2000000000000000;
inline static constexpr uint64_t CPU_UnsupportedExtension = 0x2000000000000001; inline static constexpr uint64_t CPU_UnsupportedExtension = 0x2000000000000001;
inline static constexpr uint64_t CPU_StackOverflow = 0x2000000000000002;
inline static constexpr uint64_t BIOS_FailedToLoad = 0x3000000000000000; inline static constexpr uint64_t BIOS_FailedToLoad = 0x3000000000000000;
inline static constexpr uint64_t BIOS_InvalidSize = 0x3000000000000001; inline static constexpr uint64_t BIOS_InvalidSize = 0x3000000000000001;
@ -223,6 +224,7 @@ namespace dragon
inline static constexpr uint8_t ScreenWidth = 0x07; inline static constexpr uint8_t ScreenWidth = 0x07;
inline static constexpr uint8_t ScreenHeight = 0x09; inline static constexpr uint8_t ScreenHeight = 0x09;
inline static constexpr uint8_t BootDisk = 0x10; inline static constexpr uint8_t BootDisk = 0x10;
inline static constexpr uint8_t StackSize = 0x11;
inline static constexpr uint8_t DiskList = 0x7E; inline static constexpr uint8_t DiskList = 0x7E;
}; };