-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtendedProgram.asm
More file actions
244 lines (194 loc) · 4.61 KB
/
ExtendedProgram.asm
File metadata and controls
244 lines (194 loc) · 4.61 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
[bits 16]
[org 0x7e00]
jmp ExtendedStart
%include "Functions.asm"
%include "plong.asm"
%include "adventure.asm"
StartupString: db "Type help for commands", 0
CommandEnterString: db "$ ", 0
InputCommand: db 16, "", 0
MemoryText db " kb", 0
EnterDiskText db "Please enter disk number: ", 0
WriteDiskText db "Please enter what you want to save to disk:", 0
CommandsListString db "help, clear, ram, disk, plong, adventure, writedisk, readdisk", 0
HelpCommand: db "help", 0
ClearCommand: db "clear", 0
MemoryCommand: db "ram", 0
DiskCommand: db "disk", 0
PlongCommand: db "plong", 0
AdventureCommand: db "adventure", 0
WriteDiskCommand: db "writedisk", 0
ReadDiskCommand: db "readdisk", 0
tempString:
db "Yo yo from extended program loaded in to memory", 0
BOOT_DISK: db 0
; -----------------------------------------------------------------------------------------
ExtendedStart:
mov [BOOT_DISK], dl
mov bx, tempString
call PrintString
call ClearScreen ; Calls ClearScreen from Functions
mov dh, 00h
mov dl, 00h ; all the way to the left
call setLine
mov bx, StartupString
call PrintString
mov dh, 01h
mov dl, 00h ; all the way to the left
call setLine
jmp CommandLoop
clearCommandExe:
call ClearScreen
mov dh, 0
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
memoryCommandExe:
int 0x12
call ax_to_string
mov bx, mem_buf
call PrintString
mov bx, MemoryText
call PrintString
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
helpCommandExe:
mov bx, CommandsListString
call PrintString
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
diskCommandExe:
mov bx, EnterDiskText
mov dx, 0x1a ; 26 in decimal
call PrintString
call GetKeyboardInput
mov dl, [bx]
sub dl, '0'
call GetDiskInfo
push bx
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
pop bx
call PrintString
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
plongCommandExe:
call Plong
jmp AfterCommandDef
adventureCommandExe:
call Adventure
jmp AfterCommandDef
WriteDiskCommandExe:
mov bx, WriteDiskText
call PrintString
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
call GetKeyboardInput
mov ah, 03h
mov al, 1
mov ch, 0
mov cl, 10
mov dh, 0
mov dl, 0
int 0x13
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
ReadDiskCommandExe:
mov ah, 02h
mov al, 1
mov ch, 0
mov cl, 10
mov dh, 0
mov dl, 0
int 0x13
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
call PrintString
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
mov dl, 00h
call setLine
jmp AfterCommandDef
AfterCommandDef:
CommandLoop:
mov bx, CommandEnterString
call PrintString
mov dx, 02h
call GetKeyboardInput
mov dx, 00h
mov [InputCommand], bx
mov dh, [CurrentRow]
inc dh
mov [CurrentRow], dh
call setLine
mov si, bx
mov di, ClearCommand
call CompareStrings
cmp dx, 1
je clearCommandExe
mov si, bx
mov di, MemoryCommand
call CompareStrings
cmp dx, 1
je memoryCommandExe
mov si, bx
mov di, HelpCommand
call CompareStrings
cmp dx, 1
je helpCommandExe
mov si, bx
mov di, DiskCommand
call CompareStrings
cmp dx, 1
je diskCommandExe
mov si, bx
mov di, PlongCommand
call CompareStrings
cmp dx, 1
je plongCommandExe
mov si, bx
mov di, AdventureCommand
call CompareStrings
cmp dx, 1
je adventureCommandExe
mov si, bx
mov di, WriteDiskCommand
call CompareStrings
cmp dx, 1
je WriteDiskCommandExe
mov si, bx
mov di, ReadDiskCommand
call CompareStrings
cmp dx, 1
je ReadDiskCommandExe
jmp CommandLoop
exit69:
jmp $
times 1536-($-$$) db 0