From d19f15aa5cf5a0f138a2a7e310cf4ea79273aeee Mon Sep 17 00:00:00 2001 From: peony Date: Fri, 1 Nov 2024 18:35:30 +0100 Subject: [PATCH] I am good at this/s --- Cargo.lock | 14 +++++++------- repbuild/src/dev.rs | 3 --- sysdata/libraries/mouse/src/mouse.hb | 5 +++++ sysdata/libraries/render/src/software.hb | 10 +++++----- sysdata/programs/mouse_driver/src/main.hb | 5 ++--- .../programs/render_example/src/examples/cube.hb | 8 ++++++-- sysdata/system_config.toml | 8 ++++---- 7 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 sysdata/libraries/mouse/src/mouse.hb diff --git a/Cargo.lock b/Cargo.lock index ba032b3..0e8740e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "74f37166d7d48a0284b99dd824694c26119c700b53bf0d1540cdb147dbdaaf13" [[package]] name = "autocfg" @@ -253,12 +253,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#da7cd5926c81c3ff34bab0bb5d31f029efee4ebb" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#38a00cbaa09434324d209fc5f59480d2b6743fb3" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#da7cd5926c81c3ff34bab0bb5d31f029efee4ebb" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#38a00cbaa09434324d209fc5f59480d2b6743fb3" dependencies = [ "hashbrown 0.15.0", "hbbytecode", @@ -270,7 +270,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#da7cd5926c81c3ff34bab0bb5d31f029efee4ebb" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#38a00cbaa09434324d209fc5f59480d2b6743fb3" dependencies = [ "hbbytecode", ] @@ -677,9 +677,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.85" +version = "2.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "e89275301d38033efb81a6e60e3497e734dfcc62571f2854bf4b16690398824c" dependencies = [ "proc-macro2", "quote", diff --git a/repbuild/src/dev.rs b/repbuild/src/dev.rs index 7186d39..73df793 100644 --- a/repbuild/src/dev.rs +++ b/repbuild/src/dev.rs @@ -75,7 +75,6 @@ impl Package { &path, Options { fmt: true, - optimize: true, ..Default::default() }, &mut bytes, @@ -84,7 +83,6 @@ impl Package { hblang::run_compiler( &path, Options { - optimize: true, ..Default::default() }, &mut bytes, @@ -101,7 +99,6 @@ impl Package { &path, Options { dump_asm: true, - optimize: true, ..Default::default() }, &mut bytes, diff --git a/sysdata/libraries/mouse/src/mouse.hb b/sysdata/libraries/mouse/src/mouse.hb new file mode 100644 index 0000000..ea5273b --- /dev/null +++ b/sysdata/libraries/mouse/src/mouse.hb @@ -0,0 +1,5 @@ +.{Vec2} := @ + +get_pos := fn(): Vec2(uint) { + +} \ No newline at end of file diff --git a/sysdata/libraries/render/src/software.hb b/sysdata/libraries/render/src/software.hb index 98e32e0..ed1881a 100644 --- a/sysdata/libraries/render/src/software.hb +++ b/sysdata/libraries/render/src/software.hb @@ -36,7 +36,7 @@ free_surface := fn(surface: Surface): void { return @inline(memory.free, Color, surface.buf, @intcast(surface.width * surface.height), false) } -framebuffer := @as(^Color, idk) +framebuffer := @as(^Color, null) init := fn(doublebuffer: bool): Surface { framebuffer = dt.get(^Color, "framebuffer/fb0/ptr\0") @@ -162,7 +162,7 @@ put_line_high := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Col } 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 math.abs(uint, @intcast(@as(int, @intcast(p1.y)) - @as(int, @intcast(p0.y)))) < math.abs(uint, @intcast(@as(int, @intcast(p1.x)) - @as(int, @intcast(p0.x)))) { if p0.x > p1.x { @inline(put_line_low, surface, p1, p0, color) } else { @@ -331,9 +331,9 @@ put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): vo } put_tri := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), p2: Vec2(uint), color: Color): void { - put_line(surface, p0, p1, color) - put_line(surface, p1, p2, color) - put_line(surface, p2, p0, color) + @inline(put_line, surface, p0, p1, color) + @inline(put_line, surface, p1, p2, color) + @inline(put_line, surface, p2, p0, color) return } diff --git a/sysdata/programs/mouse_driver/src/main.hb b/sysdata/programs/mouse_driver/src/main.hb index a76d602..b9596c9 100644 --- a/sysdata/programs/mouse_driver/src/main.hb +++ b/sysdata/programs/mouse_driver/src/main.hb @@ -19,7 +19,6 @@ send_command := fn(command: u8): void { @inline(send_info, 0xD4) @inline(wait_for, 1) memory.outb(0x60, command) - return } get_response := fn(): u8 { @@ -35,10 +34,10 @@ main := fn(): int { log.info("Aux mouse device enabled.\0") send_command(0xF6) - get_response() + _ := get_response() send_command(0xF4) - get_response() + _ = get_response() loop { loop if (memory.inb(0x64) & 0x20) == 0x20 break diff --git a/sysdata/programs/render_example/src/examples/cube.hb b/sysdata/programs/render_example/src/examples/cube.hb index 73b7b27..37a8285 100644 --- a/sysdata/programs/render_example/src/examples/cube.hb +++ b/sysdata/programs/render_example/src/examples/cube.hb @@ -13,7 +13,7 @@ Vec3 := struct {x: int, y: int, z: int} vertecies := [Vec3].(.(-1, -1, -1), .(1, -1, -1), .(1, 1, -1), .(-1, 1, -1), .(-1, -1, 1), .(1, -1, 1), .(1, 1, 1), .(-1, 1, 1)) projected := @as([Vec3; 8], idk) -faces := [Face].(Face.(0, 1, 2, WIREFRAME, .(255, 0, 0, 255), @as(^Surface, idk))) +faces := [Face].(Face.(0, 1, 2, WIREFRAME, .(255, 0, 0, 255), null)) d := @as(int, 1) @@ -55,11 +55,15 @@ example := fn(): void { c := projected[face.c] if face.mode == WIREFRAME { - render.put_tri(screen, .(@intcast(0), @intcast(0)), .(@intcast(512), @intcast(128)), .(@intcast(256), @intcast(256)), face.color) + //render.put_tri(screen, .(@intcast(0), @intcast(0)), .(@intcast(512), @intcast(128)), .(@intcast(256), @intcast(256)), .(255, 0, 0, 255)) + //face.color) } index += 1 } + //render.put_line(screen, .(1, 1), .(512, 128), .(255, 0, 0, 255)) + //render.put_line(screen, .(256, 256), .(512, 128), .(255, 0, 0, 255)) + render.put_tri(screen, .(1, 1), .(512, 128), .(256, 256), .(255, 0, 0, 255)) //render.put_filled_tri(screen, .(128, 256), .(512, 512), .(10, 10), .(255, 255, 255, 255)) render.sync(screen) diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 8512a52..b5575d3 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -26,8 +26,8 @@ resolution = "1600x900x24" # [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" @@ -56,8 +56,8 @@ path = "boot:///render_example.hbf" # [boot.limine.ableos.modules.pumpkin_print] # path = "boot:///pumpkin_print.hbf" -# [boot.limine.ableos.modules.mouse_driver] -# path = "boot:///mouse_driver.hbf" +[boot.limine.ableos.modules.mouse_driver] +path = "boot:///mouse_driver.hbf" # [boot.limine.ableos.modules.mouse_test] # path = "boot:///mouse_test.hbf"