From c271cea054cec7d6a69fcf3da0f98d0f45276ed6 Mon Sep 17 00:00:00 2001 From: Andreas T Jonsson Date: Fri, 11 Oct 2024 16:34:36 +0200 Subject: [PATCH] Added UMA support in BIOS extension. --- bios/vxtx.asm | 15 +++++++++++++++ bios/vxtx.bin | Bin 2048 -> 2048 bytes lib/vxt/system.c | 4 ++-- lib/vxt/system.h | 6 ++++-- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bios/vxtx.asm b/bios/vxtx.asm index 0324905b..5577e3d0 100644 --- a/bios/vxtx.asm +++ b/bios/vxtx.asm @@ -54,6 +54,17 @@ int_13_handler: pop ax iret + +int_15_handler: + cmp ah, 0x88 + jne .error + mov ax, 64 ; Extended memory in KB. + clc + iret +.error: + mov ah, 0x86 + stc + iret int_19_handler: push bp @@ -77,6 +88,9 @@ install_handlers: mov word [INT_13_OFFSET], int_13_handler mov [INT_13_OFFSET+2], cs + mov word [INT_15_OFFSET], int_15_handler + mov [INT_15_OFFSET+2], cs + mov word [INT_19_OFFSET], int_19_handler mov [INT_19_OFFSET+2], cs @@ -95,6 +109,7 @@ install_handlers: ;;;;;;;;;;;;;;;;;; Data ;;;;;;;;;;;;;;;;;; INT_13_OFFSET equ 0x4C +INT_15_OFFSET equ 0x54 INT_19_OFFSET equ 0x64 db 'VXTX - VirtualXT BIOS Extensions', 0xA diff --git a/bios/vxtx.bin b/bios/vxtx.bin index faa2daf6aa969f4ea2cb25030c6bb1c6e3dfc372..954a04f7c7eeddcd0646ad3443a9fefe60f267bc 100644 GIT binary patch delta 67 zcmV-J0KETz5P%RTRjLH*0G#^hF94m(=CM$mSXGJTiAD%rSkHj`h;;?HKmhp9w1)YS Z86^!=02%;{4psoi24nyzu|cK>0r~UN8{hx{ delta 46 zcmV+}0MY+|5P%RFRjLH*0G#^hApo7r=CM$mSXGJTiAD%rSdk|s17rXiv00`Ek?GhX4Qo diff --git a/lib/vxt/system.c b/lib/vxt/system.c index 75337ff3..7b8d9596 100644 --- a/lib/vxt/system.c +++ b/lib/vxt/system.c @@ -381,7 +381,7 @@ VXT_API vxt_byte vxt_system_read_byte(CONSTP(vxt_system) s, vxt_pointer addr) { if (addr >= 0x100000) { addr -= 0x100000; - return (addr >= UMA_SIZE) ? 0xFF : s->ext_mem[addr]; + return (addr >= EXT_MEM_SIZE) ? 0xFF : s->ext_mem[addr]; } CONSTSP(vxt_peripheral) dev = s->devices[s->mem_map[addr >> 4]]; @@ -394,7 +394,7 @@ VXT_API void vxt_system_write_byte(CONSTP(vxt_system) s, vxt_pointer addr, vxt_b if (addr >= 0x100000) { addr -= 0x100000; - if (addr < UMA_SIZE) + if (addr < EXT_MEM_SIZE) s->ext_mem[addr] = data; return; } diff --git a/lib/vxt/system.h b/lib/vxt/system.h index 4a562c51..0ab58903 100644 --- a/lib/vxt/system.h +++ b/lib/vxt/system.h @@ -29,9 +29,11 @@ #define MAX_TIMERS 256 #define INT64 long long -#define UMA_SIZE (0x10000 - 16) #define PERIPHERAL_SIGNATURE 0xFAF129C3 + // Set this to 64K (not 64-16) because anything less causes problem with himem.sys. +#define EXT_MEM_SIZE 0x10000 + #define VERIFY_PERIPHERAL(p, r) \ if (((struct peripheral*)(p))->sig != PERIPHERAL_SIGNATURE) { \ VXT_LOG("Invalid peripheral!"); \ @@ -61,7 +63,7 @@ struct system { vxt_byte io_map[VXT_IO_MAP_SIZE]; vxt_byte mem_map[VXT_MEM_MAP_SIZE]; - vxt_byte ext_mem[UMA_SIZE]; + vxt_byte ext_mem[EXT_MEM_SIZE]; vxt_allocator *alloc; struct cpu cpu;