STDLib work

This commit is contained in:
able 2023-09-07 14:18:47 -05:00
parent cd4d419c96
commit 13437e49bc
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,20 @@
var (error,warn,info,debug,trace) = io.log.(error,warn,info,debug,trace);
// TODO: define and add in IDL shenanigans for a proper IPC Protocol
func make_ipc_buffer(bounded: bool, length: u64) {
match bounded{
true -> match length {
0 -> error("Bound array has length of zero")
}
}
asm {
li r254, bounded
li r253, length
}
// Return a pointer to a memory address with `length`
return (123, 456);
}

View file

@ -1,4 +1,6 @@
var io = include "io"; var io = include "io";
var math = include "math"; var math = include "math";
var ecalls = include "ecalls";
var print = io.print; var print = io.print;

View file

@ -0,0 +1,20 @@
var ecalls = include "ecalls";
var make_ipc_buffer = ecalls.make_ipc_buffer;
var terminal;
terminal.init = terminal_init;
terminal.write = terminal_write;
func terminal_init(){
// setup a buffer with the TextIO protocol
var buffer = make_ipc_buffer(false, 0);
terminal.buffer = buffer;
}
func terminal_write(value: String){
// TODO: write value into buffer according to TextIO protocol
}