-
Notifications
You must be signed in to change notification settings - Fork 4
/
PROJFMM.asm
350 lines (342 loc) · 5.93 KB
/
PROJFMM.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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
proc mainMenu;prints all of the main menu screen in the according locations and colours
push ax
push bx
push cx
push dx
push bp
push es
mov ah,2Ch;get system time
int 21h;dl is in 1/100 seconds
cmp dl,20;this area checks in which part of the second the time is and changes the colour of the text that is printed in the main menu accordingly
jbe PrintC
cmp dl,40
jbe IncreaseColorBy1
cmp dl,60
jbe IncreaseColorBy2
cmp dl,80
jbe IncreaseColorBy3
IncreaseColorBy4:
mov [ColorValueIncrease],4;ColorValueIncrease will increase the colour value of the text in the main menu so the text will change colour
jmp PrintC
IncreaseColorBy3:
mov [ColorValueIncrease],3
jmp PrintC
IncreaseColorBy2:
mov [ColorValueIncrease],2
jmp PrintC
IncreaseColorBy1:
mov [ColorValueIncrease],1
printC:;this area prints all the letters in "Crennui's Legends" on the screen
push offset PixelatedC
push 16
push 22
push [PixelatedC_Y]
push [PixelatedC_X]
call Print_Anything2
PrintR:
push offset PixelatedR
push 16
push 22
push [PixelatedR_Y]
push [PixelatedR_X]
call Print_Anything2
PrintE1:
push offset PixelatedE
push 16
push 22
push [PixelatedE_Y]
push [PixelatedE_X]
call Print_Anything2
PrintN1:
push offset PixelatedN
push 18
push 22
push [PixelatedN_Y]
push [PixelatedN_X]
call Print_Anything2
PrintN2:
push offset PixelatedN
push 18
push 22
push [PixelatedN2_Y]
push [PixelatedN2_X]
call Print_Anything2
PrintU:
push offset PixelatedU
push 16
push 22
push [PixelatedU_Y]
push [PixelatedU_X]
call Print_Anything2
PrintI:
push offset PixelatedI
push 8
push 22
push [PixelatedI_Y]
push [PixelatedI_X]
call Print_Anything2
PrintApostrophe:
push offset PixelatedApostrophe
push 8
push 10
push [PixelatedApostrophe_Y]
push [PixelatedApostrophe_X]
call Print_Anything2
PrintS:
push offset PixelatedS
push 16
push 22
push [PixelatedS_Y]
push [PixelatedS_X]
call Print_Anything2
PrintL:
push offset PixelatedL
push 14
push 22
push [PixelatedL_Y]
push [PixelatedL_X]
call Print_Anything2
PrintE2:
push offset PixelatedE
push 16
push 22
push [PixelatedE2_Y]
push [PixelatedE2_X]
call Print_Anything2
PrintG:
push offset PixelatedG
push 16
push 22
push [PixelatedG_Y]
push [PixelatedG_X]
call Print_Anything2
PrintE3:
push offset PixelatedE
push 16
push 22
push [PixelatedE3_Y]
push [PixelatedE3_X]
call Print_Anything2
PrintN3:
push offset PixelatedN
push 18
push 22
push [PixelatedN3_Y]
push [PixelatedN3_X]
call Print_Anything2
PrintD:
push offset PixelatedD
push 16
push 22
push [PixelatedD_Y]
push [PixelatedD_X]
call Print_Anything2
PrintMessages:;this part prints the 3 messages on the main menu screen
push ax
push bx
push cx
push dx
push es
push ds
push bp
mov ah,13h
mov bh,0;page number
mov bl,11110011b;attribute
mov cx,15;amount of characters
mov dl,13;starting columns and rows
mov dh,13
mov al,0
push ds
pop es
mov bp,offset MMMessage1;the message gets printed at es:bp
int 10h
pop bp
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
push ax
push bx
push cx
push dx
push es
push ds
push bp
mov ah,13h
mov bh,0
mov bl,11110011b
mov cx,17
mov dl,13
mov dh,15
mov al,0
push ds
pop es
mov bp,offset MMMessage2;same as before but for the second message
int 10h
pop bp
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
push ax
push bx
push cx
push dx
push es
push ds
push bp
mov ah,13h
mov bh,0
mov bl,11110011b
mov cx,14
mov dl,13
mov dh,17
mov al,0
push ds
pop es
mov bp,offset MMMessage3;same as before but for the third message
int 10h
pop bp
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
checkUserInputInMM:;checks to see where the user wants to go to: the game itself,the instructions and lore or to exit the game
mov ah,0Bh;checks to see if a key is pressed
int 21h
cmp al,0
je noStart
mov ah,07h
int 21h
cmp al,31h
jne noStart
mov [StartGameBool],1
jmp endUserInputInMMCheck
noStart:
cmp al,32h
jne noInstructions
mov [StartInstructionsBool],1
jmp endUserInputInMMCheck
noInstructions:
cmp al,33h
jne endUserInputInMMCheck
mov [EndGameBool],1
endUserInputInMMCheck:
pop es
pop bp
pop dx
pop cx
pop bx
pop ax
ret
endp mainMenu
proc Print_Anything2;According to the parameters given it prints any character. This is like Print_Anything but is used for the main menu's letters' colour change system
pop [PAReturnAddress]
pop [x];pops the pushed parameters
pop [y]
pop [RowLoop]
pop [ColumnLoop]
pop [offsetStart]
push ax
push bx
push cx
push dx
mov bx,[offsetStart];moves the offset where the color array values start at
mov cx,[RowLoop];big loop
Print3:
push cx
mov cx,[ColumnLoop];small loop
Print4:
push cx
mov cx,[x];x
mov dx,[y];y
mov al,[byte ptr bx];color
cmp al,0
je skipAdd
add ax,[ColorValueIncrease];adds the colour to change the previous colour,heres the difference between the 2 methods
skipAdd:
mov ah,0Ch
int 10h
pop cx
inc [x]
inc bx
loop Print4;small loop loop.
inc [y];increases the y by 1 to start at a new row in the big loop
push ax
mov ax,[ColumnLoop]
sub [x],ax;returns x back to the starting value to start printing the new row
pop ax
pop cx
loop Print3;big loop loop
pop dx
pop cx
pop bx
pop ax
push [PAReturnAddress]
ret
endp Print_Anything2
proc Print_Instructions;simply print the story of the game
push ax
push dx
mov ax,03
int 10h
mov dx,offset Lore1
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore2
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore3
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore4
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore5
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore6
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore7
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov dx,offset Lore8
mov ah,09h
int 21h
mov dl,0Ah
mov ah,2h
int 21h
mov ah,01h
int 21h
pop dx
pop ax
ret
endp Print_Instructions