-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.masm
55 lines (43 loc) · 996 Bytes
/
main.masm
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
#include "strings"
#include "commands"
lbl main
call #strings
lbl shell_loop
; Display prompt
out 1 $100
; Read command from user
in $1000
; Check if command is "exit"
MNI StringOperations.cmp $120 $1000
je #exit_shell
; Check which command was entered
lbl check_command
MNI StringOperations.cmp $110 $1000
je #execute_ls
lbl check_echo
MNI StringOperations.cmp $130 $1000
je #execute_echo
lbl check_clear
MNI StringOperations.cmp $140 $1000
je #execute_clear
lbl check_help
MNI StringOperations.cmp $150 $1000
je #execute_help
lbl command_not_found
out 1 $3456
jmp #shell_loop
lbl execute_help
call #help
jmp #shell_loop
lbl execute_clear
call #clear
jmp #shell_loop
lbl execute_ls
call #ls
jmp #shell_loop
lbl execute_echo
call #echo
jmp #shell_loop
lbl exit_shell
out 1 $3000 ; Use the correct address for "Exiting shell..."
hlt