ableos/sysdata/libraries/stn/src/memory.hb
koniifer 19992595fc update hblang to latest git
remove old ps/2 driver
remove defunct time driver
clean up stuff
i promise im done fiddling with ecah.rs and memory.hb
2024-09-02 01:04:00 +01:00

54 lines
1.1 KiB
Plaintext

request_page := fn(page_count: u8): ^u8 {
msg := "\{00}\{01}xxxxxxxx\0"
msg_page_count := msg + 1;
*msg_page_count = page_count
return @eca(^u8, 3, 2, msg, 12)
}
release_page := fn(ptr: ^u8, page_count: u8): void {
msg := "\{01}\{00}xxxxxxxx\0"
msg_page_count := msg + 1;
*msg_page_count = page_count
msg_ptr := @as(^^u8, @bitcast(msg + 2));
*msg_ptr = ptr
return @eca(void, 3, 2, msg, 12)
}
outb := fn(addr: u16, value: u8): void {
msg := "\0\0\0\0\0";
*msg = 1;
*(msg + 1) = 0;
*@as(^u16, @bitcast(msg + 2)) = addr;
*(msg + 4) = value
@eca(void, 3, 3, msg, 5)
return
}
inb := fn(addr: u16): u8 {
msg := "\0\0\0\0";
*msg = 0;
*(msg + 1) = 0;
*@as(^u16, @bitcast(msg + 2)) = addr
return @eca(u8, 3, 3, msg, 4)
}
outl := fn(addr: u16, value: u32): void {
msg := "\0\0\0\0\0\0\0\0";
*msg = 1;
*(msg + 1) = 2;
*@as(^u16, @bitcast(msg + 2)) = addr;
*@as(^u32, @bitcast(msg + 4)) = value
@eca(void, 3, 3, msg, 8)
return
}
inl := fn(addr: u16): u32 {
msg := "\0\0\0\0";
*msg = 0;
*(msg + 1) = 2;
*@as(^u16, @bitcast(msg + 2)) = addr
return @eca(u32, 3, 3, msg, 4)
}