STDLib work
This commit is contained in:
parent
cd4d419c96
commit
13437e49bc
20
assets/libraries/std/ecalls.rhea
Normal file
20
assets/libraries/std/ecalls.rhea
Normal 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);
|
||||||
|
}
|
|
@ -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;
|
20
assets/libraries/std/terminal.rhea
Normal file
20
assets/libraries/std/terminal.rhea
Normal 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue