From 3409f5051a11de9ceb905da2fb0e1ddc4d463712 Mon Sep 17 00:00:00 2001 From: peony Date: Sun, 10 Nov 2024 09:03:14 -0600 Subject: [PATCH 1/7] Circle rendering support (janky) (#18) circle rendering Reviewed-on: https://git.ablecorp.us/AbleOS/ableos/pulls/18 Co-authored-by: peony Co-committed-by: peony --- sysdata/libraries/render/src/lib.hb | 12 ++- sysdata/libraries/render/src/software.hb | 84 +++++++++++++++++++ .../render_example/src/examples/orbit.hb | 36 ++++++++ sysdata/programs/render_example/src/main.hb | 2 +- sysdata/system_config.toml | 12 +-- 5 files changed, 136 insertions(+), 10 deletions(-) create mode 100644 sysdata/programs/render_example/src/examples/orbit.hb diff --git a/sysdata/libraries/render/src/lib.hb b/sysdata/libraries/render/src/lib.hb index c72b8cd..00279a3 100644 --- a/sysdata/libraries/render/src/lib.hb +++ b/sysdata/libraries/render/src/lib.hb @@ -38,14 +38,20 @@ $light_cyan := Color.(255, 255, 0, 255) put_pixel := mode.put_pixel put_rect := mode.put_rect put_filled_rect := mode.put_filled_rect +put_trirect := mode.put_trirect +put_circle := mode.put_circle +put_filled_circle := mode.put_filled_circle +put_textured_circle := mode.put_textured_circle put_line := mode.put_line +put_vline := mode.put_vline +put_hline := mode.put_hline clear := mode.clear put_surface := mode.put_surface put_text := mode.put_text // thanks peony for these three! -put_trirect := mode.put_trirect -put_vline := mode.put_vline -put_hline := mode.put_hline +//put_trirect := mode.put_trirect +//put_vline := mode.put_vline +//put_hline := mode.put_hline // Display sync := mode.sync \ No newline at end of file diff --git a/sysdata/libraries/render/src/software.hb b/sysdata/libraries/render/src/software.hb index efc8d92..0c4780e 100644 --- a/sysdata/libraries/render/src/software.hb +++ b/sysdata/libraries/render/src/software.hb @@ -251,6 +251,90 @@ put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): vo return } + +put_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void { + x := 0 + y := radius + error := @as(int, 3) - @as(int, @intcast(2 * radius)); + *@inline(indexptr, surface, pos.x + radius, pos.y) = color; + *@inline(indexptr, surface, pos.x - radius, pos.y) = color; + *@inline(indexptr, surface, pos.x, pos.y + radius) = color; + *@inline(indexptr, surface, pos.x, pos.y - radius) = color + + loop if y < x break else { + x += 1 + + if error > 0 { + y -= 1 + error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10 + } else { + error += 4 * @intcast(x) + 6 + }; + *@inline(indexptr, surface, pos.x + x, pos.y + y) = color; + *@inline(indexptr, surface, pos.x + y, pos.y + x) = color; + *@inline(indexptr, surface, pos.x - x, pos.y + y) = color; + *@inline(indexptr, surface, pos.x - y, pos.y + x) = color; + *@inline(indexptr, surface, pos.x + x, pos.y - y) = color; + *@inline(indexptr, surface, pos.x + y, pos.y - x) = color; + *@inline(indexptr, surface, pos.x - x, pos.y - y) = color; + *@inline(indexptr, surface, pos.x - y, pos.y - x) = color + } + + return +} + +put_filled_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void { + x := 0 + y := radius + error := @as(int, 3) - @as(int, @intcast(2 * radius)) + @inline(put_hline, surface, pos.y - x, pos.x - radius, pos.x + radius, color); + *@inline(indexptr, surface, pos.x, pos.y + radius) = color; + *@inline(indexptr, surface, pos.x, pos.y - radius) = color + + loop if y < x break else { + x += 1 + + if error > 0 { + @inline(put_hline, surface, pos.y + y, pos.x - x, pos.x + x, color) + @inline(put_hline, surface, pos.y - y, pos.x - x, pos.x + x, color) + y -= 1 + error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10 + } else { + error += 4 * @intcast(x) + 6 + } + @inline(put_hline, surface, pos.y + x, pos.x - y, pos.x + y, color) + @inline(put_hline, surface, pos.y - x, pos.x - y, pos.x + y, color) + } + + return +} + +put_textured_circle := fn(surface: Surface, source: Surface, source_pos: Vec2(uint), pos: Vec2(uint), radius: uint): void { + x := 0 + y := radius + error := @as(int, 3) - @as(int, @intcast(2 * radius)) + @inline(memory.copy, Color, @inline(indexptr, source, source_pos.x - y, source_pos.y), @inline(indexptr, surface, pos.x - y, pos.y), 2 * y); + *@inline(indexptr, surface, pos.x, pos.y + y) = *@inline(indexptr, source, source_pos.x, source_pos.y + y); + *@inline(indexptr, surface, pos.x, pos.y - y) = *@inline(indexptr, source, source_pos.x, source_pos.y - y) + + loop if y < x break else { + x += 1 + + if error > 0 { + @inline(memory.copy, Color, @inline(indexptr, source, source_pos.x - x, source_pos.y + y), @inline(indexptr, surface, pos.x - x, pos.y + y), 2 * x) + @inline(memory.copy, Color, @inline(indexptr, source, source_pos.x - x, source_pos.y - y), @inline(indexptr, surface, pos.x - x, pos.y - y), 2 * x) + y -= 1 + error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10 + } else { + error += 4 * @intcast(x) + 6 + } + @inline(memory.copy, Color, @inline(indexptr, source, source_pos.x - y, source_pos.y + x), @inline(indexptr, surface, pos.x - y, pos.y + x), 2 * y) + @inline(memory.copy, Color, @inline(indexptr, source, source_pos.x - y, source_pos.y - x), @inline(indexptr, surface, pos.x - y, pos.y - x), 2 * y) + } + + return +} + utf8_len_table := [u8].(0, 0, 2, 3) put_text := fn(surface: Surface, font: Font, pos: Vec2(uint), color: Color, str: ^u8): void { diff --git a/sysdata/programs/render_example/src/examples/orbit.hb b/sysdata/programs/render_example/src/examples/orbit.hb new file mode 100644 index 0000000..84b47e3 --- /dev/null +++ b/sysdata/programs/render_example/src/examples/orbit.hb @@ -0,0 +1,36 @@ +.{Vec2, sin, cos, PI} := @use("../../../../libraries/stn/src/lib.hb").math +render := @use("../../../../libraries/render/src/lib.hb") + +able_bmp := @embed("../../../../assets/able.bmp") +mini_bmp := @embed("../../../../assets/mini.bmp") + +/* expected result: + two textured circles rotating + around one yellow filled circle + with a blue line showing their + 'orbit' */ + +example := fn(): void { + able := render.image.from(@bitcast(&able_bmp)) + mini := render.image.from(@bitcast(&mini_bmp)) + if able == null | mini == null { + return + } + + angle := 0.0 + + screen := render.init(true) + + loop { + render.clear(screen, render.black) + render.put_filled_circle(screen, .(screen.width / 2, screen.height / 2), 128, render.light_yellow) + render.put_circle(screen, .(screen.width / 2, screen.height / 2), 256, render.light_blue) + // Precision issues? + render.put_textured_circle(screen, able, .(able.width / 2, able.height / 2), .(screen.width / 2 + @intcast(@fti(sin(angle) * 256)), screen.height / 2 + @intcast(@fti(cos(angle) * 256))), able.width / 2 - 1) + render.put_textured_circle(screen, mini, .(mini.width / 2, mini.height / 2), .(screen.width / 2 + @intcast(@fti(sin(angle + PI) * 256)), screen.height / 2 + @intcast(@fti(cos(angle + PI) * 256))), mini.width / 2 - 1) + render.sync(screen) + + angle += 0.01 + } + return +} \ No newline at end of file diff --git a/sysdata/programs/render_example/src/main.hb b/sysdata/programs/render_example/src/main.hb index 77cb04c..ab66cfa 100644 --- a/sysdata/programs/render_example/src/main.hb +++ b/sysdata/programs/render_example/src/main.hb @@ -1 +1 @@ -.{example: main} := @use("./examples/text.hb") \ No newline at end of file +.{example: main} := @use("./examples/orbit.hb") \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 1992a80..93bd739 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -22,14 +22,14 @@ resolution = "1024x768x24" [boot.limine.ableos.modules] -# [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.horizon] -path = "boot:///horizon.hbf" +# [boot.limine.ableos.modules.horizon] +# path = "boot:///horizon.hbf" -[boot.limine.ableos.modules.ps2_mouse_driver] -path = "boot:///ps2_mouse_driver.hbf" +# [boot.limine.ableos.modules.ps2_mouse_driver] +# path = "boot:///ps2_mouse_driver.hbf" # [boot.limine.ableos.modules.ps2_keyboard_driver] # path = "boot:///ps2_keyboard_driver.hbf" From 77a708d41e6274db71b8fcb0113440e52715b8f8 Mon Sep 17 00:00:00 2001 From: koniifer Date: Sun, 10 Nov 2024 18:57:48 +0000 Subject: [PATCH 2/7] sunrising sunset --- Cargo.lock | 6 +- sysdata/libraries/stn/src/buffer.hb | 12 ++-- sysdata/libraries/stn/src/memory.hb | 11 ++++ sysdata/libraries/sunset_proto/src/client.hb | 62 +++++++++++++++++++ sysdata/libraries/sunset_proto/src/lib.hb | 36 +++++++++++ sysdata/libraries/sunset_proto/src/message.hb | 4 ++ sysdata/libraries/sunset_proto/src/server.hb | 34 ++++++++++ sysdata/programs/horizon/src/main.hb | 6 +- sysdata/programs/sunset_client/meta.toml | 11 ++++ sysdata/programs/sunset_client/src/main.hb | 24 +++++++ sysdata/programs/sunset_server/meta.toml | 11 ++++ sysdata/programs/sunset_server/src/main.hb | 36 +++++++++++ sysdata/system_config.toml | 6 ++ 13 files changed, 247 insertions(+), 12 deletions(-) create mode 100644 sysdata/libraries/sunset_proto/src/client.hb create mode 100644 sysdata/libraries/sunset_proto/src/lib.hb create mode 100644 sysdata/libraries/sunset_proto/src/message.hb create mode 100644 sysdata/libraries/sunset_proto/src/server.hb create mode 100644 sysdata/programs/sunset_client/meta.toml create mode 100644 sysdata/programs/sunset_client/src/main.hb create mode 100644 sysdata/programs/sunset_server/meta.toml create mode 100644 sysdata/programs/sunset_server/src/main.hb diff --git a/Cargo.lock b/Cargo.lock index 56dc2fc..1e01574 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,12 +228,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#8b98c2ed1becb92046bb7b687ca00813da441248" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#8b98c2ed1becb92046bb7b687ca00813da441248" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" dependencies = [ "hashbrown 0.15.1", "hbbytecode", @@ -245,7 +245,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#8b98c2ed1becb92046bb7b687ca00813da441248" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" dependencies = [ "hbbytecode", ] diff --git a/sysdata/libraries/stn/src/buffer.hb b/sysdata/libraries/stn/src/buffer.hb index 680aec8..1912c59 100644 --- a/sysdata/libraries/stn/src/buffer.hb +++ b/sysdata/libraries/stn/src/buffer.hb @@ -1,27 +1,27 @@ string := @use("string.hb") -recv := fn($Expr: type, buffer_id: int, memory_map_location: ^u8): void { +recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^u8): void { return @eca(4, buffer_id, memory_map_location, @sizeof(Expr)) } -write := fn($Expr: type, msg: ^Expr, buffer_id: int): void { +write := fn($Expr: type, msg: ^Expr, buffer_id: uint): void { return @eca(3, buffer_id, msg, @sizeof(Expr)) } -recv_length := fn(buffer_id: int, memory_map_location: ^u8, length: int): void { +recv_length := fn(buffer_id: uint, memory_map_location: ^u8, length: uint): void { return @eca(4, buffer_id, memory_map_location, length) } -write_length := fn(msg: ^u8, buffer_id: int, length: int): void { +write_length := fn(msg: ^u8, buffer_id: uint, length: uint): void { return @eca(3, buffer_id, msg, length) } BufferMsg := packed struct {operation: u8, msg: ^u8, msg_len: uint} -create := fn(msg: ^u8): int { +create := fn(msg: ^u8): uint { return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg)) } -search := fn(msg: ^u8): int { +search := fn(msg: ^u8): uint { return @eca(3, 0, BufferMsg.(3, msg, @inline(string.length, msg)), @sizeof(BufferMsg)) } \ No newline at end of file diff --git a/sysdata/libraries/stn/src/memory.hb b/sysdata/libraries/stn/src/memory.hb index f0b951a..821e46f 100644 --- a/sysdata/libraries/stn/src/memory.hb +++ b/sysdata/libraries/stn/src/memory.hb @@ -2,6 +2,17 @@ PAGE_SIZE := 4096 MAX_ALLOC := 0xFF MAX_FREE := 0xFF +is_uninit := fn($Expr: type, ptr: ^Expr): bool { + i := 0 + loop if *(@as(^u8, @bitcast(ptr)) + i) != 0 return false else if i + 1 == @sizeof(Expr) return true else i += 1 +} + +uninit := fn($Expr: type): Expr { + empty := @as(Expr, idk) + @inline(set, u8, &0, @bitcast(&empty), @sizeof(Expr)) + return empty +} + dangling := fn($Expr: type): ^Expr { return @bitcast(@alignof(Expr)) } diff --git a/sysdata/libraries/sunset_proto/src/client.hb b/sysdata/libraries/sunset_proto/src/client.hb new file mode 100644 index 0000000..da1950c --- /dev/null +++ b/sysdata/libraries/sunset_proto/src/client.hb @@ -0,0 +1,62 @@ +.{math: .{Vec2}, buffer, log, memory} := @use("../../stn/src/lib.hb"); +.{Surface, new_surface} := @use("../../render/src/lib.hb"); +.{WindowWrapper, WindowID, WindowProps, WindowMessage, message, BUFFER} := @use("./lib.hb") + +buffer_id := @as(?uint, null) + +new_window := fn(props: WindowProps): ?WindowWrapper { + if buffer_id == null { + log.error("client: (request_new) buffer id is null. did you init the client?\0") + return null + } + buf := memory.uninit(?WindowWrapper) + buffer.write(WindowMessage, &.(message.new, 0, @sizeof(WindowProps), @bitcast(&props), @bitcast(&buf)), @unwrap(buffer_id)) + loop if memory.is_uninit(?WindowWrapper, &buf) == false break else { + } + // loop until i write a better socket + i := 0 + loop if i >= 1000 break else i += 1 + return buf +} + +update_window_props := fn(wrapper: WindowWrapper): ?WindowProps { + log.error("todo: sunset_proto/src/client/update_window_props.hb\0") + if buffer_id == null { + log.error("client: (request_update_properties) buffer id is null. did you init the client?\0") + return null + } + // TODO: buffer.write(WINDOWING_BUFFER, update properties) request + return null +} + +request_shutdown := fn(): ?bool { + if buffer_id == null { + log.error("client: (request_shutdown) buffer id is null. did you init the client?\0") + return null + } + buf := memory.uninit(?u8) + buffer.write(WindowMessage, &.(message.shutdown, 0, 0, memory.dangling(u8), @bitcast(&buf)), @unwrap(buffer_id)) + loop if memory.is_uninit(?u8, &buf) == false break else { + } + // loop until i write a better socket + i := 0 + loop if i >= 1000 break else i += 1 + // had to do ?u8 here, ?bool didnt work + if buf == null | @unwrap(buf) != 255 { + return false + } else { + return true + } +} + +init := fn(): void { + log.info("client: waiting for server\0") + id := 0 + loop if id != 0 { + buffer_id = id + log.info("client: done waiting\0") + return + } else { + id = buffer.search(BUFFER) + } +} \ No newline at end of file diff --git a/sysdata/libraries/sunset_proto/src/lib.hb b/sysdata/libraries/sunset_proto/src/lib.hb new file mode 100644 index 0000000..7006f7d --- /dev/null +++ b/sysdata/libraries/sunset_proto/src/lib.hb @@ -0,0 +1,36 @@ +.{math: .{Vec2}} := @use("../../stn/src/lib.hb"); +.{Surface} := @use("../../render/src/lib.hb") + +$BUFFER := "sunset\0" + +client := @use("./client.hb") +server := @use("./server.hb") +message := @use("./message.hb") + +WindowID := uint +MessageKind := uint + +WindowMessage := packed struct { + kind: MessageKind, + id: WindowID, + length: uint, + data_ptr: ^u8, + // need to replace this with a buffer id + callback: ^u8, +} + +WindowProps := struct { + position: Vec2(uint), + dimensions: Vec2(uint), + title: ^u8, +} + +WindowWrapper := struct { + id: WindowID, + props: WindowProps, +} + +Window := struct { + surface: Surface, + props: WindowProps, +} \ No newline at end of file diff --git a/sysdata/libraries/sunset_proto/src/message.hb b/sysdata/libraries/sunset_proto/src/message.hb new file mode 100644 index 0000000..700ab52 --- /dev/null +++ b/sysdata/libraries/sunset_proto/src/message.hb @@ -0,0 +1,4 @@ +$new := 0 +$destroy := 1 +$update_props := 2 +$shutdown := 3 \ No newline at end of file diff --git a/sysdata/libraries/sunset_proto/src/server.hb b/sysdata/libraries/sunset_proto/src/server.hb new file mode 100644 index 0000000..4581571 --- /dev/null +++ b/sysdata/libraries/sunset_proto/src/server.hb @@ -0,0 +1,34 @@ +.{math, log, string, random, buffer, memory} := @use("../../stn/src/lib.hb"); +.{Surface, new_surface} := @use("../../render/src/lib.hb"); +.{WindowWrapper, WindowID, WindowProps, WindowMessage, BUFFER} := @use("./lib.hb") + +WindowServer := struct {window_count: uint, buffer_id: uint} + +server := @as(?WindowServer, null) + +new_window_id := fn(): WindowID { + return random.any(uint) +} + +init := fn(): bool { + log.info("server: starting server\0") + server = .(0, buffer.create(BUFFER)) + return true +} + +recieve := fn(): ?WindowMessage { + if server == null { + log.error("server: (request_new) server is null. did you init the client?\0") + return null + } + buf := memory.uninit(WindowMessage) + buffer.recv(WindowMessage, @unwrap(server).buffer_id, @bitcast(&buf)) + if memory.is_uninit(WindowMessage, &buf) { + return null + } + return buf +} + +should_shutdown := fn(): bool { + return false +} \ No newline at end of file diff --git a/sysdata/programs/horizon/src/main.hb b/sysdata/programs/horizon/src/main.hb index 1b7ac83..0666373 100644 --- a/sysdata/programs/horizon/src/main.hb +++ b/sysdata/programs/horizon/src/main.hb @@ -60,9 +60,9 @@ main := fn(): int { // TODO: Read the window buffer here { - // ret := buffer.recv([u8; 4096], win_buff, mem_buf) - // for some reason this null check causes the compiler to spin forever - // if ret == null { + // buffer.recv([u8; 4096], win_buff, mem_buf) + // // for some reason this null check causes the compiler to spin forever + // if *mem_buf == 0 { // log.info("No messages\0") // } else { // log.info("Handle Messages\0") diff --git a/sysdata/programs/sunset_client/meta.toml b/sysdata/programs/sunset_client/meta.toml new file mode 100644 index 0000000..cbc588c --- /dev/null +++ b/sysdata/programs/sunset_client/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "sunset_client" +authors = ["koniifer"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/sunset_client/src/main.hb b/sysdata/programs/sunset_client/src/main.hb new file mode 100644 index 0000000..a5434df --- /dev/null +++ b/sysdata/programs/sunset_client/src/main.hb @@ -0,0 +1,24 @@ +.{log, string} := @use("../../../libraries/stn/src/lib.hb") +sunset := @use("../../../libraries/sunset_proto/src/lib.hb") + +main := fn(): void { + sunset.client.init() + log.info("client: request new window\0") + window := sunset.client.new_window(.(.(100, 100), .(150, 150), "Hello, World!\0")) + if window == null { + log.error("Could not create window\0") + return + } + log.info("client: window created. title:\0") + log.info(window.props.title) + window.props.position = .(500, 500) + props := @unwrap(sunset.client.update_window_props(@unwrap(window))) + if props.position.x != @unwrap(window).props.position.x { + log.error("client: we did not update props\0") + } + log.info("client: sending shutdown request\0") + shutdown := sunset.client.request_shutdown() + if shutdown == null { + log.error("client: didnt shutdown the server\0") + } +} \ No newline at end of file diff --git a/sysdata/programs/sunset_server/meta.toml b/sysdata/programs/sunset_server/meta.toml new file mode 100644 index 0000000..84c7d22 --- /dev/null +++ b/sysdata/programs/sunset_server/meta.toml @@ -0,0 +1,11 @@ +[package] +name = "sunset_server" +authors = ["koniifer"] + +[dependants.libraries] + +[dependants.binaries] +hblang.version = "1.0.0" + +[build] +command = "hblang src/main.hb" diff --git a/sysdata/programs/sunset_server/src/main.hb b/sysdata/programs/sunset_server/src/main.hb new file mode 100644 index 0000000..c3e2011 --- /dev/null +++ b/sysdata/programs/sunset_server/src/main.hb @@ -0,0 +1,36 @@ +.{log} := @use("../../../libraries/stn/src/lib.hb") +render := @use("../../../libraries/render/src/lib.hb"); +.{server, message, WindowWrapper, WindowProps} := @use("../../../libraries/sunset_proto/src/lib.hb") + +psf := @embed("../../../assets/consolefonts/tamsyn/10x20r.psf") + +main := fn(): void { + screen := render.init(false) + font := render.text.font_from_psf2(@bitcast(&psf), false) + if font == null { + return + } + if server.init() == false { + log.error("Failed to create server\0") + return + } + loop if server.should_shutdown() break else { + recv := server.recieve() + if recv == null { + continue + } else if recv.kind == message.new { + props := *@as(^WindowProps, @bitcast(recv.data_ptr)); + *@as(^?WindowWrapper, @bitcast(recv.callback)) = WindowWrapper.(0, props) + render.put_rect(screen, props.position, props.dimensions, render.white) + render.put_text(screen, font, props.position + .(1, 1), render.white, props.title) + render.put_hline(screen, props.position.y + font.height + 2, props.position.x, props.position.x + props.dimensions.x, render.white) + log.info("server: made a new window\0") + } else if recv.kind == message.shutdown { + *@as(^?u8, @bitcast(recv.callback)) = 255 + break + } + } + + render.put_text(screen, font, .(0, 0), render.white, "Shutdown triggered\0") + log.info("Server shutdown\0") +} \ No newline at end of file diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 93bd739..53d17e6 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -33,3 +33,9 @@ path = "boot:///render_example.hbf" # [boot.limine.ableos.modules.ps2_keyboard_driver] # path = "boot:///ps2_keyboard_driver.hbf" + +[boot.limine.ableos.modules.sunset_client] +path = "boot:///sunset_client.hbf" + +[boot.limine.ableos.modules.sunset_server] +path = "boot:///sunset_server.hbf" From 00034640990efba2e754826ca56d37274a5d114b Mon Sep 17 00:00:00 2001 From: Able Date: Sun, 10 Nov 2024 13:00:39 -0600 Subject: [PATCH 3/7] sunsetting sunset --- todo.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 todo.md diff --git a/todo.md b/todo.md new file mode 100644 index 0000000..9f97b77 --- /dev/null +++ b/todo.md @@ -0,0 +1,31 @@ +@konii + Windowing System + Rendering + +@able + Windowing System + Interrupt Forwarding + + +@peony + PS/2 + XYZ + + +@kodin + AIDL AbleOS Interface Description Language + UI-SEXPR lispy ui decl language + +@unassigned + FileIO (Fat32) + DiskIO (Undecided Disk type) + Proper Memory Protection + hblang^2 (hblang compiler in hblang) + Channels (Two buffers bundled together to form two way communication) + Kernel Testing Framework (A rust framework for testing the kernel) + Userland Testing Framework (An hblang framework for testing the userspace) + PCI/E (Honestly I have no fucking clue whats going on with PCI or why userland cant properly read it) + + + + From 2f5bc73665ceaf3d7ec9e89aebac29458c14d0b1 Mon Sep 17 00:00:00 2001 From: Able Date: Sun, 10 Nov 2024 13:13:38 -0600 Subject: [PATCH 4/7] The List --- todo.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/todo.md b/todo.md index 9f97b77..c1b6ea2 100644 --- a/todo.md +++ b/todo.md @@ -5,7 +5,7 @@ @able Windowing System Interrupt Forwarding - + @peony PS/2 @@ -16,15 +16,22 @@ AIDL AbleOS Interface Description Language UI-SEXPR lispy ui decl language +@morshy + Simple Userland Allocator + @unassigned FileIO (Fat32) DiskIO (Undecided Disk type) Proper Memory Protection - hblang^2 (hblang compiler in hblang) Channels (Two buffers bundled together to form two way communication) Kernel Testing Framework (A rust framework for testing the kernel) Userland Testing Framework (An hblang framework for testing the userspace) PCI/E (Honestly I have no fucking clue whats going on with PCI or why userland cant properly read it) + Kernel Reimpl (Do not you dare think about this yet its only here as an option to show goals) + + AbleOS Compiler Collection + acc-asm + hblang^2 (hblang compiler in hblang) From b21c05e9244706f4e84f29f78627940238ef9f6c Mon Sep 17 00:00:00 2001 From: koniifer Date: Sun, 10 Nov 2024 19:37:37 +0000 Subject: [PATCH 5/7] compiler bugfix --- Cargo.lock | 6 +++--- sysdata/programs/sunset_client/src/main.hb | 4 ++-- sysdata/system_config.toml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e01574..4664788 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -228,12 +228,12 @@ dependencies = [ [[package]] name = "hbbytecode" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6274f3455d0545a64f2cc866b39d409e0a73427" [[package]] name = "hblang" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6274f3455d0545a64f2cc866b39d409e0a73427" dependencies = [ "hashbrown 0.15.1", "hbbytecode", @@ -245,7 +245,7 @@ dependencies = [ [[package]] name = "hbvm" version = "0.1.0" -source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#c61efc393361089f5217db9f4a9011ed0248b8db" +source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b6274f3455d0545a64f2cc866b39d409e0a73427" dependencies = [ "hbbytecode", ] diff --git a/sysdata/programs/sunset_client/src/main.hb b/sysdata/programs/sunset_client/src/main.hb index a5434df..a9def72 100644 --- a/sysdata/programs/sunset_client/src/main.hb +++ b/sysdata/programs/sunset_client/src/main.hb @@ -12,8 +12,8 @@ main := fn(): void { log.info("client: window created. title:\0") log.info(window.props.title) window.props.position = .(500, 500) - props := @unwrap(sunset.client.update_window_props(@unwrap(window))) - if props.position.x != @unwrap(window).props.position.x { + props := @unwrap(sunset.client.update_window_props(window)) + if props.position.x != window.props.position.x { log.error("client: we did not update props\0") } log.info("client: sending shutdown request\0") diff --git a/sysdata/system_config.toml b/sysdata/system_config.toml index 53d17e6..da9cbd0 100644 --- a/sysdata/system_config.toml +++ b/sysdata/system_config.toml @@ -22,8 +22,8 @@ resolution = "1024x768x24" [boot.limine.ableos.modules] -[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.horizon] # path = "boot:///horizon.hbf" From bae58ade616e0fb884a0e7955a3910a5666311ac Mon Sep 17 00:00:00 2001 From: koniifer Date: Sun, 10 Nov 2024 20:04:49 +0000 Subject: [PATCH 6/7] skill issue fix --- sysdata/libraries/stn/src/math.hb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdata/libraries/stn/src/math.hb b/sysdata/libraries/stn/src/math.hb index f22e17f..5b791b4 100644 --- a/sysdata/libraries/stn/src/math.hb +++ b/sysdata/libraries/stn/src/math.hb @@ -40,7 +40,7 @@ $TABLE_SIZE := @as(i32, 256) sin := fn(theta: f32): f32 { si := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) - d := theta - @floatcast(@itf(si)) * 2.0 * PI / @itf(TABLE_SIZE) + d := theta - @itf(si) * 2.0 * PI / @itf(TABLE_SIZE) ci := si + TABLE_SIZE / 4 & TABLE_SIZE - 1 si &= TABLE_SIZE - 1 return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d @@ -48,10 +48,10 @@ sin := fn(theta: f32): f32 { cos := fn(theta: f32): f32 { ci := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) - d := theta - @floatcast(@itf(ci)) * 2.0 * PI / @itf(TABLE_SIZE) + d := theta - @itf(ci) * 2.0 * PI / @itf(TABLE_SIZE) si := ci + TABLE_SIZE / 4 & TABLE_SIZE - 1 ci &= TABLE_SIZE - 1 - return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d + return SIN_TABLE[@bitcast(si)] - (SIN_TABLE[@bitcast(ci)] + 0.5 * SIN_TABLE[@bitcast(si)] * d) * d } tan := fn(theta: f32): f32 { From 97ceb12d6ec653a1bc409edbad4d9474f3aadc6c Mon Sep 17 00:00:00 2001 From: koniifer Date: Sun, 10 Nov 2024 20:07:03 +0000 Subject: [PATCH 7/7] double skill issue --- sysdata/libraries/stn/src/math.hb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdata/libraries/stn/src/math.hb b/sysdata/libraries/stn/src/math.hb index 5b791b4..1365d0d 100644 --- a/sysdata/libraries/stn/src/math.hb +++ b/sysdata/libraries/stn/src/math.hb @@ -40,7 +40,7 @@ $TABLE_SIZE := @as(i32, 256) sin := fn(theta: f32): f32 { si := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) - d := theta - @itf(si) * 2.0 * PI / @itf(TABLE_SIZE) + d := theta - @floatcast(@itf(si)) * 2.0 * PI / @floatcast(@itf(TABLE_SIZE)) ci := si + TABLE_SIZE / 4 & TABLE_SIZE - 1 si &= TABLE_SIZE - 1 return SIN_TABLE[@bitcast(si)] + (SIN_TABLE[@bitcast(ci)] - 0.5 * SIN_TABLE[@bitcast(si)] * d) * d @@ -48,7 +48,7 @@ sin := fn(theta: f32): f32 { cos := fn(theta: f32): f32 { ci := @fti(theta * 0.5 * @itf(TABLE_SIZE) / PI) - d := theta - @itf(ci) * 2.0 * PI / @itf(TABLE_SIZE) + d := theta - @floatcast(@itf(ci)) * 2.0 * PI / @floatcast(@itf(TABLE_SIZE)) si := ci + TABLE_SIZE / 4 & TABLE_SIZE - 1 ci &= TABLE_SIZE - 1 return SIN_TABLE[@bitcast(si)] - (SIN_TABLE[@bitcast(ci)] + 0.5 * SIN_TABLE[@bitcast(si)] * d) * d