forked from AbleOS/ableos
various opts and keeping on top of compiler changes
This commit is contained in:
parent
e6d8f5c822
commit
dc9273b3c1
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -82,9 +82,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.37"
|
version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40545c26d092346d8a8dab71ee48e7685a7a9cba76e634790c215b41a4a7b4cf"
|
checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shlex",
|
"shlex",
|
||||||
]
|
]
|
||||||
|
@ -228,12 +228,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d99672b75179b79249c4b6b91dfccef0b757fa3a"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b71031c1463c2bec1984316ea5f5173a9e09c028"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d99672b75179b79249c4b6b91dfccef0b757fa3a"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b71031c1463c2bec1984316ea5f5173a9e09c028"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown 0.15.1",
|
"hashbrown 0.15.1",
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
|
@ -245,7 +245,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbvm"
|
name = "hbvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#d99672b75179b79249c4b6b91dfccef0b757fa3a"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#b71031c1463c2bec1984316ea5f5173a9e09c028"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode",
|
"hbbytecode",
|
||||||
]
|
]
|
||||||
|
|
|
@ -25,42 +25,16 @@ fn alloc_page(vm: &mut Vm, _mem_addr: u64, _length: usize) -> Result<(), MemoryS
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn memset(mut dest: *mut u8, src: *const u8, count: usize, size: usize) {
|
unsafe fn memset(dest: *mut u8, src: *const u8, count: usize, size: usize) {
|
||||||
const BLOCK_SIZE: usize = 64;
|
let total_size = count * size;
|
||||||
let mut remaining = count * size;
|
src.copy_to_nonoverlapping(dest, size);
|
||||||
|
|
||||||
if remaining < 16 {
|
let mut copied = size;
|
||||||
src.copy_to_nonoverlapping(dest, remaining);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut buffer = [0u8; BLOCK_SIZE];
|
while copied < total_size {
|
||||||
let mut buffer_size = size;
|
let copy_size = copied.min(total_size - copied);
|
||||||
src.copy_to_nonoverlapping(buffer.as_mut_ptr(), size);
|
dest.add(copied).copy_from_nonoverlapping(dest, copy_size);
|
||||||
|
copied += copy_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);
|
|
||||||
buffer_size *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
let buffer_ptr = buffer.as_ptr() as *const u64;
|
|
||||||
|
|
||||||
while (dest as usize) & 7 != 0 && remaining >= 8 {
|
|
||||||
buffer.as_ptr().copy_to_nonoverlapping(dest, 1);
|
|
||||||
dest = dest.add(1);
|
|
||||||
remaining -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while core::intrinsics::likely(remaining >= 8) {
|
|
||||||
*(dest as *mut u64) = *buffer_ptr;
|
|
||||||
dest = dest.add(8);
|
|
||||||
remaining -= 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if remaining > 0 {
|
|
||||||
buffer.as_ptr().copy_to_nonoverlapping(dest, remaining);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.{Color, Surface, new_surface, put_surface} := @use("../lib.hb");
|
.{Color, Surface, new_surface, put_surface} := @use("../lib.hb");
|
||||||
.{log, memory} := @use("../../../stn/src/lib.hb")
|
.{log} := @use("../../../stn/src/lib.hb")
|
||||||
|
|
||||||
BitmapFileHeader := packed struct {
|
BitmapFileHeader := packed struct {
|
||||||
magic: u16,
|
magic: u16,
|
||||||
|
@ -41,7 +41,7 @@ from := fn(bmp: ^u8): ?Surface {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
lhs := Surface.(@bitcast(bmp + file_header.offset), info_header.width, info_header.height)
|
lhs := Surface.(@bitcast(bmp + file_header.offset), info_header.width, info_header.height, info_header.width * info_header.height)
|
||||||
rhs := new_surface(info_header.width, info_header.height)
|
rhs := new_surface(info_header.width, info_header.height)
|
||||||
put_surface(rhs, lhs, .(0, 0), true)
|
put_surface(rhs, lhs, .(0, 0), true)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.{Color, Surface, new_surface} := @use("../lib.hb");
|
.{Color, Surface, new_surface} := @use("../lib.hb");
|
||||||
.{log, memory} := @use("../../../stn/src/lib.hb")
|
.{log} := @use("../../../stn/src/lib.hb")
|
||||||
|
|
||||||
/* source:
|
/* source:
|
||||||
https://github.com/phoboslab/qoi/blob/master/qoi.h */
|
https://github.com/phoboslab/qoi/blob/master/qoi.h */
|
||||||
|
@ -13,7 +13,7 @@ $QOI_OP_RUN := 0xC0
|
||||||
$QOI_OP_RGB := 0xFE
|
$QOI_OP_RGB := 0xFE
|
||||||
$QOI_OP_RGBA := 0xFF
|
$QOI_OP_RGBA := 0xFF
|
||||||
$QOI_MASK_2 := 0xC0
|
$QOI_MASK_2 := 0xC0
|
||||||
QOI_COLOR_HASH := fn(c: Color): u8 {
|
$QOI_COLOR_HASH := fn(c: Color): u8 {
|
||||||
return (c.r * 3 + c.g * 5 + c.b * 7 + c.a * 11) % 64
|
return (c.r * 3 + c.g * 5 + c.b * 7 + c.a * 11) % 64
|
||||||
}
|
}
|
||||||
$QOI_MAGIC := 0x716F6966
|
$QOI_MAGIC := 0x716F6966
|
||||||
|
@ -89,7 +89,7 @@ from := fn(qoi: ^u8): ?Surface {
|
||||||
run = b1 & 0x3F
|
run = b1 & 0x3F
|
||||||
}
|
}
|
||||||
|
|
||||||
index[@inline(QOI_COLOR_HASH, px)] = px
|
index[QOI_COLOR_HASH(px)] = px
|
||||||
};
|
};
|
||||||
|
|
||||||
*(surface.buf + px_pos) = px
|
*(surface.buf + px_pos) = px
|
||||||
|
|
|
@ -10,19 +10,21 @@ Surface := struct {
|
||||||
buf: ^Color,
|
buf: ^Color,
|
||||||
width: uint,
|
width: uint,
|
||||||
height: uint,
|
height: uint,
|
||||||
|
size: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
new_surface := fn(width: uint, height: uint): Surface {
|
new_surface := fn(width: uint, height: uint): Surface {
|
||||||
return .(
|
return .(
|
||||||
@inline(memory.alloc, Color, width * height),
|
memory.alloc(Color, width * height),
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
width * height,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
clone_surface := fn(surface: ^Surface): Surface {
|
clone_surface := fn(surface: ^Surface): Surface {
|
||||||
new := new_surface(surface.width, surface.height)
|
new := new_surface(surface.width, surface.height)
|
||||||
@inline(memory.copy, Color, surface.buf, new.buf, @intcast(surface.width * surface.height))
|
memory.copy(Color, surface.buf, new.buf, @intcast(surface.size))
|
||||||
return new
|
return new
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,42 +35,38 @@ init := fn(doublebuffer: bool): Surface {
|
||||||
if doublebuffer {
|
if doublebuffer {
|
||||||
return new_surface(width, height)
|
return new_surface(width, height)
|
||||||
} else {
|
} else {
|
||||||
return .(framebuffer, width, height)
|
return .(framebuffer, width, height, width * height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear := fn(surface: Surface, color: Color): void {
|
$clear := fn(surface: Surface, color: Color): void {
|
||||||
return @inline(memory.set, Color, &color, surface.buf, surface.width * surface.height)
|
memory.set(Color, &color, surface.buf, surface.width * surface.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
sync := fn(surface: Surface): void {
|
$sync := fn(surface: Surface): void {
|
||||||
if surface.buf == framebuffer {
|
memory.copy(Color, surface.buf, framebuffer, @bitcast(surface.width * surface.height))
|
||||||
return
|
|
||||||
}
|
|
||||||
return @inline(memory.copy, Color, surface.buf, framebuffer, @bitcast(surface.width * surface.height))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
index := fn(surface: Surface, x: uint, y: uint): uint {
|
$index := fn(surface: Surface, x: uint, y: uint): uint {
|
||||||
return x + surface.width * y
|
return x + surface.width * y
|
||||||
}
|
}
|
||||||
|
|
||||||
indexptr := fn(surface: Surface, x: uint, y: uint): ^Color {
|
$indexptr := fn(surface: Surface, x: uint, y: uint): ^Color {
|
||||||
return surface.buf + @inline(index, surface, x, y)
|
return surface.buf + index(surface, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void {
|
$put_pixel := fn(surface: Surface, pos: Vec2(uint), color: Color): void {
|
||||||
*@inline(indexptr, surface, pos.x, pos.y) = color
|
return *indexptr(surface, pos.x, pos.y) = color
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
put_filled_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), 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)
|
top_start_idx := indexptr(surface, pos.x, pos.y)
|
||||||
bottom_start_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y - 1)
|
bottom_start_idx := indexptr(surface, pos.x, pos.y + tr.y - 1)
|
||||||
rows_to_fill := tr.y
|
rows_to_fill := tr.y
|
||||||
|
|
||||||
loop if rows_to_fill <= 1 break else {
|
loop if rows_to_fill <= 1 break else {
|
||||||
@inline(memory.set, Color, &color, top_start_idx, tr.x)
|
memory.set(Color, &color, top_start_idx, tr.x)
|
||||||
@inline(memory.set, Color, &color, bottom_start_idx, tr.x)
|
memory.set(Color, &color, bottom_start_idx, tr.x)
|
||||||
|
|
||||||
top_start_idx += surface.width
|
top_start_idx += surface.width
|
||||||
bottom_start_idx -= surface.width
|
bottom_start_idx -= surface.width
|
||||||
|
@ -76,16 +74,16 @@ put_filled_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color:
|
||||||
}
|
}
|
||||||
|
|
||||||
if rows_to_fill == 1 {
|
if rows_to_fill == 1 {
|
||||||
@inline(memory.set, Color, &color, top_start_idx, tr.x)
|
memory.set(Color, &color, top_start_idx, tr.x)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
put_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), 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)
|
start_idx := indexptr(surface, pos.x, pos.y)
|
||||||
end_idx := @inline(indexptr, surface, pos.x, pos.y + tr.y)
|
end_idx := indexptr(surface, pos.x, pos.y + tr.y)
|
||||||
right_start_idx := @inline(indexptr, surface, pos.x + tr.x, pos.y)
|
right_start_idx := indexptr(surface, pos.x + tr.x, pos.y)
|
||||||
|
|
||||||
loop if start_idx > end_idx break else {
|
loop if start_idx > end_idx break else {
|
||||||
*start_idx = color;
|
*start_idx = color;
|
||||||
|
@ -94,8 +92,8 @@ put_rect := fn(surface: Surface, pos: Vec2(uint), tr: Vec2(uint), color: Color):
|
||||||
right_start_idx += surface.width
|
right_start_idx += surface.width
|
||||||
}
|
}
|
||||||
|
|
||||||
@inline(memory.set, Color, &color, @inline(indexptr, surface, pos.x, pos.y), @bitcast(tr.x + 1))
|
memory.set(Color, &color, indexptr(surface, pos.x, pos.y), @bitcast(tr.x + 1))
|
||||||
@inline(memory.set, Color, &color, @inline(indexptr, surface, pos.x, pos.y + tr.y), @bitcast(tr.x + 1))
|
memory.set(Color, &color, indexptr(surface, pos.x, pos.y + tr.y), @bitcast(tr.x + 1))
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -112,7 +110,7 @@ put_line_low := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Colo
|
||||||
y := p0.y
|
y := p0.y
|
||||||
x := p0.x
|
x := p0.x
|
||||||
loop if x == p1.x break else {
|
loop if x == p1.x break else {
|
||||||
*@inline(indexptr, surface, x, y) = color
|
*indexptr(surface, x, y) = color
|
||||||
if D > 0 {
|
if D > 0 {
|
||||||
y += yi
|
y += yi
|
||||||
D += 2 * (dy - dx)
|
D += 2 * (dy - dx)
|
||||||
|
@ -136,7 +134,7 @@ put_line_high := fn(surface: Surface, p0: Vec2(uint), p1: Vec2(uint), color: Col
|
||||||
x := p0.x
|
x := p0.x
|
||||||
y := p0.y
|
y := p0.y
|
||||||
loop if y == p1.y break else {
|
loop if y == p1.y break else {
|
||||||
*@inline(indexptr, surface, x, y) = color
|
*indexptr(surface, x, y) = color
|
||||||
if D > 0 {
|
if D > 0 {
|
||||||
x += xi
|
x += xi
|
||||||
D += 2 * (dx - dy)
|
D += 2 * (dx - dy)
|
||||||
|
@ -169,8 +167,8 @@ put_surface := fn(surface: Surface, top: Surface, pos: Vec2(uint), flip_v: bool)
|
||||||
src_top_cursor := top.buf
|
src_top_cursor := top.buf
|
||||||
src_bottom_cursor := top.buf + top.width * (top.height - 1)
|
src_bottom_cursor := top.buf + top.width * (top.height - 1)
|
||||||
|
|
||||||
dst_top_idx := @inline(indexptr, surface, pos.x, pos.y)
|
dst_top_idx := indexptr(surface, pos.x, pos.y)
|
||||||
dst_bottom_idx := @inline(indexptr, surface, pos.x, pos.y + top.height - 1)
|
dst_bottom_idx := indexptr(surface, pos.x, pos.y + top.height - 1)
|
||||||
|
|
||||||
dst_increment := surface.width
|
dst_increment := surface.width
|
||||||
|
|
||||||
|
@ -184,8 +182,8 @@ put_surface := fn(surface: Surface, top: Surface, pos: Vec2(uint), flip_v: bool)
|
||||||
rows_to_copy := top.height
|
rows_to_copy := top.height
|
||||||
|
|
||||||
loop if rows_to_copy <= 1 break else {
|
loop if rows_to_copy <= 1 break else {
|
||||||
@inline(memory.copy, Color, src_top_cursor, dst_top_idx, top.width)
|
memory.copy(Color, src_top_cursor, dst_top_idx, top.width)
|
||||||
@inline(memory.copy, Color, src_bottom_cursor, dst_bottom_idx, top.width)
|
memory.copy(Color, src_bottom_cursor, dst_bottom_idx, top.width)
|
||||||
|
|
||||||
dst_top_idx += dst_increment
|
dst_top_idx += dst_increment
|
||||||
dst_bottom_idx -= dst_increment
|
dst_bottom_idx -= dst_increment
|
||||||
|
@ -195,7 +193,7 @@ put_surface := fn(surface: Surface, top: Surface, pos: Vec2(uint), flip_v: bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rows_to_copy == 1 {
|
if rows_to_copy == 1 {
|
||||||
@inline(memory.copy, Color, src_top_cursor, dst_top_idx, top.width)
|
memory.copy(Color, src_top_cursor, dst_top_idx, top.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -233,7 +231,7 @@ put_vline := fn(surface: Surface, x: uint, y0: uint, y1: uint, color: Color): vo
|
||||||
y := y0
|
y := y0
|
||||||
|
|
||||||
loop if y == y1 break else {
|
loop if y == y1 break else {
|
||||||
*@inline(indexptr, surface, x, y) = color
|
*indexptr(surface, x, y) = color
|
||||||
y += 1
|
y += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +245,8 @@ put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): vo
|
||||||
x0 = x1
|
x0 = x1
|
||||||
x1 = tmp
|
x1 = tmp
|
||||||
}
|
}
|
||||||
@inline(memory.set, Color, &color, @inline(indexptr, surface, x0, y), @bitcast(x1 - x0 - 1))
|
// x0 = math.min(x0, x1)
|
||||||
|
memory.set(Color, &color, indexptr(surface, x0, y), @bitcast(x1 - x0 - 1))
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -255,29 +254,29 @@ put_hline := fn(surface: Surface, y: uint, x0: uint, x1: uint, color: Color): vo
|
||||||
put_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void {
|
put_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void {
|
||||||
x := 0
|
x := 0
|
||||||
y := radius
|
y := radius
|
||||||
error := @as(int, 3) - @as(int, @intcast(2 * radius));
|
error := @as(int, 3) - @intcast(2 * radius);
|
||||||
*@inline(indexptr, surface, pos.x + radius, pos.y) = color;
|
*indexptr(surface, pos.x + radius, pos.y) = color;
|
||||||
*@inline(indexptr, surface, pos.x - radius, pos.y) = color;
|
*indexptr(surface, pos.x - radius, pos.y) = color;
|
||||||
*@inline(indexptr, surface, pos.x, pos.y + radius) = color;
|
*indexptr(surface, pos.x, pos.y + radius) = color;
|
||||||
*@inline(indexptr, surface, pos.x, pos.y - radius) = color
|
*indexptr(surface, pos.x, pos.y - radius) = color
|
||||||
|
|
||||||
loop if y < x break else {
|
loop if y < x break else {
|
||||||
x += 1
|
x += 1
|
||||||
|
|
||||||
if error > 0 {
|
if error > 0 {
|
||||||
y -= 1
|
y -= 1
|
||||||
error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10
|
error += 4 * (@intcast(x) - @intcast(y)) + 10
|
||||||
} else {
|
} else {
|
||||||
error += 4 * @intcast(x) + 6
|
error += 4 * @intcast(x) + 6
|
||||||
};
|
};
|
||||||
*@inline(indexptr, surface, pos.x + x, pos.y + y) = color;
|
*indexptr(surface, pos.x + x, pos.y + y) = color;
|
||||||
*@inline(indexptr, surface, pos.x + y, pos.y + x) = color;
|
*indexptr(surface, pos.x + y, pos.y + x) = color;
|
||||||
*@inline(indexptr, surface, pos.x - x, pos.y + y) = color;
|
*indexptr(surface, pos.x - x, pos.y + y) = color;
|
||||||
*@inline(indexptr, surface, pos.x - y, pos.y + x) = color;
|
*indexptr(surface, pos.x - y, pos.y + x) = color;
|
||||||
*@inline(indexptr, surface, pos.x + x, pos.y - y) = color;
|
*indexptr(surface, pos.x + x, pos.y - y) = color;
|
||||||
*@inline(indexptr, surface, pos.x + y, pos.y - x) = color;
|
*indexptr(surface, pos.x + y, pos.y - x) = color;
|
||||||
*@inline(indexptr, surface, pos.x - x, pos.y - y) = color;
|
*indexptr(surface, pos.x - x, pos.y - y) = color;
|
||||||
*@inline(indexptr, surface, pos.x - y, pos.y - x) = color
|
*indexptr(surface, pos.x - y, pos.y - x) = color
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -286,24 +285,24 @@ put_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color):
|
||||||
put_filled_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void {
|
put_filled_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color: Color): void {
|
||||||
x := 0
|
x := 0
|
||||||
y := radius
|
y := radius
|
||||||
error := @as(int, 3) - @as(int, @intcast(2 * radius))
|
error := @as(int, 3) - @intcast(2 * radius)
|
||||||
@inline(put_hline, surface, pos.y - x, pos.x - radius, pos.x + radius, color);
|
put_hline(surface, pos.y - x, pos.x - radius, pos.x + radius, color);
|
||||||
*@inline(indexptr, surface, pos.x, pos.y + radius) = color;
|
*indexptr(surface, pos.x, pos.y + radius) = color;
|
||||||
*@inline(indexptr, surface, pos.x, pos.y - radius) = color
|
*indexptr(surface, pos.x, pos.y - radius) = color
|
||||||
|
|
||||||
loop if y < x break else {
|
loop if y < x break else {
|
||||||
x += 1
|
x += 1
|
||||||
|
|
||||||
if error > 0 {
|
if error > 0 {
|
||||||
@inline(put_hline, surface, pos.y + y, pos.x - x, pos.x + x, color)
|
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)
|
put_hline(surface, pos.y - y, pos.x - x, pos.x + x, color)
|
||||||
y -= 1
|
y -= 1
|
||||||
error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10
|
error += 4 * (@intcast(x) - @intcast(y)) + 10
|
||||||
} else {
|
} else {
|
||||||
error += 4 * @intcast(x) + 6
|
error += 4 * @intcast(x) + 6
|
||||||
}
|
}
|
||||||
@inline(put_hline, surface, pos.y + x, pos.x - y, pos.x + y, color)
|
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)
|
put_hline(surface, pos.y - x, pos.x - y, pos.x + y, color)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -312,24 +311,24 @@ put_filled_circle := fn(surface: Surface, pos: Vec2(uint), radius: uint, color:
|
||||||
put_textured_circle := fn(surface: Surface, source: Surface, source_pos: Vec2(uint), pos: Vec2(uint), radius: uint): void {
|
put_textured_circle := fn(surface: Surface, source: Surface, source_pos: Vec2(uint), pos: Vec2(uint), radius: uint): void {
|
||||||
x := 0
|
x := 0
|
||||||
y := radius
|
y := radius
|
||||||
error := @as(int, 3) - @as(int, @intcast(2 * radius))
|
error := @as(int, 3) - @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);
|
memory.copy(Color, indexptr(source, source_pos.x - y, source_pos.y), 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);
|
*indexptr(surface, pos.x, pos.y + y) = *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)
|
*indexptr(surface, pos.x, pos.y - y) = *indexptr(source, source_pos.x, source_pos.y - y)
|
||||||
|
|
||||||
loop if y < x break else {
|
loop if y < x break else {
|
||||||
x += 1
|
x += 1
|
||||||
|
|
||||||
if error > 0 {
|
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)
|
memory.copy(Color, indexptr(source, source_pos.x - x, source_pos.y + y), 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)
|
memory.copy(Color, indexptr(source, source_pos.x - x, source_pos.y - y), indexptr(surface, pos.x - x, pos.y - y), 2 * x)
|
||||||
y -= 1
|
y -= 1
|
||||||
error += 4 * (@as(int, @intcast(x)) - @as(int, @intcast(y))) + 10
|
error += 4 * (@intcast(x) - @intcast(y)) + 10
|
||||||
} else {
|
} else {
|
||||||
error += 4 * @intcast(x) + 6
|
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)
|
memory.copy(Color, indexptr(source, source_pos.x - y, source_pos.y + x), 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)
|
memory.copy(Color, indexptr(source, source_pos.x - y, source_pos.y - x), indexptr(surface, pos.x - y, pos.y - x), 2 * y)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -364,7 +363,7 @@ put_text := fn(surface: Surface, font: Font, pos: Vec2(uint), color: Color, str:
|
||||||
str += 1
|
str += 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
glyph_data = @inline(get_glyph, font, *str)
|
glyph_data = get_glyph(font, *str)
|
||||||
} else {
|
} else {
|
||||||
if *str < UNC_TABLE_SIZE {
|
if *str < UNC_TABLE_SIZE {
|
||||||
glyph_index := *(font.unicode + *str)
|
glyph_index := *(font.unicode + *str)
|
||||||
|
@ -436,7 +435,7 @@ put_text := fn(surface: Surface, font: Font, pos: Vec2(uint), color: Color, str:
|
||||||
cursor.y += next_line_y
|
cursor.y += next_line_y
|
||||||
}
|
}
|
||||||
|
|
||||||
dest := @inline(indexptr, surface, cursor.x, cursor.y)
|
dest := indexptr(surface, cursor.x, cursor.y)
|
||||||
rows := font.height
|
rows := font.height
|
||||||
|
|
||||||
loop if rows == 0 break else {
|
loop if rows == 0 break else {
|
||||||
|
|
|
@ -74,16 +74,16 @@ font_from_psf2 := fn(psf: ^u8, unicode: bool): ?Font {
|
||||||
return font
|
return font
|
||||||
}
|
}
|
||||||
|
|
||||||
get_glyph := fn(font: Font, index: u8): ^u8 {
|
$get_glyph := fn(font: Font, index: u8): ^u8 {
|
||||||
return font.data + @as(uint, index) * font.bytes_per_glyph
|
return font.data + @as(uint, index) * font.bytes_per_glyph
|
||||||
}
|
}
|
||||||
|
|
||||||
UNC_TABLE_SIZE := 1 << 16
|
$UNC_TABLE_SIZE := 1 << 16
|
||||||
|
|
||||||
init_unicode := fn(font: ^Font): void {
|
init_unicode := fn(font: ^Font): void {
|
||||||
font.unicode = memory.alloc(u16, UNC_TABLE_SIZE)
|
font.unicode = memory.alloc(u16, UNC_TABLE_SIZE)
|
||||||
|
|
||||||
@inline(memory.set, u16, &0xFFFF, font.unicode, UNC_TABLE_SIZE)
|
memory.set(u16, &0xFFFF, font.unicode, UNC_TABLE_SIZE)
|
||||||
|
|
||||||
table := font.data + font.num_glyphs * font.bytes_per_glyph
|
table := font.data + font.num_glyphs * font.bytes_per_glyph
|
||||||
curr_glyph := @as(u16, 0)
|
curr_glyph := @as(u16, 0)
|
||||||
|
@ -121,8 +121,6 @@ init_unicode := fn(font: ^Font): void {
|
||||||
next_byte := *table
|
next_byte := *table
|
||||||
if (next_byte & 0xC0) != 0x80 {
|
if (next_byte & 0xC0) != 0x80 {
|
||||||
valid = false
|
valid = false
|
||||||
}
|
|
||||||
if valid == false {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
unicode = unicode << 6 | next_byte & 0x3F
|
unicode = unicode << 6 | next_byte & 0x3F
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
string := @use("string.hb")
|
string := @use("string.hb")
|
||||||
|
|
||||||
recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
|
$recv := fn($Expr: type, buffer_id: uint, memory_map_location: ^Expr): void {
|
||||||
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
|
return @eca(4, buffer_id, memory_map_location, @sizeof(Expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
write := fn($Expr: type, buffer_id: uint, msg: ^Expr): void {
|
$write := fn($Expr: type, buffer_id: uint, msg: ^Expr): void {
|
||||||
return @eca(3, buffer_id, msg, @sizeof(Expr))
|
return @eca(3, buffer_id, msg, @sizeof(Expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
recv_length := fn(length: uint, memory_map_location: ^u8, buffer_id: uint): void {
|
$recv_length := fn(length: uint, memory_map_location: ^u8, buffer_id: uint): void {
|
||||||
return @eca(4, buffer_id, memory_map_location, length)
|
return @eca(4, buffer_id, memory_map_location, length)
|
||||||
}
|
}
|
||||||
|
|
||||||
write_length := fn(length: uint, msg: ^u8, buffer_id: uint): void {
|
$write_length := fn(length: uint, msg: ^u8, buffer_id: uint): void {
|
||||||
return @eca(3, buffer_id, msg, length)
|
return @eca(3, buffer_id, msg, length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ create := fn(msg: ^u8): uint {
|
||||||
return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
|
return @eca(3, 0, BufferMsg.(0, msg, @inline(string.length, msg)), @sizeof(BufferMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
create_without_name := fn(): uint {
|
$create_without_name := fn(): uint {
|
||||||
return @eca(1, 0)
|
return @eca(1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_buffer := fn(buffer_id: uint): void {
|
$delete_buffer := fn(buffer_id: uint): void {
|
||||||
return @eca(2, buffer_id)
|
return @eca(2, buffer_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,14 @@
|
||||||
abs := fn($Expr: type, x: Expr): Expr {
|
$abs := fn($Expr: type, x: Expr): Expr {
|
||||||
mask := x >> @bitcast(@sizeof(Expr) - 1)
|
return (x ^ x >> @sizeof(Expr) - 1) - (x >> @sizeof(Expr) - 1)
|
||||||
return (x ^ mask) - mask
|
|
||||||
}
|
}
|
||||||
min := fn($Expr: type, a: Expr, b: Expr): Expr {
|
$min := fn($Expr: type, a: Expr, b: Expr): Expr {
|
||||||
c := a - b
|
return b + (a - b & a - b >> @sizeof(Expr) - 1)
|
||||||
return b + (c & c >> @bitcast(@sizeof(Expr) - 1))
|
|
||||||
}
|
}
|
||||||
max := fn($Expr: type, a: Expr, b: Expr): Expr {
|
$max := fn($Expr: type, a: Expr, b: Expr): Expr {
|
||||||
c := a - b
|
return a - (a - b & a - b >> @sizeof(Expr) - 1)
|
||||||
return a - (c & c >> @bitcast(@sizeof(Expr) - 1))
|
|
||||||
}
|
}
|
||||||
signum := fn($Expr: type, x: Expr): int {
|
$sign := fn($Expr: type, x: Expr): i8 {
|
||||||
if x > @as(Expr, @intcast(0)) {
|
return @bitcast(x > 0) - @bitcast(x < 0)
|
||||||
return 1
|
|
||||||
} else if x < @as(Expr, @intcast(0)) {
|
|
||||||
return -1
|
|
||||||
} else {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
signincl := fn($Expr: type, x: Expr): int {
|
|
||||||
if x > @as(Expr, @intcast(0)) {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2 := fn($Expr: type): type {
|
Vec2 := fn($Expr: type): type {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
PAGE_SIZE := 4096
|
$PAGE_SIZE := 4096
|
||||||
MAX_ALLOC := 0xFF
|
$MAX_ALLOC := 0xFF
|
||||||
MAX_FREE := 0xFF
|
$MAX_FREE := 0xFF
|
||||||
|
|
||||||
uninit := fn($Expr: type): ?Expr {
|
$uninit := fn($Expr: type): ?Expr {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,16 +10,17 @@ dangling := fn($Expr: type): ^Expr {
|
||||||
return @bitcast(@alignof(Expr))
|
return @bitcast(@alignof(Expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
calc_pages := fn($Expr: type, num: uint): uint {
|
$calc_pages := fn($Expr: type, num: uint): uint {
|
||||||
return 1 + @sizeof(Expr) * num / PAGE_SIZE
|
return 1 + @sizeof(Expr) * num / PAGE_SIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ! will be replaced, don't get attached
|
||||||
alloc := fn($Expr: type, num: uint): ^Expr {
|
alloc := fn($Expr: type, num: uint): ^Expr {
|
||||||
pages := @inline(calc_pages, Expr, num)
|
pages := calc_pages(Expr, num)
|
||||||
if pages <= MAX_ALLOC {
|
if pages <= MAX_ALLOC {
|
||||||
return @bitcast(request_page(@intcast(pages)))
|
return @bitcast(request_page(@intcast(pages)))
|
||||||
}
|
}
|
||||||
ptr := request_page(0xFF)
|
ptr := request_page(MAX_ALLOC)
|
||||||
remaining := pages - MAX_ALLOC
|
remaining := pages - MAX_ALLOC
|
||||||
loop if remaining < MAX_ALLOC break else {
|
loop if remaining < MAX_ALLOC break else {
|
||||||
_ = request_page(@intcast(MAX_ALLOC))
|
_ = request_page(@intcast(MAX_ALLOC))
|
||||||
|
@ -30,46 +31,46 @@ alloc := fn($Expr: type, num: uint): ^Expr {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! stub
|
// ! stub
|
||||||
free := fn($Expr: type, ptr: ^Expr, num: uint, nullify: bool): void {
|
$free := fn($Expr: type, ptr: ^Expr, num: uint, nullify: bool): void {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
RqPageMsg := packed struct {a: u8, count: u8}
|
RqPageMsg := packed struct {a: u8, count: u8}
|
||||||
request_page := fn(count: u8): ^u8 {
|
$request_page := fn(count: u8): ^u8 {
|
||||||
return @eca(3, 2, &RqPageMsg.(0, count), @sizeof(RqPageMsg))
|
return @eca(3, 2, &RqPageMsg.(0, count), @sizeof(RqPageMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
RlPageMsg := packed struct {a: u8, count: u8, ptr: ^u8}
|
RlPageMsg := packed struct {a: u8, count: u8, ptr: ^u8}
|
||||||
release_page := fn(ptr: ^u8, count: u8): void {
|
$release_page := fn(ptr: ^u8, count: u8): void {
|
||||||
return @eca(3, 2, &RlPageMsg.(1, count, ptr), @sizeof(RlPageMsg))
|
return @eca(3, 2, &RlPageMsg.(1, count, ptr), @sizeof(RlPageMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
OutbMsg := packed struct {a: u8, b: u8, addr: u16, value: u8}
|
OutbMsg := packed struct {a: u8, b: u8, addr: u16, value: u8}
|
||||||
outb := fn(addr: u16, value: u8): void {
|
$outb := fn(addr: u16, value: u8): void {
|
||||||
return @eca(3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
|
return @eca(3, 3, &OutbMsg.(1, 0, addr, value), @sizeof(OutbMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
InbMsg := packed struct {a: u8, b: u8, addr: u16}
|
InbMsg := packed struct {a: u8, b: u8, addr: u16}
|
||||||
inb := fn(addr: u16): u8 {
|
$inb := fn(addr: u16): u8 {
|
||||||
return @eca(3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
|
return @eca(3, 3, &InbMsg.(0, 0, addr), @sizeof(InbMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlMsg := packed struct {a: u8, b: u8, addr: u16, value: u32}
|
OutlMsg := packed struct {a: u8, b: u8, addr: u16, value: u32}
|
||||||
outl := fn(addr: u16, value: u32): void {
|
$outl := fn(addr: u16, value: u32): void {
|
||||||
return @eca(3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
|
return @eca(3, 3, &OutlMsg.(1, 2, addr, value), @sizeof(OutlMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
InlMsg := packed struct {a: u8, b: u8, addr: u16}
|
InlMsg := packed struct {a: u8, b: u8, addr: u16}
|
||||||
inl := fn(addr: u16): u32 {
|
$inl := fn(addr: u16): u32 {
|
||||||
return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
|
return @eca(3, 3, &InlMsg.(0, 2, addr), @sizeof(InlMsg))
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMsg := packed struct {a: u8, count: u32, src: ^u8, dest: ^u8}
|
CopyMsg := packed struct {a: u8, count: u32, src: ^u8, dest: ^u8}
|
||||||
copy := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void {
|
$copy := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void {
|
||||||
return @eca(3, 2, &CopyMsg.(4, @intcast(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: u32, size: u32, 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 {
|
$set := fn($Expr: type, src: ^Expr, dest: ^Expr, count: uint): void {
|
||||||
return @eca(3, 2, &SetMsg.(5, @intcast(count), @intcast(@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))
|
||||||
}
|
}
|
|
@ -3,5 +3,5 @@ any := fn($Expr: type): Expr {
|
||||||
}
|
}
|
||||||
|
|
||||||
range := fn($Expr: type, min: Expr, max: Expr): Expr {
|
range := fn($Expr: type, min: Expr, max: Expr): Expr {
|
||||||
return @inline(any, Expr) % (max - min) + @intcast(1) + min
|
return *@eca(3, 4, &@as(Expr, idk), @sizeof(Expr)) % (max - min) + *@bitcast(&1) + min
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ new := fn(props: WindowProps): ?Window {
|
||||||
response2.props.dimensions.x,
|
response2.props.dimensions.x,
|
||||||
response2.props.dimensions.y,
|
response2.props.dimensions.y,
|
||||||
)
|
)
|
||||||
return .(@as(WindowData, response2), surface)
|
return .(response2, surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! client buffers are not being read by the server yet
|
// ! client buffers are not being read by the server yet
|
||||||
|
|
|
@ -9,12 +9,12 @@ message := @use("./message.hb")
|
||||||
|
|
||||||
receive_message := fn($Expr: type, buffer_id: uint): ?Expr {
|
receive_message := fn($Expr: type, buffer_id: uint): ?Expr {
|
||||||
recv := @as(?Expr, null)
|
recv := @as(?Expr, null)
|
||||||
@inline(buffer.recv, ?Expr, buffer_id, &recv)
|
buffer.recv(?Expr, buffer_id, &recv)
|
||||||
return recv
|
return recv
|
||||||
}
|
}
|
||||||
|
|
||||||
send_message := fn($Expr: type, msg: Expr, buffer_id: uint): void {
|
send_message := fn($Expr: type, msg: Expr, buffer_id: uint): void {
|
||||||
@inline(buffer.write, ?Expr, buffer_id, &@as(?Expr, msg))
|
buffer.write(?Expr, buffer_id, &@as(?Expr, msg))
|
||||||
}
|
}
|
||||||
|
|
||||||
await_buffer := fn(name: ^u8): uint {
|
await_buffer := fn(name: ^u8): uint {
|
||||||
|
@ -25,7 +25,7 @@ await_buffer := fn(name: ^u8): uint {
|
||||||
await_message := fn($Expr: type, buffer_id: uint): Expr {
|
await_message := fn($Expr: type, buffer_id: uint): Expr {
|
||||||
response := @as(?Expr, null)
|
response := @as(?Expr, null)
|
||||||
loop {
|
loop {
|
||||||
@inline(buffer.recv, ?Expr, buffer_id, &response)
|
buffer.recv(?Expr, buffer_id, &response)
|
||||||
if response != null {
|
if response != null {
|
||||||
i := 0
|
i := 0
|
||||||
return @as(Expr, response)
|
return @as(Expr, response)
|
||||||
|
|
|
@ -33,7 +33,7 @@ handle_connections := fn(): bool {
|
||||||
resp := await_message(WindowProps, buffer_id)
|
resp := await_message(WindowProps, buffer_id)
|
||||||
log.debug("server: received props\0")
|
log.debug("server: received props\0")
|
||||||
|
|
||||||
data := WindowData.(@as(WindowProps, resp), buffer_id)
|
data := WindowData.(resp, buffer_id)
|
||||||
send_message(WindowData, data, buffer_id)
|
send_message(WindowData, data, buffer_id)
|
||||||
log.debug("server: sent window data\0");
|
log.debug("server: sent window data\0");
|
||||||
*(server.windows + server.window_count) = data
|
*(server.windows + server.window_count) = data
|
||||||
|
|
|
@ -10,11 +10,11 @@ example := fn(): void {
|
||||||
color := render.light_cyan
|
color := render.light_cyan
|
||||||
n := @as(u8, 1)
|
n := @as(u8, 1)
|
||||||
loop {
|
loop {
|
||||||
|
// ! dead code elimination bug
|
||||||
render.clear(screen, color)
|
render.clear(screen, color)
|
||||||
render.sync(screen)
|
render.sync(screen)
|
||||||
if color.b == 255 | color.b == 0 {
|
if color.b == 255 | color.b == 0 {
|
||||||
// compiler bug workaround
|
n = -n
|
||||||
n = 0 - n
|
|
||||||
}
|
}
|
||||||
color.b += n
|
color.b += n
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ example := fn(): void {
|
||||||
|
|
||||||
bottom := buf + msg_len
|
bottom := buf + msg_len
|
||||||
|
|
||||||
@inline(memory.copy, u8, msg, buf, msg_len)
|
memory.copy(u8, msg, buf, msg_len)
|
||||||
cursor := bottom
|
cursor := bottom
|
||||||
|
|
||||||
draw_window(window, font, buf, cursor)
|
draw_window(window, font, buf, cursor)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
.{example: main} := @use("./examples/text.hb")
|
.{example: main} := @use("./examples/colors.hb")
|
|
@ -22,14 +22,14 @@ resolution = "1024x768x24"
|
||||||
|
|
||||||
[boot.limine.ableos.modules]
|
[boot.limine.ableos.modules]
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.render_example]
|
[boot.limine.ableos.modules.render_example]
|
||||||
# path = "boot:///render_example.hbf"
|
path = "boot:///render_example.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.horizon]
|
# [boot.limine.ableos.modules.horizon]
|
||||||
path = "boot:///horizon.hbf"
|
# path = "boot:///horizon.hbf"
|
||||||
|
|
||||||
[boot.limine.ableos.modules.ps2_mouse_driver]
|
# [boot.limine.ableos.modules.ps2_mouse_driver]
|
||||||
path = "boot:///ps2_mouse_driver.hbf"
|
# path = "boot:///ps2_mouse_driver.hbf"
|
||||||
|
|
||||||
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
# [boot.limine.ableos.modules.ps2_keyboard_driver]
|
||||||
# path = "boot:///ps2_keyboard_driver.hbf"
|
# path = "boot:///ps2_keyboard_driver.hbf"
|
||||||
|
|
Loading…
Reference in a new issue