-
Notifications
You must be signed in to change notification settings - Fork 0
/
sh.asm
93 lines (75 loc) · 1.05 KB
/
sh.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%include "defs.asm"
[org 0x8a00]
mov ah, setmainprog
mov bx, shstr
call kloc
mov ah, zerobuffer
mov bx, buff
mov ch, 75
call kloc
loop:
mov ah, 0x0e
mov al, 0xA
int 10h
mov al, 0xD
int 10h
mov ah, printf
mov bx, prompt
call kloc
mov ah, readstr
mov bx, buff
mov cx, 75
call kloc
mov ah, strcmp
mov bx, buff
mov ch, 75
mov si, clearstr
call kloc
cmp ah, 0
je clear
mov ah, strcmp
mov bx, buff
mov ch, 75
mov si, lsstr
call kloc
cmp ah, 0
je ls
mov bx, buff
mov ah, BYTE [bx]
cmp ah, 0
je end
mov ah, loadprog
mov si, buff
jmp kloc
end:
mov ah, zerobuffer
mov bx, buff
mov ch, 75
call kloc
mov ah, 0x0e
mov al, 0xA
int 10h
mov al, 0xD
int 10h
jmp loop
jmp $
clear:
mov ah, clearscreen
call kloc
jmp clearbuff
ls:
mov ah, listfs
call kloc
jmp clearbuff
clearbuff:
mov ah, zerobuffer
mov bx, buff
mov ch, 75
call kloc
jmp loop
prompt: db "$ ", 0
clearstr: db "clear", 0
lsstr: db "ls", 0
shstr: db "sh", 0, 0
buff: times 75 db 0
times 512-($-$$) db 0