Implement simple binary expressions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
.global _is_alpha, _is_digit, _is_alnum, _is_upper, _is_lower, _write_out, _read_file, exit, _memcmp, _write_error
|
||||
.global _is_alpha, _is_digit, _is_alnum, _is_upper, _is_lower
|
||||
.global _write_out, _read_file, exit, _memcmp, _write_error, _put_char
|
||||
|
||||
.section .rodata
|
||||
|
||||
@@ -200,6 +201,29 @@ _read_file:
|
||||
ret
|
||||
|
||||
# Terminates the program. a0 contains the return code.
|
||||
.type _exit, @function
|
||||
exit:
|
||||
li a7, SYS_EXIT
|
||||
ecall
|
||||
|
||||
# Writes a character from a0 into the standard output.
|
||||
.type _put_char, @function
|
||||
_put_char:
|
||||
# Prologue
|
||||
addi sp, sp, -16
|
||||
sw ra, 12(sp)
|
||||
sw s0, 8(sp)
|
||||
addi s0, sp, 16
|
||||
|
||||
sb a0, 4(sp)
|
||||
li a0, STDOUT
|
||||
addi a1, sp, 4
|
||||
li a2, 1
|
||||
li a7, SYS_WRITE
|
||||
ecall
|
||||
|
||||
# Epilogue.
|
||||
lw ra, 12(sp)
|
||||
lw s0, 8(sp)
|
||||
add sp, sp, 16
|
||||
ret
|
||||
|
Reference in New Issue
Block a user