From 5af563175577e18e264724ec0922a4b1b5c649b8 Mon Sep 17 00:00:00 2001 From: koniifer Date: Fri, 25 Oct 2024 16:37:38 +0100 Subject: [PATCH] minor changes --- Cargo.lock | 685 ++---------------- dev/src/main.rs | 5 +- kernel/src/holeybytes/ecah.rs | 10 +- .../holeybytes/kernel_services/mem_serve.rs | 19 +- kernel/src/lib.rs | 4 +- repbuild/Cargo.toml | 10 +- repbuild/src/dev.rs | 23 +- repbuild/src/main.rs | 45 +- sysdata/libraries/horizon_api/src/lib.hb | 4 +- sysdata/libraries/render/src/image.hb | 11 +- sysdata/libraries/render/src/software.hb | 58 +- sysdata/libraries/stn/src/buffer.hb | 8 + sysdata/libraries/stn/src/log.hb | 4 +- sysdata/libraries/stn/src/memory.hb | 46 +- sysdata/libraries/stn/src/random.hb | 5 +- sysdata/libraries/stn/src/string.hb | 19 +- sysdata/programs/dt_buffer_test/src/main.hb | 10 +- .../filesystem_fat32/src/attributes.hb | 12 +- .../src/bios_parameter_block.hb | 17 +- sysdata/programs/filesystem_fat32/src/file.hb | 2 +- sysdata/programs/filesystem_fat32/src/main.hb | 2 +- sysdata/programs/horizon/src/main.hb | 18 +- sysdata/programs/ps2_driver/src/main.hb | 2 +- .../render_example/src/examples/image.hb | 6 +- .../render_example/src/examples/lines.hb | 4 +- .../render_example/src/examples/random.hb | 10 +- .../render_example/src/examples/square.hb | 10 +- .../render_example/src/examples/surface.hb | 24 +- .../src/examples/tactical_screen.hb | 12 +- sysdata/programs/serial_driver/src/main.hb | 2 +- sysdata/programs/tests/src/main.hb | 6 +- sysdata/system_config.toml | 12 +- 32 files changed, 264 insertions(+), 841 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 536d960..5b028ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,21 +11,6 @@ dependencies = [ "tock-registers", ] -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "allocator-api2" version = "0.2.18" @@ -49,9 +34,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "autocfg" @@ -59,21 +44,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets", -] - [[package]] name = "base64" version = "0.22.1" @@ -115,6 +85,9 @@ name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +dependencies = [ + "allocator-api2", +] [[package]] name = "byteorder" @@ -122,12 +95,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "bytes" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" - [[package]] name = "cc" version = "1.1.31" @@ -255,56 +222,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -317,10 +234,10 @@ dependencies = [ ] [[package]] -name = "gimli" -version = "0.31.1" +name = "hashbrown" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" @@ -336,129 +253,28 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61" dependencies = [ - "hashbrown", + "hashbrown 0.15.0", "hbbytecode", "hbvm", "log", + "regalloc2", ] [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#15e4762d4ac8993d12fe2dd54e2b2d842c8a034b" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#faa8dd2e6fabe2e0e4a375e677171856da491c61" dependencies = [ "hbbytecode", ] -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "http" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" -dependencies = [ - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" - -[[package]] -name = "hyper" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", - "webpki-roots", -] - -[[package]] -name = "hyper-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - [[package]] name = "iana-time-zone" version = "0.1.61" @@ -499,21 +315,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", ] -[[package]] -name = "ipnet" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - [[package]] name = "js-sys" version = "0.3.72" @@ -530,7 +334,7 @@ dependencies = [ "aarch64-cpu", "crossbeam-queue", "derive_more", - "hashbrown", + "hashbrown 0.15.0", "hbvm", "limine", "log", @@ -617,33 +421,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys 0.52.0", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -653,15 +430,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.36.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.20.2" @@ -680,84 +448,15 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] -[[package]] -name = "quinn" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" -dependencies = [ - "bytes", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "quinn-proto" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" -dependencies = [ - "bytes", - "rand", - "ring", - "rustc-hash", - "rustls", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - -[[package]] -name = "quinn-udp" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" -dependencies = [ - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.59.0", -] - [[package]] name = "quote" version = "1.0.37" @@ -767,36 +466,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "raw-cpuid" version = "10.7.0" @@ -815,6 +484,19 @@ dependencies = [ "bitflags 2.6.0", ] +[[package]] +name = "regalloc2" +version = "0.10.2" +source = "git+https://github.com/jakubDoka/regalloc2?branch=reuse-allocations#21c43e3ee182824e92e2b25f1d3c03ed47f9c02b" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown 0.14.5", + "log", + "rustc-hash", + "smallvec", +] + [[package]] name = "regex-syntax" version = "0.8.5" @@ -831,52 +513,9 @@ dependencies = [ "hblang", "log", "raw-cpuid 11.2.0", - "reqwest", "str-reader", "toml", -] - -[[package]] -name = "reqwest" -version = "0.12.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" -dependencies = [ - "base64", - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pemfile", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "windows-registry", + "ureq", ] [[package]] @@ -891,15 +530,9 @@ dependencies = [ "libc", "spin", "untrusted", - "windows-sys 0.52.0", + "windows-sys", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustc-hash" version = "2.0.0" @@ -921,6 +554,7 @@ version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ + "log", "once_cell", "ring", "rustls-pki-types", @@ -929,15 +563,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" version = "1.10.0" @@ -961,12 +586,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - [[package]] name = "sbi" version = "0.2.0" @@ -987,36 +606,24 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "serde_json" -version = "1.0.132" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - [[package]] name = "serde_spanned" version = "0.6.8" @@ -1026,18 +633,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "shlex" version = "1.3.0" @@ -1059,16 +654,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "spin" version = "0.9.8" @@ -1092,44 +677,15 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -dependencies = [ - "futures-core", -] - -[[package]] -name = "thiserror" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tinyvec" version = "1.8.0" @@ -1151,32 +707,6 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "696941a0aee7e276a165a978b37918fd5d22c55c3d6bda197813070ca9c0f21c" -[[package]] -name = "tokio" -version = "1.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls", - "rustls-pki-types", - "tokio", -] - [[package]] name = "toml" version = "0.8.19" @@ -1211,37 +741,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "uart_16550" version = "0.3.1" @@ -1286,6 +785,21 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +dependencies = [ + "base64", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.5.2" @@ -1311,15 +825,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1352,18 +857,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.95" @@ -1393,16 +886,6 @@ version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" -[[package]] -name = "web-sys" -version = "0.3.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "webpki-roots" version = "0.26.6" @@ -1421,36 +904,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-registry" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" -dependencies = [ - "windows-result", - "windows-strings", - "windows-targets", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result", - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -1460,15 +913,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-targets" version = "0.52.6" @@ -1598,27 +1042,6 @@ dependencies = [ "serde", ] -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zeroize" version = "1.8.1" diff --git a/dev/src/main.rs b/dev/src/main.rs index aaa017b..488c63b 100644 --- a/dev/src/main.rs +++ b/dev/src/main.rs @@ -1,4 +1,3 @@ -#![allow(unused)] use std::io::Write; use idl::build_idl; @@ -139,8 +138,8 @@ fn build(name: String) { } } -pub fn build_program(name: String) {} -pub fn build_library(name: String) {} +pub fn build_program(_name: String) {} +pub fn build_library(_name: String) {} fn help() { println!( diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index 5535113..ab45e64 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -131,9 +131,13 @@ pub fn handler(vm: &mut Vm) { 3 => unimplemented!("TODO: implement whatever buffer 3 does for no x86_64"), // source of rng 4 => { - // limit to last 32 bits - vm.registers[1] = - hbvm::value::Value(crate::arch::hardware_random_u64() & 0xFFFFFFFF); + let block = block_read(mem_addr, length); + block.chunks_mut(8.min(length)).for_each(|chunk| { + chunk.clone_from_slice( + &crate::arch::hardware_random_u64().to_le_bytes()[..chunk.len()], + ); + }); + vm.registers[1] = hbvm::value::Value(mem_addr); } 5 => match dt_msg_handler(vm, mem_addr, length) { Ok(()) => {} diff --git a/kernel/src/holeybytes/kernel_services/mem_serve.rs b/kernel/src/holeybytes/kernel_services/mem_serve.rs index 743440e..b769390 100644 --- a/kernel/src/holeybytes/kernel_services/mem_serve.rs +++ b/kernel/src/holeybytes/kernel_services/mem_serve.rs @@ -38,7 +38,7 @@ unsafe fn memset(mut dest: *mut u8, src: *const u8, count: usize, size: usize) { let mut buffer_size = size; src.copy_to_nonoverlapping(buffer.as_mut_ptr(), size); - while buffer_size * 2 <= BLOCK_SIZE { + while core::intrinsics::likely(buffer_size * 2 <= BLOCK_SIZE) { buffer .as_mut_ptr() .copy_to_nonoverlapping(buffer.as_mut_ptr().add(buffer_size), buffer_size); @@ -53,7 +53,7 @@ unsafe fn memset(mut dest: *mut u8, src: *const u8, count: usize, size: usize) { remaining -= 1; } - while remaining >= 8 { + while core::intrinsics::likely(remaining >= 8) { *(dest as *mut u64) = *buffer_ptr; dest = dest.add(8); remaining -= 8; @@ -122,18 +122,17 @@ pub fn memory_msg_handler( log::debug!(" {} pages", page_count); } 4 => unsafe { - let count = u64::from_le_bytes(msg_vec[1..9].try_into().unwrap_unchecked()) as usize; - let src = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as *const u8; - let dest = u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *mut u8; + let count = u32::from_le_bytes(msg_vec[1..5].try_into().unwrap_unchecked()) as usize; + let src = u64::from_le_bytes(msg_vec[5..13].try_into().unwrap_unchecked()) as *const u8; + let dest = u64::from_le_bytes(msg_vec[13..21].try_into().unwrap_unchecked()) as *mut u8; src.copy_to_nonoverlapping(dest, count); }, 5 => unsafe { - let count = u64::from_le_bytes(msg_vec[1..9].try_into().unwrap_unchecked()) as usize; - let size = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as usize; - let src = - u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *const u8; - let dest = u64::from_le_bytes(msg_vec[25..33].try_into().unwrap_unchecked()) as *mut u8; + let count = u32::from_le_bytes(msg_vec[1..5].try_into().unwrap_unchecked()) as usize; + let size = u32::from_le_bytes(msg_vec[5..9].try_into().unwrap_unchecked()) as usize; + let src = u64::from_le_bytes(msg_vec[9..17].try_into().unwrap_unchecked()) as *const u8; + let dest = u64::from_le_bytes(msg_vec[17..25].try_into().unwrap_unchecked()) as *mut u8; memset(dest, src, count, size); }, diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 9a8060b..a94f94b 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -6,6 +6,7 @@ slice_split_once, exclusive_wrapper, new_uninit, + core_intrinsics, abi_x86_interrupt, alloc_error_handler, ptr_sub_ptr, @@ -14,8 +15,7 @@ pointer_is_aligned_to )] #![test_runner(crate::test_runner)] -#![cfg_attr(not(debug_assertions), allow(unused, deprecated))] -#![allow(dead_code)] +#![allow(dead_code, internal_features)] extern crate alloc; mod allocator; diff --git a/repbuild/Cargo.toml b/repbuild/Cargo.toml index 01e7755..ea41857 100644 --- a/repbuild/Cargo.toml +++ b/repbuild/Cargo.toml @@ -22,11 +22,13 @@ fatfs = "0.3" toml = "0.8" hblang = { git = "https://git.ablecorp.us/AbleOS/holey-bytes.git", features = [ "std", + "opts", ], default-features = false } log = "0.4" raw-cpuid = "11" +ureq = { version = "2", default-features = false, features = ["tls"] } -[dependencies.reqwest] -version = "0.12" -default-features = false -features = ["rustls-tls", "blocking"] +# [dependencies.reqwest] +# version = "0.12" +# default-features = false +# features = ["rustls-tls", "blocking"] diff --git a/repbuild/src/dev.rs b/repbuild/src/dev.rs index 2e81228..7186d39 100644 --- a/repbuild/src/dev.rs +++ b/repbuild/src/dev.rs @@ -63,7 +63,7 @@ impl Package { build_cmd, } } - pub fn build(&self) { + pub fn build(&self) -> std::io::Result<()> { if self.binaries.contains(&"hblang".to_string()) { let file = self.build_cmd.split_ascii_whitespace().last().unwrap(); @@ -71,15 +71,24 @@ impl Package { let mut bytes = Vec::new(); // compile here - let _ = hblang::run_compiler( + hblang::run_compiler( &path, Options { fmt: true, + optimize: true, ..Default::default() }, &mut bytes, - ); - let _ = hblang::run_compiler(&path, Default::default(), &mut bytes); + )?; + + hblang::run_compiler( + &path, + Options { + optimize: true, + ..Default::default() + }, + &mut bytes, + )?; match std::fs::create_dir("target/programs") { Ok(_) => (), @@ -88,15 +97,17 @@ impl Package { } std::fs::write(format!("target/programs/{}.hbf", self.name), &bytes).unwrap(); bytes.clear(); - let _ = hblang::run_compiler( + hblang::run_compiler( &path, Options { dump_asm: true, + optimize: true, ..Default::default() }, &mut bytes, - ); + )?; std::fs::write(format!("target/programs/{}.hba", self.name), &bytes).unwrap(); } + Ok(()) } } diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index f32f993..19f2d38 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -1,5 +1,3 @@ -// #![allow(unused)] - mod dev; use { @@ -8,7 +6,6 @@ use { error_stack::{bail, report, Context, Report, Result, ResultExt}, fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek}, std::{ - // fmt::Display, fs::{self, File}, io::{self, Write}, path::Path, @@ -84,7 +81,7 @@ fn main() -> Result<(), Error> { " -r / --release: build in release mode\n", " -d / --debuginfo: build with debug info\n", " --noaccel: run without acceleration (e.g, no kvm)\n", - "[ rv64 / riscv64 / riscv64-virt / aarch64 / arm64 / aarch64-virt ]: sets target" + "[ rv64 / riscv64 / riscv64-virt / aarch64 / arm64 / aarch64-virt / avx2 ]: sets target" ),); Ok(()) } @@ -207,21 +204,25 @@ TERM_BACKDROP={} let modules = value.get_mut("modules").unwrap().as_table_mut().unwrap(); // let mut real_modules = modules.clone(); - modules.into_iter().for_each(|(_, value)| { - if value.is_table() { - let path = get_path_without_boot_prefix( - value.get("path").expect("You must have `path` as a value"), - ) - .unwrap() - .split(".") - .next() - .unwrap(); - let p = Package::load_from_file( - format!("sysdata/programs/{}/meta.toml", path).to_owned(), - ); - p.build(); - } - }); + modules + .into_iter() + .map(|(_, value)| -> Result<(), io::Error> { + if value.is_table() { + let path = get_path_without_boot_prefix( + value.get("path").expect("You must have `path` as a value"), + ) + .unwrap() + .split(".") + .next() + .unwrap(); + let p = Package::load_from_file( + format!("sysdata/programs/{}/meta.toml", path).to_owned(), + ); + p.build()?; + } + Ok(()) + }) + .for_each(drop); modules.into_iter().for_each(|(_key, value)| { if value.is_table() { let path = value.get("path").expect("You must have `path` as a value"); @@ -473,12 +474,12 @@ fn fetch_ovmf(target: Target) -> Result { Ok(_) => return Ok(ovmf_path.to_owned()), Err(e) => return Err(report!(e).change_context(OvmfFetchError::Io)), }; - let mut bytes = reqwest::blocking::get(ovmf_url) + let req = ureq::get(ovmf_url) + .call() .map_err(Report::from) .change_context(OvmfFetchError::Fetch)?; - bytes - .copy_to(&mut file) + std::io::copy(&mut req.into_reader(), &mut file) .map_err(Report::from) .change_context(OvmfFetchError::Io)?; diff --git a/sysdata/libraries/horizon_api/src/lib.hb b/sysdata/libraries/horizon_api/src/lib.hb index e8d2460..c2e2f3d 100644 --- a/sysdata/libraries/horizon_api/src/lib.hb +++ b/sysdata/libraries/horizon_api/src/lib.hb @@ -23,7 +23,7 @@ create_window := fn(channel: int): ^render.Surface { mem_buf := memory.request_page(1) if windowing_system_buffer == 0 { - return 0 + return @as(^render.Surface, idk) } else { // ! bad able, stop using string messages :ragey: // msg := "\{01}\0" @@ -43,6 +43,6 @@ create_window := fn(channel: int): ^render.Surface { log.info("No messages\0") } - return 0 + return @as(^render.Surface, idk) } } \ No newline at end of file diff --git a/sysdata/libraries/render/src/image.hb b/sysdata/libraries/render/src/image.hb index fd683f5..46f5d7b 100644 --- a/sysdata/libraries/render/src/image.hb +++ b/sysdata/libraries/render/src/image.hb @@ -41,14 +41,13 @@ surface_from_bmp := fn(bmp: ^u8): Surface { info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader))) bmp += file_header.offset - a := 0 px := info_header.width * info_header.height ptr := @as(^Color, @bitcast(bmp)) tmp := @as(Color, idk) - row := 0 + row := @as(i32, 0) loop if row == info_header.height / 2 break else { - col := 0 + col := @as(i32, 0) loop if col == info_header.width break else { top_index := row * info_header.width + col bottom_index := (info_header.height - 1 - row) * info_header.width + col @@ -62,7 +61,7 @@ surface_from_bmp := fn(bmp: ^u8): Surface { row += 1 } - return .(@bitcast(bmp), @intcast(info_header.width), @intcast(info_header.height)) + return .(@bitcast(bmp), info_header.width, info_header.height) } new_surface_from_bmp := fn(bmp: ^u8): Surface { @@ -74,8 +73,8 @@ new_surface_from_bmp := fn(bmp: ^u8): Surface { info_header := @as(^BitmapInfoHeader, @bitcast(bmp + @sizeof(BitmapFileHeader))) bmp += file_header.offset - width := @as(int, @intcast(info_header.width)) - height := @as(int, @intcast(info_header.height)) + width := @as(uint, @intcast(info_header.width)) + height := @as(uint, @intcast(info_header.height)) surface := new_surface(width, height) top_start_idx := surface.buf diff --git a/sysdata/libraries/render/src/software.hb b/sysdata/libraries/render/src/software.hb index 7f577d3..ddf939f 100644 --- a/sysdata/libraries/render/src/software.hb +++ b/sysdata/libraries/render/src/software.hb @@ -4,11 +4,11 @@ Surface := struct { buf: ^Color, - width: int, - height: int, + width: uint, + height: uint, } -new_surface := fn(width: int, height: int): Surface { +new_surface := fn(width: uint, height: uint): Surface { return .( @inline(memory.alloc, Color, width * height), width, @@ -16,7 +16,7 @@ new_surface := fn(width: int, height: int): Surface { ) } -surface_from_ptr := fn(ptr: ^Color, width: int, height: int): Surface { +surface_from_ptr := fn(ptr: ^Color, width: uint, height: uint): Surface { return .( ptr, width, @@ -39,8 +39,8 @@ framebuffer := @as(^Color, idk) init := fn(doublebuffer: bool): Surface { framebuffer = dt.get(^Color, "framebuffer/fb0/ptr\0") - width := dt.get(int, "framebuffer/fb0/width\0") - height := dt.get(int, "framebuffer/fb0/height\0") + width := dt.get(uint, "framebuffer/fb0/width\0") + height := dt.get(uint, "framebuffer/fb0/height\0") if doublebuffer { return new_surface(width, height) } else { @@ -49,7 +49,7 @@ init := fn(doublebuffer: bool): Surface { } clear := fn(surface: Surface, color: Color): void { - return @inline(memory.set, Color, &color, surface.buf, @bitcast(surface.width * surface.height)) + return @inline(memory.set, Color, &color, surface.buf, surface.width * surface.height) } sync := fn(surface: Surface): void { @@ -60,20 +60,20 @@ sync := fn(surface: Surface): void { return @inline(memory.copy, Color, surface.buf, framebuffer, @bitcast(surface.width * surface.height)) } -index := fn(surface: Surface, x: int, y: int): int { +index := fn(surface: Surface, x: uint, y: uint): uint { return x + surface.width * y } -indexptr := fn(surface: Surface, x: int, y: int): ^Color { +indexptr := fn(surface: Surface, x: uint, y: uint): ^Color { return surface.buf + @inline(index, surface, x, y) } -put_pixel := fn(surface: Surface, pos: Vec2(int), color: Color): void { +put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void { *@inline(indexptr, surface, pos.x, pos.y) = color return } -put_filled_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): void { +put_filled_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color: Color): void { top_start_idx := @inline(indexptr, surface, pos.x, pos.y) bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y - 1) rows_to_fill := tr.y @@ -94,7 +94,7 @@ put_filled_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Co return } -put_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): void { +put_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color: Color): void { start_idx := @inline(indexptr, surface, pos.x, pos.y) end_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y) right_start_idx := @inline(indexptr, surface, pos.x + tr.x, pos.y) @@ -112,15 +112,15 @@ put_rect := fn(surface: Surface, pos: Vec2(int), tr: Vec2(int), color: Color): v return } -put_line_low := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { - dx := p1.x - p0.x - dy := p1.y - p0.y +put_line_low := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void { + dx := @as(int, @bitcast(p1.x - p0.x)) + dy := @as(int, @bitcast(p1.y - p0.y)) yi := 1 if dy < 0 { yi = -1 dy = -dy } - D := 2 * dy - dx + D := @as(int, 2) * dy - dx y := p0.y x := p0.x loop if x == p1.x break else { @@ -136,15 +136,15 @@ put_line_low := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color) return } -put_line_high := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { - dx := p1.x - p0.x - dy := p1.y - p0.y +put_line_high := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void { + dx := @as(int, @bitcast(p1.x - p0.x)) + dy := @as(int, @bitcast(p1.y - p0.y)) xi := 1 if dy < 0 { xi = -1 dx = -dx } - D := 2 * dx - dy + D := @as(int, 2) * dx - dy x := p0.x y := p0.y loop if y == p1.y break else { @@ -160,8 +160,8 @@ put_line_high := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color return } -put_line := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): void { - if math.abs(int, p1.y - p0.y) < math.abs(int, p1.x - p0.x) { +put_line := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Color): void { + if math.abs(uint, p1.y - p0.y) < math.abs(uint, p1.x - p0.x) { if p0.x > p1.x { @inline(put_line_low, surface, p1, p0, color) } else { @@ -177,7 +177,7 @@ put_line := fn(surface: Surface, p0: Vec2(int), p1: Vec2(int), color: Color): vo return } -put_surface := fn(surface: Surface, top: Surface, pos: Vec2(int), flip_v: bool): void { +put_surface := fn(surface: Surface, top: Surface, pos: Vec2(uint), flip_v: bool): void { top_start_idx := @inline(indexptr, surface, pos.x, pos.y) bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + top.height - 1) rows_to_copy := top.height @@ -208,29 +208,29 @@ put_surface := fn(surface: Surface, top: Surface, pos: Vec2(int), flip_v: bool): } // peony-made -put_trirect := fn(surface: Surface, pos: Vec2(int), size: Vec2(int), color0: Color, color1: Color): void { +put_trirect := fn(surface: Surface, pos: Vec2(uint), size: Vec2(int), color0: Color, color1: Color): void { step := Vec2(int).(1, 1) if size.x < 0 { step.x = -1 } if size.y < 0 { - step.y = size.y / size.x + step.y /= @bitcast(size.x) } start_y := pos.y - target := pos + size + target := pos + @bitcast(size) loop if pos.x == target.x break else { @inline(put_vline, surface, pos.x, pos.y, target.y, color0) @inline(put_vline, surface, pos.x, pos.y, start_y, color1) - pos += step + pos += @bitcast(step) } return } // peony-made -put_vline := fn(surface: Surface, x: int, y0: int, y1: int, color: Color): void { +put_vline := fn(surface: Surface, x: uint, y0: uint, y1: uint, color: Color): void { if y1 < y0 { tmp := y0 y0 = y1 @@ -247,7 +247,7 @@ put_vline := fn(surface: Surface, x: int, y0: int, y1: int, color: Color): void } // peony-made -put_hline := fn(surface: Surface, y: int, x0: int, x1: int, color: Color): void { +put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): void { if x1 < x0 { tmp := x0 x0 = x1 diff --git a/sysdata/libraries/stn/src/buffer.hb b/sysdata/libraries/stn/src/buffer.hb index 23041dc..d4aa4e7 100644 --- a/sysdata/libraries/stn/src/buffer.hb +++ b/sysdata/libraries/stn/src/buffer.hb @@ -8,6 +8,14 @@ write := fn($Expr: type, msg: ^Expr, buffer_id: int): void { return @eca(3, buffer_id, msg, @sizeof(Expr)) } +recv_length := fn(buffer_id: int, memory_map_location: ^u8, length: int): void { + return @eca(4, buffer_id, memory_map_location, length) +} + +write_length := fn(msg: ^u8, buffer_id: int, length: int): void { + return @eca(3, buffer_id, msg, length) +} + BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint} create := fn(msg: ^u8): int { diff --git a/sysdata/libraries/stn/src/log.hb b/sysdata/libraries/stn/src/log.hb index 95d91c1..bd7d625 100644 --- a/sysdata/libraries/stn/src/log.hb +++ b/sysdata/libraries/stn/src/log.hb @@ -2,8 +2,8 @@ string := @use("string.hb") LogMsg := packed struct {level: u8, string: ^u8, strlen: uint} -log := fn($Level: u8, message: ^u8): void { - return @eca(3, 1, LogMsg.(Level, message, @inline(string.length, message)), @sizeof(LogMsg)) +log := fn(level: u8, message: ^u8): void { + return @eca(3, 1, LogMsg.(level, message, @inline(string.length, message)), @sizeof(LogMsg)) } error := fn(message: ^u8): void return @inline(log, 0, message) diff --git a/sysdata/libraries/stn/src/memory.hb b/sysdata/libraries/stn/src/memory.hb index 6022d5a..540d3d7 100644 --- a/sysdata/libraries/stn/src/memory.hb +++ b/sysdata/libraries/stn/src/memory.hb @@ -2,49 +2,27 @@ PAGE_SIZE := 4096 MAX_ALLOC := 0xFF MAX_FREE := 0xFF -calc_pages := fn($Expr: type, num: int): int { - return 1 + @bitcast(@sizeof(Expr)) * num / PAGE_SIZE +calc_pages := fn($Expr: type, num: uint): uint { + return 1 + @sizeof(Expr) * num / PAGE_SIZE } -alloc := fn($Expr: type, num: int): ^Expr { +alloc := fn($Expr: type, num: uint): ^Expr { pages := @inline(calc_pages, Expr, num) if pages <= MAX_ALLOC { return @bitcast(request_page(@intcast(pages))) } ptr := request_page(0xFF) remaining := pages - MAX_ALLOC - loop if remaining <= 0 break else { - if remaining < MAX_ALLOC { - request_page(@intcast(remaining)) - } else { - request_page(@intcast(MAX_ALLOC)) - } + loop if remaining < MAX_ALLOC break else { + _ := request_page(@intcast(MAX_ALLOC)) remaining -= MAX_ALLOC } + _ := request_page(@intcast(remaining)) return @bitcast(ptr) } -// ! is broked, somebody fix please :( -free := fn($Expr: type, ptr: ^Expr, num: int, nullify: bool): void { - if nullify { - null := @as(u8, 0) - set(u8, &null, @bitcast(ptr), @bitcast(num) * @bitcast(PAGE_SIZE)) - } - pages := @inline(calc_pages, Expr, num) - if pages <= MAX_FREE { - return release_page(@bitcast(ptr), @intcast(pages)) - } - page_ptr := @as(^[u8; PAGE_SIZE], @bitcast(ptr)) + 1 - remaining := pages - MAX_FREE - loop if remaining <= 0 break else { - if remaining < MAX_FREE { - release_page(@bitcast(page_ptr), @intcast(remaining)) - } else { - release_page(@bitcast(page_ptr), @intcast(MAX_FREE)) - } - remaining -= MAX_FREE - page_ptr += 1 - } +// ! stub +free := fn($Expr: type, ptr: ^Expr, num: uint, nullify: bool): void { return } @@ -78,12 +56,12 @@ inl := fn(addr: u16): u32 { return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg)) } -CopyMsg := packed struct {a: u8, count: uint, src: uint, dest: ^u8} +CopyMsg := packed struct {a: u8, count: u32, src: ^u8, dest: ^u8} copy := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void { - return @eca(3, 2, &CopyMsg.(4, count * @sizeof(Expr), @bitcast(src), @bitcast(dest)), @sizeof(CopyMsg)) + return @eca(3, 2, &CopyMsg.(4, @intcast(count * @sizeof(Expr)), @bitcast(src), @bitcast(dest)), @sizeof(CopyMsg)) } -SetMsg := packed struct {a: u8, count: uint, size: uint, src: ^u8, dest: ^u8} +SetMsg := packed struct {a: u8, count: u32, size: u32, src: ^u8, dest: ^u8} set := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void { - return @eca(3, 2, &SetMsg.(5, count, @sizeof(Expr), @bitcast(src), @bitcast(dest)), @sizeof(SetMsg)) + return @eca(3, 2, &SetMsg.(5, @intcast(count), @intcast(@sizeof(Expr)), @bitcast(src), @bitcast(dest)), @sizeof(SetMsg)) } \ No newline at end of file diff --git a/sysdata/libraries/stn/src/random.hb b/sysdata/libraries/stn/src/random.hb index 9b4cdfc..4fb7b3f 100644 --- a/sysdata/libraries/stn/src/random.hb +++ b/sysdata/libraries/stn/src/random.hb @@ -1,8 +1,7 @@ any := fn($Expr: type): Expr { - return @intcast(@eca(3, 4)) + return *@eca(3, 4, &@as(Expr, idk), @sizeof(Expr)) } range := fn($Expr: type, min: Expr, max: Expr): Expr { - // wtf is this - return @intcast(@as(int, @eca(3, 4)) % @as(int, @intcast(max) - @intcast(min)) + 1 + @intcast(min)) + return @inline(any, Expr) % (max - min) + @intcast(1) + min } \ No newline at end of file diff --git a/sysdata/libraries/stn/src/string.hb b/sysdata/libraries/stn/src/string.hb index c84ac55..3307199 100644 --- a/sysdata/libraries/stn/src/string.hb +++ b/sysdata/libraries/stn/src/string.hb @@ -1,10 +1,11 @@ length := fn(ptr: ^u8): uint { len := @as(uint, 0) + // loop if *(ptr + len) == 0 return len else len += 1 loop if *(ptr + len) == 0 break else len += 1 return len } -display_int := fn(num: int, p: ^u8, radix: int): ^u8 { +display_int := fn(num: int, p: ^u8, radix: uint): ^u8 { ptr := p negative := num < 0 if negative { @@ -33,14 +34,14 @@ display_int := fn(num: int, p: ^u8, radix: int): ^u8 { ptr += 1 } else { loop if num == 0 break else { - digit := num % radix + digit := num % @bitcast(radix) if digit < 10 { - *ptr = digit + 48 + *ptr = @intcast(digit) + 48 } else { - *ptr = digit + 55 + *ptr = @intcast(digit) + 55 } ptr += 1 - num /= radix + num /= @bitcast(radix) } } @@ -55,11 +56,11 @@ display_int := fn(num: int, p: ^u8, radix: int): ^u8 { return p } + reverse := fn(s: ^u8): void { - len := @inline(length, s) - i := 0 - j := len - 1 - temp := 0 + i := @as(uint, 0) + j := @inline(length, s) - 1 + temp := @as(u8, 0) loop if i >= j break else { temp = *(s + i); *(s + i) = *(s + j); diff --git a/sysdata/programs/dt_buffer_test/src/main.hb b/sysdata/programs/dt_buffer_test/src/main.hb index ce42ef0..7d37f6a 100644 --- a/sysdata/programs/dt_buffer_test/src/main.hb +++ b/sysdata/programs/dt_buffer_test/src/main.hb @@ -1,13 +1,13 @@ .{dt} := @use("../../../libraries/stn/src/lib.hb") -main := fn(): int { - dt.get(int, "framebuffer/fb0/width\0") - dt.get(int, "cpu/cpu0/architecture\0") +main := fn(): void { + dt.get(void, "framebuffer/fb0/width\0") + dt.get(void, "cpu/cpu0/architecture\0") // Checking if the first detected serial port is memory mapped or port mapped // 0 -> memory mapped // 1 -> port mapped - dt.get(int, "serial_ports/sp0/mapping\0") + dt.get(void, "serial_ports/sp0/mapping\0") - return 0 + return } \ No newline at end of file diff --git a/sysdata/programs/filesystem_fat32/src/attributes.hb b/sysdata/programs/filesystem_fat32/src/attributes.hb index 2c5c3ca..cd9dac6 100644 --- a/sysdata/programs/filesystem_fat32/src/attributes.hb +++ b/sysdata/programs/filesystem_fat32/src/attributes.hb @@ -1,7 +1,7 @@ -READ_ONLY := 0x1 -HIDDEN := 0x2 -SYSTEM := 0x4 -VOLUME_ID := 0x8 -DIRECTORY := 0x10 -ARCHIVE := 0x20 +READ_ONLY := @as(u32, 0x1) +HIDDEN := @as(u32, 0x2) +SYSTEM := @as(u32, 0x4) +VOLUME_ID := @as(u32, 0x8) +DIRECTORY := @as(u32, 0x10) +ARCHIVE := @as(u32, 0x20) LFN := READ_ONLY | HIDDEN | SYSTEM | VOLUME_ID \ No newline at end of file diff --git a/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb b/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb index fa9d8ca..8517c5b 100644 --- a/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb +++ b/sysdata/programs/filesystem_fat32/src/bios_parameter_block.hb @@ -63,7 +63,7 @@ VolumeName := [u8; 11] SystemIdentifierString := [u8; 8] VALID_SYSTEM_IDENTIFIER_STRING := [u8].(46, 41, 54, 33, 32, 20, 20, 20) -BOOTABLE_PARTITION_SIGNATURE := 0xAA55 +BOOTABLE_PARTITION_SIGNATURE := @as(u32, 0xAA55) BootCode := [u8; 420] @@ -100,9 +100,10 @@ ebr_sanity_check := fn(ebr: ExtendedBootRecord): int { log.warn("EBR-Signature sanity check failed\0") } - if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING { - log.warn("EBR-Signature-Identifier-String sanity check failed\0") - } + // ! comparison between [u8] is not supported in hblang + // if ebr.system_identifier_string != VALID_SYSTEM_IDENTIFIER_STRING { + // log.warn("EBR-Signature-Identifier-String sanity check failed\0") + // } return 0 } @@ -131,21 +132,21 @@ new_ebr := fn(): ExtendedBootRecord { ) } -VALID_LEAD_FS_INFO := 0x41615252 -VALID_TRAIL_FS_INFO := 0xAA550000 +VALID_LEAD_FS_INFO := @as(u32, 0x41615252) +VALID_TRAIL_FS_INFO := @as(u32, 0xAA550000) FSInfo := struct { // Must be 0x41615252 to indicate a valid FSInfo structure lead_signature: u32, lead_reserved: [u8; 480], - // If the value is 0xFFFFFFFF, then the free count is unknown and must be computed. However, this value might be incorrect and should at least be range checked (<= volume cluster count) + // If the value is 0xFFFFFFFF, then the free count is unknown and must be computed. However, this value might be incorrect and should at least be range checked (<= volume cluster count) last_known_free_cluster_count: u32, last_known_avalible_cluster: u32, trail_reserved: [u8; 12], trail_signature: u32, } -fs_info_sanity_check := fn(fs_info: FSInfo): int { +fs_info_sanity_check := fn(fs_info: FSInfo): uint { ret := 0 if fs_info.lead_signature != VALID_LEAD_FS_INFO { ret &= 1 diff --git a/sysdata/programs/filesystem_fat32/src/file.hb b/sysdata/programs/filesystem_fat32/src/file.hb index c754845..175bff0 100644 --- a/sysdata/programs/filesystem_fat32/src/file.hb +++ b/sysdata/programs/filesystem_fat32/src/file.hb @@ -7,7 +7,7 @@ FileName := [u8; 11] FileEntry := struct { file_name: FileName, attributes: u8, - // We could use this byte for something but we likely will not + // We could use this byte for something but we likely will not nt_reserved: u8, hundredths_seconds_creation: u8, creation_time: datetime.time, diff --git a/sysdata/programs/filesystem_fat32/src/main.hb b/sysdata/programs/filesystem_fat32/src/main.hb index 6e88cbb..e15a16c 100644 --- a/sysdata/programs/filesystem_fat32/src/main.hb +++ b/sysdata/programs/filesystem_fat32/src/main.hb @@ -16,7 +16,7 @@ FAT12 := 1 FAT16 := 2 FAT32 := 3 -calculate_fat_type := fn(sector_size: int, total_clusters: int): int { +calculate_fat_type := fn(sector_size: uint, total_clusters: uint): uint { if sector_size == 0 { return ExFAT } else if total_clusters < 4085 { diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb index 7722ef4..ed2c23f 100644 --- a/sysdata/programs/horizon/src/main.hb +++ b/sysdata/programs/horizon/src/main.hb @@ -25,14 +25,14 @@ main := fn(): int { window := render.new_surface(screen.width / 3, screen.height / 3) - x := 10 + x := 0 mem_buf := memory.request_page(1) - color := random.range(render.Color, render.black, render.white) + color := random.any(render.Color) side := window.width / 8 vel_inner := Vec2(int).(1, 1) - pos_inner := Vec2(int).((window.width - side) / 2, (window.height - side) / 2) + pos_inner := Vec2(uint).((window.width - side) / 2, (window.height - side) / 2) loop { // Clear the screen @@ -48,11 +48,11 @@ main := fn(): int { if pos_inner.x == 0 | pos_inner.x == window.width - side { vel_inner.x = -vel_inner.x - color = random.range(render.Color, render.black, render.white) + color = random.any(render.Color) } if pos_inner.y == 20 | pos_inner.y == window.height - side { vel_inner.y = -vel_inner.y - color = random.range(render.Color, render.black, render.white) + color = random.any(render.Color) } // TODO: Get windows out of a collection and iter through @@ -69,17 +69,17 @@ main := fn(): int { render.put_filled_rect(window, pos_inner, .(side, side), color) // Apply the image to the screen - pos := Vec2(int).(x, 100) + pos := Vec2(uint).(x, 100) render.put_surface(screen, window, pos, false) if window_count >= 1 { - x = 10 + x = 0 break } window_count += 1 - x += 400 + x += screen.width / 2 } - pos_inner += vel_inner + pos_inner += @bitcast(vel_inner) // Sync the screen render.sync(screen) diff --git a/sysdata/programs/ps2_driver/src/main.hb b/sysdata/programs/ps2_driver/src/main.hb index bdd72f5..7256181 100644 --- a/sysdata/programs/ps2_driver/src/main.hb +++ b/sysdata/programs/ps2_driver/src/main.hb @@ -7,7 +7,7 @@ send_byte := fn(byte: u8): u8 { main := fn(): int { buf := buffer.create("XKeyboard\0") - send_byte(238) + _ := send_byte(238) log.info("PS/2 Driver Loaded\0") if send_byte(238) == 238 { log.info("PS/2 Keyboard Echoed\0") diff --git a/sysdata/programs/render_example/src/examples/image.hb b/sysdata/programs/render_example/src/examples/image.hb index b7e1ba0..25d6840 100644 --- a/sysdata/programs/render_example/src/examples/image.hb +++ b/sysdata/programs/render_example/src/examples/image.hb @@ -8,13 +8,13 @@ bmp_1 := @embed("./assets/able.bmp") bmp_2 := @embed("./assets/mini.bmp") example := fn(): void { - images := [render.Surface; 2].( + images := [render.Surface].( render.image.surface_from_bmp(@bitcast(&bmp_1)), render.image.surface_from_bmp(@bitcast(&bmp_2)), ) screen := render.init(true) vel := Vec2(int).(1, 1) - pos := Vec2(int).(100, 100) + pos := Vec2(uint).(100, 100) n := 0 loop { image := images[n] @@ -31,7 +31,7 @@ example := fn(): void { n = 1 - n } - pos += vel + pos += @bitcast(vel) } return } \ No newline at end of file diff --git a/sysdata/programs/render_example/src/examples/lines.hb b/sysdata/programs/render_example/src/examples/lines.hb index 386883d..346ca9e 100644 --- a/sysdata/programs/render_example/src/examples/lines.hb +++ b/sysdata/programs/render_example/src/examples/lines.hb @@ -8,8 +8,8 @@ render := @use("../../../../libraries/render/src/lib.hb") example := fn(): void { screen := render.init(true) render.clear(screen, .(100, 50, 0, 255)) - p0 := Vec2(int).(0, 0) - p1 := Vec2(int).(0, screen.height) + p0 := Vec2(uint).(0, 0) + p1 := Vec2(uint).(0, screen.height) loop if p0.y >= screen.height break else { render.put_line(screen, p0, p1, .(255, 180, 100, 255)) render.put_line(screen, .(screen.width, screen.height) - p0, .(screen.width, screen.height) - p1, .(255, 180, 100, 255)) diff --git a/sysdata/programs/render_example/src/examples/random.hb b/sysdata/programs/render_example/src/examples/random.hb index fed2790..6710c10 100644 --- a/sysdata/programs/render_example/src/examples/random.hb +++ b/sysdata/programs/render_example/src/examples/random.hb @@ -5,11 +5,11 @@ example := fn(): void { screen := render.init(false) render.clear(screen, render.black) loop { - x := random.range(int, 0, 1024) - y := random.range(int, 0, 768) - r := random.range(int, 0, 255) - g := random.range(int, 0, 75) - b := random.range(int, 0, 155) + x := random.range(uint, 0, screen.width) + y := random.range(uint, 0, screen.height) + r := random.range(u8, 0, 255) + g := random.range(u8, 0, 75) + b := random.range(u8, 0, 155) render.put_pixel(screen, .(x, y), .(b, g, r, 255)) } return diff --git a/sysdata/programs/render_example/src/examples/square.hb b/sysdata/programs/render_example/src/examples/square.hb index 5f89495..b66723d 100644 --- a/sysdata/programs/render_example/src/examples/square.hb +++ b/sysdata/programs/render_example/src/examples/square.hb @@ -9,8 +9,8 @@ example := fn(): void { screen := render.init(true) vel := Vec2(int).(1, 1) side := screen.width / 8 - pos := Vec2(int).((screen.width - side) / 2, (screen.height - side) / 2) - color := random.range(render.Color, render.black, render.white) + pos := Vec2(uint).((screen.width - side) / 2, (screen.height - side) / 2) + color := random.any(render.Color) loop { render.put_filled_rect(screen, pos, .(side, side), color) render.sync(screen) @@ -18,14 +18,14 @@ example := fn(): void { if pos.x == 0 | pos.x == screen.width - side { vel.x = -vel.x - color = random.range(render.Color, render.black, render.white) + color = random.any(render.Color) } if pos.y == 0 | pos.y == screen.height - side { vel.y = -vel.y - color = random.range(render.Color, render.black, render.white) + color = random.any(render.Color) } - pos += vel + pos += @bitcast(vel) } return } \ No newline at end of file diff --git a/sysdata/programs/render_example/src/examples/surface.hb b/sysdata/programs/render_example/src/examples/surface.hb index 003baec..5a3eefc 100644 --- a/sysdata/programs/render_example/src/examples/surface.hb +++ b/sysdata/programs/render_example/src/examples/surface.hb @@ -10,14 +10,12 @@ example := fn(): void { image := render.new_surface(screen.width / 3, screen.height / 3) vel := Vec2(int).(-1, -1) - pos := Vec2(int).(100, 100) + pos := Vec2(uint).(100, 100) side := image.width / 8 vel_inner := Vec2(int).(1, 1) - pos_inner := Vec2(int).((image.width - side) / 2, (image.height - side) / 2) - // workaround for compiler bug - color := render.Color.(0, 0, 0, 0) - color = random.range(render.Color, render.black, render.white) - target_color := color + pos_inner := Vec2(uint).((image.width - side) / 2, (image.height - side) / 2) + color := random.any(render.Color) + target_color := random.any(render.Color) loop { render.clear(screen, render.black) render.put_filled_rect(image, pos_inner, .(side, side), color) @@ -30,11 +28,11 @@ example := fn(): void { if pos_inner.x == 0 | pos_inner.x == image.width - side { vel_inner.x = -vel_inner.x - target_color = random.range(render.Color, render.black, render.white) + target_color = random.any(render.Color) } if pos_inner.y == 0 | pos_inner.y == image.height - side { vel_inner.y = -vel_inner.y - target_color = random.range(render.Color, render.black, render.white) + target_color = random.any(render.Color) } if pos.x == 0 | pos.x == screen.width - image.width { @@ -45,13 +43,13 @@ example := fn(): void { } color += .( - @intcast(color.b < target_color.b) - @intcast(color.b > target_color.b), - @intcast(color.g < target_color.g) - @intcast(color.g > target_color.g), - @intcast(color.r < target_color.r) - @intcast(color.r > target_color.r), + @bitcast(color.b < target_color.b) - @bitcast(color.b > target_color.b), + @bitcast(color.g < target_color.g) - @bitcast(color.g > target_color.g), + @bitcast(color.r < target_color.r) - @bitcast(color.r > target_color.r), 0, ) - pos += vel - pos_inner += vel_inner + pos += @bitcast(vel) + pos_inner += @bitcast(vel_inner) } return } \ No newline at end of file diff --git a/sysdata/programs/render_example/src/examples/tactical_screen.hb b/sysdata/programs/render_example/src/examples/tactical_screen.hb index 3fc1f16..b15792a 100644 --- a/sysdata/programs/render_example/src/examples/tactical_screen.hb +++ b/sysdata/programs/render_example/src/examples/tactical_screen.hb @@ -12,7 +12,7 @@ example := fn(): void { width := screen.width height := screen.height cell_size := 0 - range := Vec2(int).(0, 0) + range := Vec2(uint).(0, 0) if width > height { cell_size = width / 40 range = .(39, height / cell_size - 1) @@ -24,19 +24,19 @@ example := fn(): void { height -= 1 scroll := 0 - target := Vec2(int).(random.range(int, 0, range.x), random.range(int, 0, range.y)) + target := Vec2(uint).(random.range(uint, 0, range.x), random.range(uint, 0, range.y)) halfcell := cell_size / 2 octcell := cell_size / 8 sevenoctcell := cell_size - octcell - seeker := Vec2(int).(random.range(int, 0, range.x), random.range(int, 0, range.y)) + seeker := Vec2(uint).(random.range(uint, 0, range.x), random.range(uint, 0, range.y)) loop { render.clear(screen, render.black) - target_pixel_coord := target * .(cell_size, cell_size) + .(scroll, scroll) - render.put_trirect(screen, target_pixel_coord, .(cell_size, cell_size), render.red, render.light_red) + target_pixel_coord := target * .(@bitcast(cell_size), @bitcast(cell_size)) + .(scroll, scroll) + render.put_trirect(screen, target_pixel_coord, .(@bitcast(cell_size), @bitcast(cell_size)), render.red, render.light_red) render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x - octcell, target_pixel_coord.x - sevenoctcell, render.light_red) render.put_hline(screen, target_pixel_coord.y + halfcell, target_pixel_coord.x + cell_size + octcell, target_pixel_coord.x + cell_size + sevenoctcell, render.light_red) @@ -69,7 +69,7 @@ example := fn(): void { } else if seeker.y > target.y { seeker.y -= 1 } else { - target = .(random.range(int, 0, range.x), random.range(int, 0, range.y)) + target = .(random.range(uint, 0, range.x), random.range(uint, 0, range.y)) } scroll += 1 diff --git a/sysdata/programs/serial_driver/src/main.hb b/sysdata/programs/serial_driver/src/main.hb index 0173b67..5134363 100644 --- a/sysdata/programs/serial_driver/src/main.hb +++ b/sysdata/programs/serial_driver/src/main.hb @@ -1,7 +1,7 @@ .{memory, buffer} := @use("../../../libraries/stn/src/lib.hb") serial_print := fn(ptr: ^u8): void { - letter := 0 + letter := @as(u8, 0) loop if *ptr == 0 break else { letter = *ptr memory.outb(0xF803, letter) diff --git a/sysdata/programs/tests/src/main.hb b/sysdata/programs/tests/src/main.hb index b2eee5e..049e404 100644 --- a/sysdata/programs/tests/src/main.hb +++ b/sysdata/programs/tests/src/main.hb @@ -10,9 +10,9 @@ service_search := fn(): void { main := fn(): int { //service_search() buf := "\0\0\0\0" - x := 0 - loop if x == 255 break else { - log.info(string.display_int(x, buf, 10)) + x := @as(int, 0) + loop if x > 255 break else { + log.info(string.display_int(x, buf, 2)) x += 1 } return 0 diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index f556282..a97af89 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -28,8 +28,8 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.diskio_driver] # path = "boot:///diskio_driver.hbf" -[boot.limine.ableos.modules.render_example] -path = "boot:///render_example.hbf" +# [boot.limine.ableos.modules.render_example] +# path = "boot:///render_example.hbf" # [boot.limine.ableos.modules.serial_driver] # path = "boot:///serial_driver.hbf" @@ -37,11 +37,11 @@ path = "boot:///render_example.hbf" # [boot.limine.ableos.modules.serial_driver_test] # path = "boot:///serial_driver_test.hbf" -# [boot.limine.ableos.modules.horizon] -# path = "boot:///horizon.hbf" +[boot.limine.ableos.modules.horizon] +path = "boot:///horizon.hbf" -# [boot.limine.ableos.modules.horizon_testing_program] -# path = "boot:///horizon_testing_program.hbf" +[boot.limine.ableos.modules.horizon_testing_program] +path = "boot:///horizon_testing_program.hbf" # [boot.limine.ableos.modules.dt_buffer_test] # path = "boot:///dt_buffer_test.hbf"