diff --git a/baselib.ml b/baselib.ml index 63a650e..f4e9958 100644 --- a/baselib.ml +++ b/baselib.ml @@ -9,6 +9,7 @@ let _types_ = ; "%sub", Func_t (Int_t, [ Int_t; Int_t ]) ; "%mul", Func_t (Int_t, [ Int_t; Int_t ]) ; "%div", Func_t (Int_t, [ Int_t; Int_t ]) + ; "puti", Func_t (Int_t, [ Int_t ]) ]) ;; @@ -20,5 +21,6 @@ let builtins = ; "%sub", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Sub (V0, T0, T1) ] ; "%mul", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Mul (V0, T0, T1) ] ; "%div", [ Lw (T0, Mem (SP, 4)); Lw (T1, Mem (SP, 0)); Div (V0, T0, T1) ] + ; "puti", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.print_int); Syscall ] ] ;; diff --git a/tests/19_print.test b/tests/19_print.test new file mode 100644 index 0000000..ea1e6d7 --- /dev/null +++ b/tests/19_print.test @@ -0,0 +1,3 @@ +void main () { + puti(1312); +}