omfg it's fixed 🙏

This commit is contained in:
koniifer 2024-09-16 21:56:52 +01:00 committed by Able
parent 78553a3190
commit 48027196b1
5 changed files with 72 additions and 97 deletions

51
Cargo.lock generated
View file

@ -391,37 +391,48 @@ dependencies = [
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" version = "0.1.0"
<<<<<<< HEAD <<<<<<< HEAD
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b"
=======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
>>>>>>> 1f4fce0 (please bugs begone)
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
[[package]]
name = "hblang"
version = "0.1.0"
<<<<<<< HEAD <<<<<<< HEAD
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b"
======= =======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
>>>>>>> 1f4fce0 (please bugs begone) >>>>>>> 1f4fce0 (please bugs begone)
=======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
>>>>>>> 41b339d (omfg it's fixed 🙏)
[[package]]
name = "hbbytecode"
version = "0.1.0"
source = "git+https://git.ablecorp.us/ableos/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
[[package]]
name = "hblang"
version = "0.1.0"
<<<<<<< HEAD
<<<<<<< HEAD
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b"
=======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
>>>>>>> 1f4fce0 (please bugs begone)
=======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
>>>>>>> 41b339d (omfg it's fixed 🙏)
dependencies = [ dependencies = [
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
"regalloc2",
] ]
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" version = "0.1.0"
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#4a9b9de87fd56a6bbd5d0ca2c622104d4807612b"
======= =======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faf068885a42aedbb6a2bc50e21cb6d34f211cdb"
>>>>>>> 1f4fce0 (please bugs begone) >>>>>>> 1f4fce0 (please bugs begone)
=======
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#254d5ed96234c8291770d84b2ac11ef7dd403b28"
>>>>>>> 41b339d (omfg it's fixed 🙏)
dependencies = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)", "hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
] ]
@ -429,7 +440,7 @@ dependencies = [
[[package]] [[package]]
name = "hbvm" name = "hbvm"
version = "0.1.0" 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 = [ dependencies = [
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)", "hbbytecode 0.1.0 (git+https://git.ablecorp.us/ableos/holey-bytes.git)",
] ]
@ -912,16 +923,6 @@ dependencies = [
"bitflags 1.3.2", "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]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.8.4" version = "0.8.4"

View file

@ -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) return @eca(^u8, 4, buffer_id, memory_map_location, length)
} }
send_message := fn(msg: ^u8, buffer_id: int): void { send_message := fn(msg: ^u8, buffer_id: int, length: int): void {
msg_length := @inline(string.length, msg) return @eca(void, 3, buffer_id, msg, length)
@eca(i32, 3, buffer_id, msg, msg_length)
return
} }
create := fn(msg: ^u8): int { create := fn(msg: ^u8): int {

View file

@ -17,48 +17,23 @@ release_page := fn(ptr: ^u8, page_count: u8): void {
return @eca(void, 3, 2, msg, 12) return @eca(void, 3, 2, msg, 12)
} }
// outb := fn(addr: u16, value: u8): void { OutbMsg := struct {a: u8, b: u8, addr: u16, value: u8}
// msg := [u8; 5].(1, 0, @as(u8, addr & 0xFF), @as(u8, addr >> 8 & 0xFF), value) InbMsg := struct {a: u8, b: u8, addr: u16}
// return @eca(void, 3, 3, &msg, 5) OutlMsg := struct {a: u8, b: u8, addr: u16, value: u32}
// } InlMsg := struct {a: u8, b: u8, addr: u16}
// 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)
// }
outb := fn(addr: u16, value: u8): void { outb := fn(addr: u16, value: u8): void {
msg := "\0\0\0\0\0"; return @eca(void, 3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
*@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
} }
inb := fn(addr: u16): u8 { inb := fn(addr: u16): u8 {
msg := "\0\0\0\0"; return @eca(u8, 3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
*@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)
} }
outl := fn(addr: u16, value: u32): void { outl := fn(addr: u16, value: u32): void {
msg := "\0\0\0\0\0\0\0\0"; return @eca(void, 3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
*@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
} }
inl := fn(addr: u16): u32 { inl := fn(addr: u16): u32 {
msg := "\0\0\0\0"; return @eca(u32, 3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
*@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)
} }

View file

@ -3,45 +3,46 @@ length := fn(ptr: ^u8): int {
loop if *(ptr + len) == 0 break else len += 1 loop if *(ptr + len) == 0 break else len += 1
return len return len
} }
display_int := fn(num: int, p: ^u8): ^u8 {
i := 0
if num == 0 {
*p = 48;
*(p + 1) = 0
return p
}
neg := false // WTFFF is wrong with display_int
if num < 0 { display_int := fn(num: int, p: ^u8): ^u8 {
neg = true ptr := p
negative := num < 0
if negative {
num = -num num = -num
} }
if num == 0 {
*ptr = 48
ptr += 1
} else {
loop if num == 0 break else { loop if num == 0 break else {
*(p + i) = num % 10 + 48 *ptr = num % 10 + 48
ptr += 1
num /= 10 num /= 10
i += 1
} }
if neg {
*(p + i) = 45
i += 1
} }
if negative {
reverse(p, i) *ptr = 45
ptr += 1
};
*ptr = 0
@inline(reverse, p)
return p return p
} }
reverse := fn(p: ^u8, len: int): void { reverse := fn(s: ^u8): void {
start := 0 //reverse a string, don't remove digits
end := len - 1 len := 0
loop if start >= end break else { loop if *(s + len) == 0 break else len += 1
temp := *(p + start); i := 0
*(p + start) = *(p + end); j := len - 1
*(p + end) = temp temp := 0
start += 1 loop if i >= j break else {
end -= 1 temp = *(s + i);
*(s + i) = *(s + j);
*(s + j) = temp
i += 1
j -= 1
} }
return return
} }

View file

@ -12,7 +12,7 @@ main := fn(): int {
log.info("PS/2 Keyboard Echoed\0") log.info("PS/2 Keyboard Echoed\0")
} }
a := 0 a := 0
a += 1 // a += 1
if send_byte(244) == 250 { if send_byte(244) == 250 {
log.info("Enabled scanning\0") log.info("Enabled scanning\0")
} }
@ -26,8 +26,8 @@ main := fn(): int {
} }
prev_input = input prev_input = input
keycode_str := string.display_int(input, ptr) keycode_str := string.display_int(input, ptr)
log.info(string.display_int(input, ptr)) log.info(keycode_str)
buffer.send_message(keycode_str, buf) buffer.send_message(&input, buf, 1)
} }
return 0 return 0
} }