add puts and geti
This commit is contained in:
parent
69e4987d1a
commit
f9ef6bc20c
1 changed files with 5 additions and 1 deletions
|
@ -9,7 +9,9 @@ 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 ])
|
||||
; "puti", Func_t (Void_t, [ Int_t ])
|
||||
; "puts", Func_t (Void_t, [ Str_t ])
|
||||
; "geti", Func_t (Int_t, [])
|
||||
])
|
||||
;;
|
||||
|
||||
|
@ -22,5 +24,7 @@ let builtins =
|
|||
; "%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 ]
|
||||
; "puts", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.print_str); Syscall ]
|
||||
; "geti", [ Lw (A0, Mem (SP, 0)); Li (V0, Syscall.read_int); Syscall ]
|
||||
]
|
||||
;;
|
||||
|
|
Reference in a new issue