forked from AbleOS/ableos
Compare commits
No commits in common. "9f9c7af85faf0a4bc031b9cc5acfe83a7575e9d7" and "1adc381399ae9f288738c4889a0088874b7123d2" have entirely different histories.
9f9c7af85f
...
1adc381399
|
@ -177,9 +177,7 @@ pub fn handler(vm: &mut Vm) {
|
|||
unsafe fn x86_out(address: u16, value: u32) {
|
||||
x86_64::instructions::port::Port::new(address).write(value);
|
||||
}
|
||||
let x = hbvm::value::Value(unsafe { x86_in(r2 as u16) } as u64);
|
||||
info!("Read {:?} from Port {:?}", x, r2);
|
||||
vm.registers[3] = x
|
||||
vm.registers[3] = hbvm::value::Value(unsafe { x86_in(r2 as u16) } as u64);
|
||||
}
|
||||
}
|
||||
// 5
|
||||
|
|
|
@ -6,46 +6,3 @@ length := fn(ptr: ^u8): int {
|
|||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
display_int := fn(num: int, p: ^u8): ^u8 {
|
||||
i := 0;
|
||||
if num == 0 {
|
||||
set(p, 48);
|
||||
return p;
|
||||
}
|
||||
loop {
|
||||
if num == 0 break;
|
||||
set(p + i, num % 10 + 48);
|
||||
num /= 10;
|
||||
i += 1;
|
||||
}
|
||||
reverse(p);
|
||||
//null terminate
|
||||
set(p + i, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
reverse := fn(s: ^u8): void {
|
||||
//reverse a string, don't remove digits
|
||||
len := 0;
|
||||
loop {
|
||||
if *(s + len) == 0 break;
|
||||
len += 1;
|
||||
}
|
||||
i := 0;
|
||||
j := len - 1;
|
||||
loop {
|
||||
if i >= j break;
|
||||
temp := *(s + i);
|
||||
*(s + i) = *(s + j);
|
||||
*(s + j) = temp;
|
||||
i += 1;
|
||||
j -= 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
set := fn(change: ^int, new: int): void {
|
||||
*(change) = new;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[package]
|
||||
name = "time_driver"
|
||||
authors = ["SamBuckley"]
|
||||
|
||||
[dependants.libraries]
|
||||
|
||||
[dependants.binaries]
|
||||
hblang.version = "1.0.0"
|
||||
|
||||
[build]
|
||||
command = "hblang src/main.hb"
|
|
@ -1,21 +0,0 @@
|
|||
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||
log := stn.log;
|
||||
mem := stn.memory;
|
||||
s := stn.string;
|
||||
page := 0
|
||||
|
||||
main := fn(): void {
|
||||
page += mem.request_page(1);
|
||||
port_str := "\0\{47}\0";
|
||||
a := @eca(u8, 3, 3, port_str, 2);
|
||||
|
||||
n := 5000000;
|
||||
loop {
|
||||
if n == 0 break;
|
||||
n -= 1;
|
||||
stack_reclamation_edge_case := 0;
|
||||
}
|
||||
td := s.display_int(a, page);
|
||||
log.debug(td);
|
||||
return;
|
||||
}
|
|
@ -24,8 +24,5 @@ path = "boot:///tests.hbf"
|
|||
# [boot.limine.ableos.modules.diskio_driver]
|
||||
# path = "boot:///diskio_driver.hbf"
|
||||
|
||||
# [boot.limine.ableos.modules.fb_driver]
|
||||
# path = "boot:///fb_driver.hbf"
|
||||
|
||||
[boot.limine.ableos.modules.time_driver]
|
||||
path = "boot:///time_driver.hbf"
|
||||
[boot.limine.ableos.modules.fb_driver]
|
||||
path = "boot:///fb_driver.hbf"
|
||||
|
|
Loading…
Reference in a new issue