Tiny commit.

This commit is contained in:
peony 2024-12-01 13:10:41 +01:00
parent 5028062e39
commit c429641f98
2 changed files with 51 additions and 42 deletions

61
Cargo.lock generated
View file

@ -73,9 +73,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
dependencies = [ dependencies = [
"shlex", "shlex",
] ]
@ -201,9 +201,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.15.1" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
dependencies = [ dependencies = [
"allocator-api2", "allocator-api2",
"equivalent", "equivalent",
@ -213,12 +213,12 @@ dependencies = [
[[package]] [[package]]
name = "hbbytecode" name = "hbbytecode"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#86ca959ea3eae1cb32298e135a444820583d24a0" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8"
[[package]] [[package]]
name = "hblang" name = "hblang"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#86ca959ea3eae1cb32298e135a444820583d24a0" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8"
dependencies = [ dependencies = [
"hashbrown", "hashbrown",
"hbbytecode", "hbbytecode",
@ -229,7 +229,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#86ca959ea3eae1cb32298e135a444820583d24a0" source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#cf672beb79378fa2af529e12fd955204da443ac8"
dependencies = [ dependencies = [
"hbbytecode", "hbbytecode",
] ]
@ -375,9 +375,9 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.6.0" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown", "hashbrown",
@ -401,7 +401,7 @@ dependencies = [
"uart_16550", "uart_16550",
"versioning", "versioning",
"x2apic", "x2apic",
"x86_64 0.15.1", "x86_64 0.15.2",
"xml", "xml",
] ]
@ -421,9 +421,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.164" version = "0.2.167"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
[[package]] [[package]]
name = "limine" name = "limine"
@ -433,9 +433,9 @@ checksum = "02034f8f6b3e7bf050f310fbaf6db0018b8e54b75598d0a4c97172054752fede"
[[package]] [[package]]
name = "litemap" name = "litemap"
version = "0.7.4" version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
@ -593,9 +593,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.18" version = "0.23.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
dependencies = [ dependencies = [
"log", "log",
"once_cell", "once_cell",
@ -726,9 +726,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.89" version = "2.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -827,17 +827,20 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "ureq" name = "ureq"
version = "2.10.1" version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" checksum = "b30e6f97efe1fa43535ee241ee76967d3ff6ff3953ebb430d8d55c5393029e7b"
dependencies = [ dependencies = [
"base64", "base64",
"litemap",
"log", "log",
"once_cell", "once_cell",
"rustls", "rustls",
"rustls-pki-types", "rustls-pki-types",
"url", "url",
"webpki-roots", "webpki-roots",
"yoke",
"zerofrom",
] ]
[[package]] [[package]]
@ -996,7 +999,7 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"paste", "paste",
"raw-cpuid 10.7.0", "raw-cpuid 10.7.0",
"x86_64 0.14.12", "x86_64 0.14.13",
] ]
[[package]] [[package]]
@ -1012,9 +1015,9 @@ dependencies = [
[[package]] [[package]]
name = "x86_64" name = "x86_64"
version = "0.14.12" version = "0.14.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96cb6fd45bfeab6a5055c5bffdb08768bd0c069f1d946debe585bbb380a7c062" checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"bitflags 2.6.0", "bitflags 2.6.0",
@ -1024,9 +1027,9 @@ dependencies = [
[[package]] [[package]]
name = "x86_64" name = "x86_64"
version = "0.15.1" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bc79523af8abf92fb1a970c3e086c5a343f6bcc1a0eb890f575cbb3b45743df" checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae"
dependencies = [ dependencies = [
"bit_field", "bit_field",
"bitflags 2.6.0", "bitflags 2.6.0",
@ -1044,9 +1047,9 @@ dependencies = [
[[package]] [[package]]
name = "yoke" name = "yoke"
version = "0.7.5" version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
dependencies = [ dependencies = [
"serde", "serde",
"stable_deref_trait", "stable_deref_trait",
@ -1068,9 +1071,9 @@ dependencies = [
[[package]] [[package]]
name = "zerofrom" name = "zerofrom"
version = "0.1.5" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
dependencies = [ dependencies = [
"zerofrom-derive", "zerofrom-derive",
] ]

View file

@ -5,34 +5,38 @@
port1 := @as(Port, PORT_AT_STARTUP) port1 := @as(Port, PORT_AT_STARTUP)
port2 := @as(Port, PORT_AT_STARTUP) port2 := @as(Port, PORT_AT_STARTUP)
$disable_port1 := fn(): void memory.outb(0x64, 0xAD) //wiki.osdev.org/"8042"_PS/2_Controller#PS/2_Controller_IO_Ports
$enable_port1 := fn(): void memory.outb(0x64, 0xAE) $CONTROLLER_PORT := 0x64
$disable_port2 := fn(): void memory.outb(0x64, 0xA7) $DATA_PORT := 0x60n
$enable_port2 := fn(): void memory.outb(0x64, 0xA8)
$disable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAD)
$enable_port1 := fn(): void memory.outb(CONTROLLER_PORT, 0xAE)
$disable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA7)
$enable_port2 := fn(): void memory.outb(CONTROLLER_PORT, 0xA8)
test_port1 := fn(): bool { test_port1 := fn(): bool {
memory.outb(0x64, 0xAB) memory.outb(CONTROLLER_PORT, 0xAB)
loop if has_input(get_info()) break loop if has_input(get_info()) break
input := get_input() input := get_input()
return input == 0x0 return input == 0x0
} }
test_port2 := fn(): bool { test_port2 := fn(): bool {
memory.outb(0x64, 0xA9) memory.outb(CONTROLLER_PORT, 0xA9)
loop if has_input(get_info()) break loop if has_input(get_info()) break
input := get_input() input := get_input()
return input == 0x0 return input == 0x0
} }
get_config_byte := fn(): u8 { get_config_byte := fn(): u8 {
memory.outb(0x64, 0x20) memory.outb(CONTROLLER_PORT, 0x20)
loop if has_input(get_info()) break loop if has_input(get_info()) break
return get_input() return get_input()
} }
Info := struct {d: u8} Info := struct {d: u8}
$get_info := fn(): Info return .(memory.inb(0x64)) $get_info := fn(): Info return .(memory.inb(CONTROLLER_PORT))
//inline when can //inline when can
has_input := fn(info: Info): bool return bit0(info.d) has_input := fn(info: Info): bool return bit0(info.d)
can_send := fn(info: Info): bool return bit1(info.d) == false can_send := fn(info: Info): bool return bit1(info.d) == false
@ -46,16 +50,18 @@ get_port := fn(info: Info): ^Port {
} }
} }
//T
port2_ptr := &port2
send_byte := fn(port: ^Port, byte: u8): void { send_byte := fn(port: ^Port, byte: u8): void {
if port == &port2 { if port == port2_ptr {
memory.outb(0x64, 0xD4) memory.outb(CONTROLLER_PORT, 0xD4)
} }
loop if can_send(get_info()) break loop if can_send(get_info()) break
memory.outb(0x60, byte) memory.outb(DATA_PORT, byte)
} }
$get_input := fn(): u8 return memory.inb(0x60) $get_input := fn(): u8 return memory.inb(DATA_PORT)
$write_out := fn(data: u8): void memory.outb(0x60, data) $write_out := fn(data: u8): void memory.outb(DATA_PORT, data)
flush_input := fn(): void { flush_input := fn(): void {
loop if has_input(get_info()) == false break else get_info() loop if has_input(get_info()) == false break else get_info()