diff options
Diffstat (limited to 'bios')
| -rw-r--r-- | bios/bios.ha | 41 | ||||
| -rw-r--r-- | bios/drive/+x86_64/drive.s | 7 | ||||
| -rw-r--r-- | bios/drive/drive.ha | 5 |
3 files changed, 53 insertions, 0 deletions
diff --git a/bios/bios.ha b/bios/bios.ha new file mode 100644 index 0000000..afae0f6 --- /dev/null +++ b/bios/bios.ha @@ -0,0 +1,41 @@ +// 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) ds: u16, + @offset(26) es: u16, + @offset(28) ss: u16, + @offset(30) gs: u16, + @offset(32) fs: 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: u16; + +// 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; diff --git a/bios/drive/+x86_64/drive.s b/bios/drive/+x86_64/drive.s new file mode 100644 index 0000000..1f3828e --- /dev/null +++ b/bios/drive/+x86_64/drive.s @@ -0,0 +1,7 @@ +.code16 + +.globl bios.drive.read +bios.drive.read: + mov $0x2, %ah + int $0x13 + ret diff --git a/bios/drive/drive.ha b/bios/drive/drive.ha new file mode 100644 index 0000000..35cccca --- /dev/null +++ b/bios/drive/drive.ha @@ -0,0 +1,5 @@ +export let @symbol("drive_no") drive_no: u8; +export let @symbol("drive_spt") drive_spt: u8; +export let @symbol("drive_heads") drive_heads: u8; + +export fn read() void; |
