diff --git a/sysdata/libraries/stn/src/lib.hb b/sysdata/libraries/stn/src/lib.hb index dc6494ec..93919178 100644 --- a/sysdata/libraries/stn/src/lib.hb +++ b/sysdata/libraries/stn/src/lib.hb @@ -10,6 +10,7 @@ random := @use("random.hb") file := @use("file_io.hb") dt := @use("dt.hb") process := @use("process.hb") +sleep := @use("sleep.hb") panic := fn(message: ?^u8): never { log.error("Error: Panic Called, Message:\0") diff --git a/sysdata/programs/alloc_test/README.md b/sysdata/programs/alloc_test/README.md deleted file mode 100644 index 56081944..00000000 --- a/sysdata/programs/alloc_test/README.md +++ /dev/null @@ -1 +0,0 @@ -# alloc_test \ No newline at end of file diff --git a/sysdata/programs/alloc_test/meta.toml b/sysdata/programs/alloc_test/meta.toml deleted file mode 100644 index aa77119f..00000000 --- a/sysdata/programs/alloc_test/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "alloc_test" -authors = [""] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/dt_buffer_test/README.md b/sysdata/programs/dt_buffer_test/README.md deleted file mode 100644 index c01a7c5e..00000000 --- a/sysdata/programs/dt_buffer_test/README.md +++ /dev/null @@ -1 +0,0 @@ -# dt_buffer_test \ No newline at end of file diff --git a/sysdata/programs/dt_buffer_test/src/main.hb b/sysdata/programs/dt_buffer_test/src/main.hb deleted file mode 100644 index 7d37f6ad..00000000 --- a/sysdata/programs/dt_buffer_test/src/main.hb +++ /dev/null @@ -1,13 +0,0 @@ -.{dt} := @use("../../../libraries/stn/src/lib.hb") - -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(void, "serial_ports/sp0/mapping\0") - - return -} \ No newline at end of file diff --git a/sysdata/programs/hash_test/meta.toml b/sysdata/programs/hash_test/meta.toml deleted file mode 100644 index fc157f12..00000000 --- a/sysdata/programs/hash_test/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "hash_test" -authors = [""] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/processes/meta.toml b/sysdata/programs/processes/meta.toml deleted file mode 100644 index 86a48694..00000000 --- a/sysdata/programs/processes/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "processes" -authors = ["koniifer"] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/serial_driver_test/meta.toml b/sysdata/programs/serial_driver_test/meta.toml deleted file mode 100644 index f8f995c9..00000000 --- a/sysdata/programs/serial_driver_test/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "serial_driver_test" -authors = ["able"] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/serial_driver_test/src/main.hb b/sysdata/programs/serial_driver_test/src/main.hb deleted file mode 100644 index 19ad6c15..00000000 --- a/sysdata/programs/serial_driver_test/src/main.hb +++ /dev/null @@ -1,20 +0,0 @@ -.{string, buffer} := @use("../../../libraries/stn/src/lib.hb") - -log_info := fn(): void { - a := buffer.search("XNumber\0") - if a == 0 { - } else { - msg := "XABC\0" - // inline is broked - // msg_length := @inline(string.length, msg) - msg_length := 5 - @as(void, @eca(3, a, msg, msg_length)) - } - - return -} - -main := fn(): int { - log_info() - return 0 -} \ No newline at end of file diff --git a/sysdata/programs/dt_buffer_test/meta.toml b/sysdata/programs/test/meta.toml similarity index 73% rename from sysdata/programs/dt_buffer_test/meta.toml rename to sysdata/programs/test/meta.toml index f25002e9..93c3dd77 100644 --- a/sysdata/programs/dt_buffer_test/meta.toml +++ b/sysdata/programs/test/meta.toml @@ -1,6 +1,6 @@ [package] -name = "dt_buffer_test" -authors = ["able"] +name = "test" +authors = ["koniifer", "able"] [dependants.libraries] diff --git a/sysdata/programs/test/src/main.hb b/sysdata/programs/test/src/main.hb new file mode 100644 index 00000000..3b3bc21c --- /dev/null +++ b/sysdata/programs/test/src/main.hb @@ -0,0 +1,7 @@ +stn := @use("./tests/stn/lib.hb") +serial_driver := @use("./tests/serial_driver.hb") + +main := fn(): uint { + // return serial_driver.test() + return stn.process.test() +} \ No newline at end of file diff --git a/sysdata/programs/test/src/tests/serial_driver.hb b/sysdata/programs/test/src/tests/serial_driver.hb new file mode 100644 index 00000000..8e27b11d --- /dev/null +++ b/sysdata/programs/test/src/tests/serial_driver.hb @@ -0,0 +1,18 @@ +.{string, buffer} := @use("../../../../libraries/stn/src/lib.hb") + +log_info := fn(): void { + a := buffer.search("XNumber\0") + if a == 0 { + } else { + msg := "XABC\0" + msg_length := string.length(msg) + @eca(3, a, msg, msg_length) + } + + return +} + +test := fn(): uint { + log_info() + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/alloc_test/src/main.hb b/sysdata/programs/test/src/tests/stn/allocators.hb similarity index 87% rename from sysdata/programs/alloc_test/src/main.hb rename to sysdata/programs/test/src/tests/stn/allocators.hb index 250ecea6..8b194b7f 100644 --- a/sysdata/programs/alloc_test/src/main.hb +++ b/sysdata/programs/test/src/tests/stn/allocators.hb @@ -1,11 +1,11 @@ -stn := @use("../../../libraries/stn/src/lib.hb"); +stn := @use("../../../../../libraries/stn/src/lib.hb"); .{allocators, panic, log} := stn AStruct := struct { a_field: u8, } -main := fn(): void { +test := fn(): uint { // alloc := allocators.FakeAlloc.init() // astruct := alloc.alloc(AStruct, 2) // if astruct.ptr != null{ @@ -26,5 +26,5 @@ main := fn(): void { // log.info("Allocator functioned.\0") // } // balloc.dealloc(bstruct_ptr, AStruct, 2) - return + return 0 } \ No newline at end of file diff --git a/sysdata/programs/processes/src/hello_world_and_spin.hb b/sysdata/programs/test/src/tests/stn/assets/hello_world_and_spin.hb similarity index 100% rename from sysdata/programs/processes/src/hello_world_and_spin.hb rename to sysdata/programs/test/src/tests/stn/assets/hello_world_and_spin.hb diff --git a/sysdata/programs/processes/src/hello_world_and_spin.hbf b/sysdata/programs/test/src/tests/stn/assets/hello_world_and_spin.hbf similarity index 100% rename from sysdata/programs/processes/src/hello_world_and_spin.hbf rename to sysdata/programs/test/src/tests/stn/assets/hello_world_and_spin.hbf diff --git a/sysdata/programs/test/src/tests/stn/dt.hb b/sysdata/programs/test/src/tests/stn/dt.hb new file mode 100644 index 00000000..e331f33b --- /dev/null +++ b/sysdata/programs/test/src/tests/stn/dt.hb @@ -0,0 +1,18 @@ +.{dt, memory, string, log} := @use("../../../../../libraries/stn/src/lib.hb") + +test := fn(): uint { + buffer := memory.request_page(1) + + log.info(string.display_int(dt.get(int, "framebuffer/fb0/width\0"), buffer, 10)) + string.clear(buffer) + + log.info(string.display_int(dt.get(int, "cpu/cpu0/architecture\0"), buffer, 10)) + string.clear(buffer) + + // 0 -> memory mapped + // 1 -> port mapped + + log.info(string.display_int(dt.get(int, "serial_ports/sp0/mapping\0"), buffer, 10)) + + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/hash_test/src/main.hb b/sysdata/programs/test/src/tests/stn/hashers.hb similarity index 87% rename from sysdata/programs/hash_test/src/main.hb rename to sysdata/programs/test/src/tests/stn/hashers.hb index 08405413..a1052d6e 100644 --- a/sysdata/programs/hash_test/src/main.hb +++ b/sysdata/programs/test/src/tests/stn/hashers.hb @@ -1,6 +1,6 @@ -.{hashers, log, memory, string} := @use("../../../libraries/stn/src/lib.hb") +.{hashers, log, memory, string} := @use("../../../../../libraries/stn/src/lib.hb") -main := fn(): void { +test := fn(): uint { buffer := memory.request_page(1) target := "abcdefghijklmnop\0" strings := [^u8].("abcdefshijklmnop\0", "abcdefghijklnnop\0", "abcdefshijklmnop\0", "abcdefghijklmnop\0", "abcdefghijflmnop\0", "dbcdefghijklmnop\0", "abcdefghijklmnop\0") @@ -28,4 +28,5 @@ main := fn(): void { log.debug(string.display_int(@bitcast(d), buffer, 16)) string.clear(buffer) } + return 0 } \ No newline at end of file diff --git a/sysdata/programs/test/src/tests/stn/lib.hb b/sysdata/programs/test/src/tests/stn/lib.hb new file mode 100644 index 00000000..da08b779 --- /dev/null +++ b/sysdata/programs/test/src/tests/stn/lib.hb @@ -0,0 +1,5 @@ +hashers := @use("./hashers.hb") +allocators := @use("./allocators.hb") +sleep := @use("./sleep.hb") +dt := @use("./dt.hb") +process := @use("./process.hb") \ No newline at end of file diff --git a/sysdata/programs/processes/src/main.hb b/sysdata/programs/test/src/tests/stn/process.hb similarity index 61% rename from sysdata/programs/processes/src/main.hb rename to sysdata/programs/test/src/tests/stn/process.hb index 06b4ade8..493e36a7 100644 --- a/sysdata/programs/processes/src/main.hb +++ b/sysdata/programs/test/src/tests/stn/process.hb @@ -1,8 +1,8 @@ -.{process, log, string, memory} := @use("../../../libraries/stn/src/lib.hb") +.{process, log, string, memory} := @use("../../../../../libraries/stn/src/lib.hb") -exe := @embed("./hello_world_and_spin.hbf") +exe := @embed("./assets/hello_world_and_spin.hbf") -main := fn(): void { +test := fn(): uint { buf := "\0\0\0\0\0\0\0" loop { log.info( @@ -16,4 +16,5 @@ main := fn(): void { i := 0 loop if i == 1000000 break else i += 1 } + return 0 } \ No newline at end of file diff --git a/sysdata/programs/test/src/tests/stn/sleep.hb b/sysdata/programs/test/src/tests/stn/sleep.hb new file mode 100644 index 00000000..9eaeb31d --- /dev/null +++ b/sysdata/programs/test/src/tests/stn/sleep.hb @@ -0,0 +1,8 @@ +.{sleep, log} := @use("../../../../../libraries/stn/src/lib.hb") + +test := fn(): uint { + log.info("BEFORE\0") + sleep.sleep_until_interrupt(32) + log.info("AFTER\0") + return 0 +} \ No newline at end of file diff --git a/sysdata/programs/timer_test/meta.toml b/sysdata/programs/timer_test/meta.toml deleted file mode 100644 index c05908d0..00000000 --- a/sysdata/programs/timer_test/meta.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "timer_test" -authors = ["Talha Qamar"] - -[dependants.libraries] - -[dependants.binaries] -hblang.version = "1.0.0" - -[build] -command = "hblang src/main.hb" diff --git a/sysdata/programs/timer_test/src/main.hb b/sysdata/programs/timer_test/src/main.hb deleted file mode 100644 index a491de4d..00000000 --- a/sysdata/programs/timer_test/src/main.hb +++ /dev/null @@ -1,8 +0,0 @@ -sleep := @use("../../../libraries/stn/src/sleep.hb") -log := @use("../../../libraries/stn/src/log.hb") - -main := fn(): void { - log.info("BEFORE\0") - sleep.sleep_until_interrupt(32) - log.info("AFTER\0") -} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 34ab7905..72445ba9 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -34,9 +34,6 @@ resolution = "1024x768x24" # [boot.limine.ableos.modules.ps2_keyboard_driver] # path = "boot:///ps2_keyboard_driver.hbf" -[boot.limine.ableos.modules.timer_test] -path = "boot:///timer_test.hbf" - # [boot.limine.ableos.modules.sunset_client] # path = "boot:///sunset_client.hbf" # @@ -52,8 +49,5 @@ path = "boot:///timer_test.hbf" # [boot.limine.ableos.modules.pcspkr] # path = "boot:///pcspkr.hbf" -# [boot.limine.ableos.modules.alloc_test] -# path = "boot:///alloc_test.hbf" - -# [boot.limine.ableos.modules.hash_test] -# path = "boot:///hash_test.hbf" +[boot.limine.ableos.modules.test] +path = "boot:///test.hbf"