fix silly missing `get_reg` error. all non gui ones are working now

This commit is contained in:
zongor 2025-12-03 21:45:03 -08:00
parent 9218051b87
commit 07528b1f3f
5 changed files with 431 additions and 671 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,13 +2,12 @@ global str terminal_namespace = "/dev/term/0";
global str new_line = "\n"; global str new_line = "\n";
function main () function main ()
int n $0;
int str_n $1; int str_n $1;
load_immediate 35 -> n; load_immediate 36 -> $0;
call fib n -> n; call fib $0 -> $0;
int_to_string n -> str_n; int_to_string $0 -> str_n;
call pln str_n -> void; call pln str_n;
exit 0; exit 0;
function fib (int n $0) function fib (int n $0)

View File

@ -1,12 +1,12 @@
global str terminal_namespace = "/dev/term/0"; global str terminal_namespace = "/dev/term/0";
global str new_line = "\n"; global str new_line = "\n";
global str message = "nuqneH 'u'?"; global str hello = "nuqneH 'u'?";
function main () function main ()
str hello $0; str msg $0;
load_address message -> hello; load_address hello -> msg;
call pln hello; call pln msg;
exit 0; exit 0;
function pln (str message $0) function pln (str message $0)

View File

@ -5,8 +5,8 @@ global str new_line = "\n";
function main () function main ()
real a $0; real a $0;
int i $1; int i $1;
int mode $11; int in_mode $11;
str term $10; str in_term $10;
load_immediate 5.0 -> a; load_immediate 5.0 -> a;
load_immediate 5000 -> i; load_immediate 5000 -> i;
@ -18,20 +18,20 @@ function main ()
add_int i $3 -> i; add_int i $3 -> i;
jump_ge_int loop_body i $2; jump_ge_int loop_body i $2;
load_address terminal_namespace -> term; load_address terminal_namespace -> in_term;
load_immediate 0 -> mode; load_immediate 0 -> in_mode;
syscall OPEN term mode -> term; // Terminal term = open("/dev/term/0", 0); syscall OPEN in_term in_mode -> in_term; // Terminal term = open("/dev/term/0", 0);
nat b $1; nat b $1;
real_to_nat a -> b; real_to_nat a -> b;
load_address prompt -> $7; load_address prompt -> $7;
string_length $7 -> $8; string_length $7 -> $8;
syscall WRITE term $7 $8; // print prompt syscall WRITE in_term $7 $8; // print prompt
str user_string $9; str user_string $9;
load_immediate 32 -> $8; load_immediate 32 -> $8;
malloc $8 -> user_string; malloc $8 -> user_string;
syscall READ term user_string $8; // read in max 32 byte string syscall READ in_term user_string $8; // read in max 32 byte string
call pln user_string; call pln user_string;
nat_to_string b -> $4; nat_to_string b -> $4;

View File

@ -3,23 +3,23 @@ global str prompt = "Enter a string:";
global str new_line = "\n"; global str new_line = "\n";
function main () function main ()
int mode $11; int in_mode $11;
str term $10; str in_term $10;
load_immediate terminal_namespace -> term; load_address terminal_namespace -> in_term;
load_immediate 0 -> mode; load_immediate 0 -> in_mode;
syscall OPEN term mode -> term; // Terminal term = open("/dev/term/0", 0); syscall OPEN in_term in_mode -> in_term; // Terminal term = open("/dev/term/0", 0);
load_immediate prompt -> $7; load_address prompt -> $7;
string_length $7 -> $8; string_length $7 -> $8;
syscall WRITE term $7 $8; // print prompt syscall WRITE in_term $7 $8; // print prompt
str user_string $9; str user_string $9;
load_immediate 32 -> $8; load_immediate 32 -> $8;
malloc $8 -> user_string; malloc $8 -> user_string;
syscall READ term user_string $8; // read in max 32 byte string syscall READ in_term user_string $8; // read in max 32 byte string
call pln user_string -> void; call pln user_string;
exit 0; exit 0;
function pln (str message $0) function pln (str message $0)