summaryrefslogtreecommitdiff
path: root/bios/bios.ha
blob: 5a3c1aaa905b33f7e79f071392dcea52cf1144ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Struct defining the contents of the register state used
// for bios calls
export type state = struct {
	@offset(0) eax: u32,
	@offset(4) ebx: u32,
	@offset(8) ecx: u32,
	@offset(12) edx: u32,
	@offset(16) edi: u32,
	@offset(20) esi: u32,
	@offset(24) es: u16,
};

// The set real mode registers
export let regs: state;

// The address of a 512 bytes workspace that is located below 0xFFFFF and can be used to store the results
// of various bios calls
export const @symbol("_ws") ws: [4096]u8;

// The boot drive number as given by the BIOS at boot time
export const @symbol("drive_no") drive_number: u8;

// The amount of sectors per track that the boot drive has
export const @symbol("drive_spt") drive_sectors_per_track: u8;

// The amount of heads that the boot drive has
export const @symbol("drive_heads") drive_heads: u8;

// Clears the BIOS mode registers
export fn clearregs() void = {
	regs = state {
		...
	};
};

// Call a BIOS interrupt
export fn call(intno: u8) void;