forked from AbleOS/ableos
omfg it's fixed 🙏
This commit is contained in:
parent
a8d38e04c4
commit
41b339dfd0
21
Cargo.lock
generated
21
Cargo.lock
generated
|
@ -390,26 +390,25 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbbytecode"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
|
||||
|
||||
[[package]]
|
||||
name = "hbbytecode"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
|
||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
|
||||
|
||||
[[package]]
|
||||
name = "hblang"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
|
||||
dependencies = [
|
||||
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||
"regalloc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hbvm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
|
||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
|
||||
dependencies = [
|
||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||
]
|
||||
|
@ -417,7 +416,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "hbvm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
|
||||
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
|
||||
dependencies = [
|
||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)",
|
||||
]
|
||||
|
@ -900,16 +899,6 @@ dependencies = [
|
|||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regalloc2"
|
||||
version = "0.10.2"
|
||||
source = "git+https://github.com/jakubDoka/regalloc2.git#34d8424a0d74746d231a96239fdb32e3d5ec0245"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"rustc-hash",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.4"
|
||||
|
|
|
@ -4,10 +4,8 @@ receive_message := fn(buffer_id: int, memory_map_location: ^u8, length: int): ^u
|
|||
return @eca(^u8, 4, buffer_id, memory_map_location, length)
|
||||
}
|
||||
|
||||
send_message := fn(msg: ^u8, buffer_id: int): void {
|
||||
msg_length := @inline(string.length, msg)
|
||||
@eca(i32, 3, buffer_id, msg, msg_length)
|
||||
return
|
||||
send_message := fn(msg: ^u8, buffer_id: int, length: int): void {
|
||||
return @eca(void, 3, buffer_id, msg, length)
|
||||
}
|
||||
|
||||
create := fn(msg: ^u8): int {
|
||||
|
|
|
@ -17,48 +17,23 @@ release_page := fn(ptr: ^u8, page_count: u8): void {
|
|||
return @eca(void, 3, 2, msg, 12)
|
||||
}
|
||||
|
||||
// outb := fn(addr: u16, value: u8): void {
|
||||
// msg := [u8; 5].(1, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF), value)
|
||||
// return @eca(void, 3, 3, &msg, 5)
|
||||
// }
|
||||
|
||||
// inb := fn(addr: u16): u8 {
|
||||
// msg := [u8; 4].(0, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF))
|
||||
// return @eca(u8, 3, 3, &msg, 4)
|
||||
// }
|
||||
OutbMsg := struct {a: u8, b: u8, addr: u16, value: u8}
|
||||
InbMsg := struct {a: u8, b: u8, addr: u16}
|
||||
OutlMsg := struct {a: u8, b: u8, addr: u16, value: u32}
|
||||
InlMsg := struct {a: u8, b: u8, addr: u16}
|
||||
|
||||
outb := fn(addr: u16, value: u8): void {
|
||||
msg := "\0\0\0\0\0";
|
||||
*@as(^u8, msg) = @as(u8, 1);
|
||||
*@as(^u8, msg + 1) = @as(u8, 0);
|
||||
*@as(^u16, @bitcast(msg + 2)) = addr;
|
||||
*@as(^u8, msg + 4) = value
|
||||
@eca(void, 3, 3, msg, 5)
|
||||
return
|
||||
return @eca(void, 3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
|
||||
}
|
||||
|
||||
inb := fn(addr: u16): u8 {
|
||||
msg := "\0\0\0\0";
|
||||
*@as(^u8, msg) = @as(u8, 0);
|
||||
*@as(^u8, msg + 1) = @as(u8, 0);
|
||||
*@as(^u16, @bitcast(msg + 2)) = addr
|
||||
return @eca(u8, 3, 3, msg, 4)
|
||||
return @eca(u8, 3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
|
||||
}
|
||||
|
||||
outl := fn(addr: u16, value: u32): void {
|
||||
msg := "\0\0\0\0\0\0\0\0";
|
||||
*@as(^u8, msg) = @as(u8, 1);
|
||||
*@as(^u8, msg + 1) = @as(u8, 2);
|
||||
*@as(^u16, @bitcast(msg + 2)) = addr;
|
||||
*@as(^u32, @bitcast(msg + 4)) = value
|
||||
@eca(void, 3, 3, msg, 8)
|
||||
return
|
||||
return @eca(void, 3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
|
||||
}
|
||||
|
||||
inl := fn(addr: u16): u32 {
|
||||
msg := "\0\0\0\0";
|
||||
*@as(^u8, msg) = @as(u8, 0);
|
||||
*@as(^u8, msg + 1) = @as(u8, 2);
|
||||
*@as(^u16, @bitcast(msg + 2)) = addr
|
||||
return @eca(u32, 3, 3, msg, 4)
|
||||
return @eca(u32, 3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
|
||||
}
|
|
@ -4,43 +4,45 @@ length := fn(ptr: ^u8): int {
|
|||
return len
|
||||
}
|
||||
|
||||
// WTFFF is wrong with display_int
|
||||
display_int := fn(num: int, p: ^u8): ^u8 {
|
||||
i := 0
|
||||
if num == 0 {
|
||||
*p = 48;
|
||||
*(p + 1) = 0
|
||||
return p
|
||||
}
|
||||
|
||||
neg := num < 0
|
||||
if neg {
|
||||
ptr := p
|
||||
negative := num < 0
|
||||
if negative {
|
||||
num = -num
|
||||
}
|
||||
|
||||
if num == 0 {
|
||||
*ptr = 48
|
||||
ptr += 1
|
||||
} else {
|
||||
loop if num == 0 break else {
|
||||
*(p + i) = num % 10 + 48
|
||||
*ptr = num % 10 + 48
|
||||
ptr += 1
|
||||
num /= 10
|
||||
i += 1
|
||||
}
|
||||
|
||||
if neg {
|
||||
*(p + i) = 45
|
||||
i += 1
|
||||
}
|
||||
@inline(reverse, p, i)
|
||||
|
||||
if negative {
|
||||
*ptr = 45
|
||||
ptr += 1
|
||||
};
|
||||
*ptr = 0
|
||||
@inline(reverse, p)
|
||||
return p
|
||||
}
|
||||
|
||||
reverse := fn(p: ^u8, len: int): void {
|
||||
start := 0
|
||||
end := len - 1
|
||||
loop if start >= end break else {
|
||||
temp := *(p + start);
|
||||
*(p + start) = *(p + end);
|
||||
*(p + end) = temp
|
||||
start += 1
|
||||
end -= 1
|
||||
reverse := fn(s: ^u8): void {
|
||||
//reverse a string, don't remove digits
|
||||
len := 0
|
||||
loop if *(s + len) == 0 break else len += 1
|
||||
i := 0
|
||||
j := len - 1
|
||||
temp := 0
|
||||
loop if i >= j break else {
|
||||
temp = *(s + i);
|
||||
*(s + i) = *(s + j);
|
||||
*(s + j) = temp
|
||||
i += 1
|
||||
j -= 1
|
||||
}
|
||||
return
|
||||
}
|
|
@ -12,7 +12,7 @@ main := fn(): int {
|
|||
log.info("PS/2 Keyboard Echoed\0")
|
||||
}
|
||||
a := 0
|
||||
a += 1
|
||||
// a += 1
|
||||
if send_byte(244) == 250 {
|
||||
log.info("Enabled scanning\0")
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ main := fn(): int {
|
|||
}
|
||||
prev_input = input
|
||||
keycode_str := string.display_int(input, ptr)
|
||||
log.info(string.display_int(input, ptr))
|
||||
buffer.send_message(keycode_str, buf)
|
||||
log.info(keycode_str)
|
||||
buffer.send_message(&input, buf, 1)
|
||||
}
|
||||
return 0
|
||||
}
|
Loading…
Reference in a new issue