-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhw2.asm
41 lines (33 loc) · 795 Bytes
/
hw2.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
############################ DO NOT CHANGE THIS FILE! ############################
############################ DO NOT CHANGE THIS FILE! ############################
.data
Newline: .asciiz "\n"
WrongArgMsg: .asciiz "You must provide exactly one argument"
BadToken: .asciiz "Unrecognized Token"
ParseError: .asciiz "Ill Formed Expression"
ApplyOpError: .asciiz "Operator could not be applied"
arg1_addr : .word 0
num_args : .word 0
val_stack : .word 0
op_stack : .word 0
.text
.globl main
main:
sw $a0, num_args
li $t0, 1
bne $a0, $t0, wrong_num_args
lw $t0, 0($a1)
sw $t0, arg1_addr
lw $s1, arg1_addr
move $a0, $s1
jal eval
j end
wrong_num_args:
li $v0, 4
la $a0, WrongArgMsg
syscall
end:
# Terminates the program
li $v0, 10
syscall
.include "hw2-funcs.asm"