Compare commits
No commits in common. "528b1fc66ce71c5627a96b93f319235f5125d6c7" and "0f3c94c0c9898530057183862c565d1daed12ec8" have entirely different histories.
528b1fc66c
...
0f3c94c0c9
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -429,7 +429,7 @@ 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#5555b9865a3ae9d512bc338c1f370aeca9975c60"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#efa7271a5917c9b78ed06563df2bea13f895f8ca"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hbbytecode"
|
name = "hbbytecode"
|
||||||
|
@ -439,7 +439,7 @@ source = "git+https://git.ablecorp.us/ableos/holey-bytes#e494785f93dad2722ebd9e5
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hblang"
|
name = "hblang"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#5555b9865a3ae9d512bc338c1f370aeca9975c60"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#efa7271a5917c9b78ed06563df2bea13f895f8ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
"hbvm 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
]
|
]
|
||||||
|
@ -447,7 +447,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#5555b9865a3ae9d512bc338c1f370aeca9975c60"
|
source = "git+https://git.ablecorp.us/AbleOS/holey-bytes.git#efa7271a5917c9b78ed06563df2bea13f895f8ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
"hbbytecode 0.1.0 (git+https://git.ablecorp.us/AbleOS/holey-bytes.git)",
|
||||||
]
|
]
|
||||||
|
|
|
@ -70,18 +70,15 @@ impl Package {
|
||||||
let mut bytes = Vec::new();
|
let mut bytes = Vec::new();
|
||||||
// compile here
|
// compile here
|
||||||
|
|
||||||
println!("Precompilation");
|
// let _ = hblang::run_compiler(
|
||||||
let _ = hblang::run_compiler(
|
// &path,
|
||||||
&path,
|
// Options {
|
||||||
Options {
|
// fmt: true,
|
||||||
fmt: true,
|
// ..Default::default()
|
||||||
..Default::default()
|
// },
|
||||||
},
|
// &mut bytes,
|
||||||
&mut bytes,
|
// );
|
||||||
);
|
|
||||||
let _ = hblang::run_compiler(&path, Default::default(), &mut bytes);
|
let _ = hblang::run_compiler(&path, Default::default(), &mut bytes);
|
||||||
println!("Post-compilation");
|
|
||||||
|
|
||||||
match std::fs::create_dir("target/programs") {
|
match std::fs::create_dir("target/programs") {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => (),
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
string := @use("rel:string.hb")
|
string := @use("rel:string.hb");
|
||||||
|
|
||||||
receive_message := fn(buffer_id: int, memory_map_location: ^u8, length: int): ^u8 {
|
receive_message := fn(buffer_id: int, memory_map_location: ^u8, length: int): ^u8 {
|
||||||
return @eca(^u8, 4, buffer_id, memory_map_location, length)
|
return @eca(void, 4, buffer_id, memory_map_location, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_message := fn(buffer_id: int): void {
|
send_message := fn(buffer_id: int): void {
|
||||||
message := "Hello there\0"
|
message := "Hello there\0";
|
||||||
message_length := string.length(message)
|
message_length := string.length(message);
|
||||||
@eca(i32, 3, buffer_id, message, message_length)
|
|
||||||
return
|
@eca(i32, 3, buffer_id, message, message_length);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
create := fn(): int {
|
create := fn(): int {
|
||||||
msg := "\{01}Number\0"
|
msg := "\{01}Number\0";
|
||||||
msg_length := string.length(msg);
|
msg_length := string.length(msg);
|
||||||
*msg = 0
|
*msg = 0;
|
||||||
return @eca(int, 1, 0, msg, msg_length)
|
return @eca(int, 1, 0, msg, msg_length);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
string := @use("rel:string.hb")
|
string := @use("rel:string.hb");
|
||||||
log := @use("rel:log.hb")
|
log := @use("rel:log.hb");
|
||||||
memory := @use("rel:memory.hb")
|
memory := @use("rel:memory.hb");
|
||||||
buffer := @use("rel:buffer.hb")
|
buffer := @use("rel:buffer.hb");
|
|
@ -1,14 +1,15 @@
|
||||||
string := @use("rel:string.hb")
|
string := @use("rel:string.hb");
|
||||||
|
|
||||||
log := fn(message: ^u8, level: u8): void {
|
log := fn(message: ^u8, level: u8): void {
|
||||||
message_length := string.length(message);
|
message_length := string.length(message);
|
||||||
*(message + message_length) = level
|
*(message + message_length) = level;
|
||||||
@eca(i32, 3, 1, message, message_length + 1)
|
|
||||||
return
|
@eca(i32, 3, 1, message, message_length + 1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
error := fn(message: ^u8): void return log(message, 0)
|
error:= fn(message: ^u8):void return log(message, 0);
|
||||||
warn := fn(message: ^u8): void return log(message, 1)
|
warn:= fn(message: ^u8):void return log(message, 1);
|
||||||
info := fn(message: ^u8): void return log(message, 2)
|
info:= fn(message: ^u8):void return log(message, 2);
|
||||||
debug := fn(message: ^u8): void return log(message, 3)
|
debug:= fn(message: ^u8):void return log(message, 3);
|
||||||
trace := fn(message: ^u8): void return log(message, 4)
|
trace:= fn(message: ^u8):void return log(message, 4);
|
|
@ -1,18 +1,18 @@
|
||||||
request_page := fn(page_count: u8): ^u8 {
|
request_page := fn(page_count: u8): ^u8 {
|
||||||
msg := "\{00}\{01}xxxxxxxx\0"
|
msg := "\{00}\{01}xxxxxxxx\0";
|
||||||
msg_page_count := msg + 1;
|
msg_page_count := msg + 1;
|
||||||
*msg_page_count = page_count
|
*msg_page_count = page_count;
|
||||||
return @eca(^u8, 3, 2, msg, 12)
|
return @eca(^u8, 3, 2, msg, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
release_page := fn(ptr: ^u8, page_count: u8): void {
|
release_page := fn(ptr: ^u8, page_count: u8): void {
|
||||||
msg := "\{01}\{00}xxxxxxxx\0"
|
msg := "\{01}\{00}xxxxxxxx\0";
|
||||||
|
|
||||||
msg_page_count := msg + 1;
|
msg_page_count := msg + 1;
|
||||||
*msg_page_count = page_count
|
*msg_page_count = page_count;
|
||||||
|
|
||||||
msg_ptr := @as(^^u8, @bitcast(msg + 2));
|
msg_ptr := @as(^^u8, @bitcast(msg+2));
|
||||||
*msg_ptr = ptr
|
*msg_ptr = ptr;
|
||||||
|
|
||||||
return @eca(void, 3, 2, msg, 12)
|
return @eca(void, 3, 2, msg, 12);
|
||||||
}
|
}
|
|
@ -1,51 +1,51 @@
|
||||||
length := fn(ptr: ^u8): int {
|
length := fn(ptr: ^u8): int {
|
||||||
len := 0
|
len := 0;
|
||||||
loop if *ptr == 0 break else {
|
loop if *ptr == 0 break else {
|
||||||
len += 1
|
len += 1;
|
||||||
ptr += 1
|
ptr += 1;
|
||||||
}
|
}
|
||||||
return len
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
display_int := fn(num: int, p: ^u8): ^u8 {
|
display_int := fn(num: int, p: ^u8): ^u8 {
|
||||||
i := 0
|
i := 0;
|
||||||
if num == 0 {
|
if num == 0 {
|
||||||
set(p, 48)
|
set(p, 48);
|
||||||
return p
|
return p;
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
if num == 0 break
|
if num == 0 break;
|
||||||
set(p + i, num % 10 + 48)
|
set(p + i, num % 10 + 48);
|
||||||
num /= 10
|
num /= 10;
|
||||||
i += 1
|
i += 1;
|
||||||
}
|
}
|
||||||
reverse(p)
|
reverse(p);
|
||||||
//null terminate
|
//null terminate
|
||||||
set(p + i, 0)
|
set(p + i, 0);
|
||||||
return p
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse := fn(s: ^u8): void {
|
reverse := fn(s: ^u8): void {
|
||||||
//reverse a string, don't remove digits
|
//reverse a string, don't remove digits
|
||||||
len := 0
|
len := 0;
|
||||||
loop {
|
loop {
|
||||||
if *(s + len) == 0 break
|
if *(s + len) == 0 break;
|
||||||
len += 1
|
len += 1;
|
||||||
}
|
}
|
||||||
i := 0
|
i := 0;
|
||||||
j := len - 1
|
j := len - 1;
|
||||||
loop {
|
loop {
|
||||||
if i >= j break
|
if i >= j break;
|
||||||
temp := *(s + i);
|
temp := *(s + i);
|
||||||
*(s + i) = *(s + j);
|
*(s + i) = *(s + j);
|
||||||
*(s + j) = temp
|
*(s + j) = temp;
|
||||||
i += 1
|
i += 1;
|
||||||
j -= 1
|
j -= 1;
|
||||||
}
|
}
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
set := fn(change: ^u8, new: int): void {
|
set := fn(change: ^int, new: int): void {
|
||||||
*change = new
|
*(change) = new;
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Framebuffer Driver
|
|
||||||
A simple framebuffer driver.
|
|
|
@ -1,15 +1,15 @@
|
||||||
frame_buffer := @as(^u8, @bitcast(18446603339442421760))
|
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
color := 17
|
frame_buffer := @as(^u8, @bitcast(18446603339442421760));
|
||||||
|
color := 17;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
len := 786432 * 4 + 1
|
len := (786432 * 4)+1;
|
||||||
loop if len == 0 break else {
|
loop if len == 0 break else {
|
||||||
fb := frame_buffer + len;
|
fb := frame_buffer + len;
|
||||||
*fb = color
|
*fb = color;
|
||||||
len -= 1
|
len = len - 1;
|
||||||
color += len
|
color += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb")
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
log := stn.log
|
log := stn.log;
|
||||||
string := stn.string
|
string := stn.string;
|
||||||
memory := stn.memory
|
memory := stn.memory;
|
||||||
buffer := stn.buffer
|
buffer := stn.buffer;
|
||||||
|
|
||||||
/*
|
|
||||||
service_search := fn(): void {
|
|
||||||
// a :=
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
main := fn(): int {
|
main := fn(): int {
|
||||||
// Create a buffer
|
// Create a buffer
|
||||||
num := 2
|
buffer_id := buffer.create();
|
||||||
buffer_id := buffer.create()
|
buffer.send_message(buffer_id);
|
||||||
buffer.send_message(buffer_id)
|
|
||||||
memory_pages := memory.request_page(3)
|
memory_pages := memory.request_page(3);
|
||||||
buffer.receive_message(buffer_id, memory_pages, 4096 * 3)
|
buffer.receive_message(buffer_id, memory_pages, 4096*3);
|
||||||
log.info("abc\0")
|
|
||||||
memory.release_page(memory_pages, 3)
|
log.info("abc\0");
|
||||||
|
|
||||||
|
memory.release_page(memory_pages, 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// todo: abstract this out
|
// todo: abstract this out
|
||||||
port_str := "\0\{70}\0"
|
port_str := "\0\{70}\0";
|
||||||
a := @eca(u8, 3, 3, port_str, 2)
|
a := @eca(u8, 3, 3, port_str, 2);
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
|
@ -1,21 +1,21 @@
|
||||||
stn := @use("../../../libraries/stn/src/lib.hb")
|
stn := @use("../../../libraries/stn/src/lib.hb");
|
||||||
log := stn.log
|
log := stn.log;
|
||||||
mem := stn.memory
|
mem := stn.memory;
|
||||||
s := stn.string
|
s := stn.string;
|
||||||
page := 0
|
page := 0
|
||||||
|
|
||||||
main := fn(): void {
|
main := fn(): void {
|
||||||
page += mem.request_page(1)
|
page += mem.request_page(1);
|
||||||
port_str := "\0\{47}\0"
|
port_str := "\0\{47}\0";
|
||||||
a := @eca(u8, 3, 3, port_str, 2)
|
a := @eca(u8, 3, 3, port_str, 2);
|
||||||
|
|
||||||
n := 5000000
|
n := 5000000;
|
||||||
loop {
|
loop {
|
||||||
if n == 0 break
|
if n == 0 break;
|
||||||
n -= 1
|
n -= 1;
|
||||||
stack_reclamation_edge_case := 0
|
stack_reclamation_edge_case := 0;
|
||||||
}
|
}
|
||||||
td := s.display_int(a, page)
|
td := s.display_int(a, page);
|
||||||
log.debug(td)
|
log.debug(td);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue