-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshell.s
57 lines (55 loc) · 1.02 KB
/
shell.s
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Daniel DeCovnick
#include stdlib.s
.data
read_buffer: .space 256
prompt_start: .asciiz "Enter program number to run, or 0 or q to exit, or w to wait: "
hello: .asciiz "Welcome to the Jist Shell.\n"
bye_bye: .asciiz "Shell Exiting. Goodbye.\n"
nl: .asciiz "\n"
.text
.globl main
main:
{
la $a0 hello
call print
loop:
call prompt
beq $v0 $zero end
addu $a0 $v0 $zero
call run_program
b loop
end:
la $a0 bye_bye
call print
wait
exit
}
.text
prompt:
{
top:
#See kernel_data.s for more about this next line:
println mpstr
la $a0 prompt_start
call print
la $a0 read_buffer
add $s0 $a0 $zero
call readln
lb $a0 0($s0)
# call print_char
li $t0 119 # the letter w
beq $a0 $t0 hold
li $t0 113 #the letter q
beq $a0 $t0 end
add $a0 $s0 $zero
call atoi
return
hold:
wait
b top
end:
la $a0 bye_bye
call print
wait
exit
}