Skip to content

Commit

Permalink
Added UMA support in BIOS extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-jonsson committed Oct 11, 2024
1 parent ef82cdf commit c271cea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
15 changes: 15 additions & 0 deletions bios/vxtx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Binary file modified bios/vxtx.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/vxt/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand All @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions lib/vxt/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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!"); \
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c271cea

Please sign in to comment.