-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.asm
More file actions
212 lines (195 loc) · 2.53 KB
/
test.asm
File metadata and controls
212 lines (195 loc) · 2.53 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
BITS 16
ORG 0x7C00
CALL Refresh_screen
CALL Draw_rect
CALL Delay
CALL Refresh_screen1
MOV SI, INTRO
CALL Print
MOV SI, BUNA_SEARA
CALL Print
CALL Read
PrintChar:
CALL Delay_char
MOV BL, 0xA
MOV BH, 0
MOV AH, 0x0E
INT 0x10
RET
PrintCharShell:
MOV BL, 0xA
MOV BH, 0
MOV AH, 0x0E
INT 0x10
RET
Print:
PUSHA
next_character:
MOV AL, [SI]
INC SI
OR AL, AL
JZ exit_print
CALL PrintChar
JMP next_character
exit_print:
POPA
RET
Read:
MOV AH,0x0
INT 0x16
CMP AL, 0x52
JE read_exit
CMP AL, 0x49
JE read_exit_shell
JMP Read
read_exit:
MOV BL, 0xC
MOV BH, 0
MOV AH,0xE
INT 0x10
MOV SI, SEARA_BUNA
CALL Print
CALL Delay
JMP Reboot
RET
read_exit_shell:
MOV BL, 0xB
MOV BH, 0
MOV AH,0xE
INT 0x10
MOV SI, EMPTY_LINE
CALL Print
MOV SI, SHELL_PROMPT
CALL Print
CALL ReadShell
RET
ReadShell:
MOV AH,0x0
INT 0x16
CALL PrintCharShell
CMP AL, 0xD
JE NewLineShell
JMP ReadShell
NewLineShell:
MOV SI, SHELL_PROMPT
CALL Print
JMP ReadShell
Reboot:
INT 19h
Delay:
PUSHA
MOV BX, 10h
MOV AH, 0
INT 0x1A
ADD BX, DX
tloop:
MOV AH, 0
INT 0x1A
CMP DX, BX
JG tloop2
JMP tloop
tloop2:
POPA
RET
Delay_char:
PUSHA
MOV BX, 0
MOV AH, 0
INT 0x1A
ADD BX, DX
tloop3:
MOV AH, 0
INT 0x1A
CMP DX, BX
JG tloop4
JMP tloop3
tloop4:
POPA
RET
Draw_rect:
PUSHA
MOV AH, 0xC
MOV BL, 0x32
MOV CX, 0x140
MOV DX, 0x12C
MOV AL, 0xE
Draw1:
CALL Delay_char
INT 0x10
DEC BL
DEC CX
DEC DX
CMP BL,0
JE Restore_var1
JMP Draw1
Restore_var1:
MOV BL, 0x32
MOV CX, 0x140
MOV DX, 0x12C
JMP Draw2
Draw2:
CALL Delay_char
INT 0x10
DEC BL
INC CX
DEC DX
CMP BL, 0
JE Restore_var2
JMP Draw2
Restore_var2:
MOV BL, 0x32
MOV CX, 0x10E
MOV DX, 0xFA
JMP Draw3
Draw3:
CALL Delay_char
INT 0x10
DEC BL
INC CX
DEC DX
CMP BL, 0
JE Restore_var3
JMP Draw3
Restore_var3:
MOV BL, 0x32
MOV CX, 0x172
MOV DX, 0xFA
JMP Draw4
Draw4:
CALL Delay_char
INT 0x10
DEC BL
DEC CX
DEC DX
CMP BL, 0
JE Exit_draw
JMP Draw4
Exit_draw:
POPA
RET
Refresh_screen:
PUSHA
MOV AH, 0
MOV AL, 0x12
INT 0x10
POPA
RET
Refresh_screen1:
PUSHA
MOV AH, 0
MOV AL, 0x12
INT 0x10
POPA
RET
INTRO:
db 0x40,"BLidOS 2014",0dh,0ah,0dh,0ah,0
BUNA_SEARA:
db "Hello, World!",0dh,0ah,0dh,0ah,"(R) Reboot",0dh,0ah,"(I) Interactive shell",0dh,0ah,"Please choose an option: ",0
SEARA_BUNA:
db 0dh,0ah,0dh,0ah,'Goodbye, World!',0
SHELL_PROMPT:
db 0dh,0ah,'#> ',0
EMPTY_LINE:
db 0dh,0ah,0
times 510 -( $ - $$ ) db 0
dw 0xaa55