Rev 10 | Rev 14 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 11 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | 1 | ||
2 | ; Aysalia DOS Launcher |
2 | ; Aysalia DOS Launcher |
3 | ; Launches aydos1.gam and aydos2.gam |
3 | ; Launches aydos1.gam and aydos2.gam |
4 | ; Revision 2018-12-01 |
4 | ; Revision 2018-12-03 |
5 | ; (C) 2018 Daniel Marschall, ViaThinkSoft |
5 | ; (C) 2018 Daniel Marschall, ViaThinkSoft |
6 | 6 | ||
7 | .model small |
7 | .model small |
8 | .stack 10h |
8 | .stack 10h |
- | 9 | ||
- | 10 | ; ------------------------------------------------------- |
|
- | 11 | ||
9 | .data |
12 | .data |
10 | 13 | ||
11 | exename1 db "AYDOS1.GAM",0 |
14 | exename1 db "AYDOS1.GAM",0 |
12 | exename2 db "AYDOS2.GAM",0 |
15 | exename2 db "AYDOS2.GAM",0 |
13 | cmdargs db 0,'',0dh |
16 | cmdargs db 0,'',0dh |
Line 43... | Line 46... | ||
43 | 46 | ||
44 | gameover1 db '',13,10,'$' |
47 | gameover1 db '',13,10,'$' |
45 | gameover2 db 'Spiel zu Ende!',13,10,'$' |
48 | gameover2 db 'Spiel zu Ende!',13,10,'$' |
46 | gameover3 db '',13,10,'$' |
49 | gameover3 db '',13,10,'$' |
47 | 50 | ||
- | 51 | ; ------------------------------------------------------- |
|
- | 52 | ||
48 | .code |
53 | .code |
49 | 54 | ||
50 | clear_vga PROC |
55 | clear_vga PROC |
51 | mov ax, 0a000h |
56 | mov ax, 0a000h |
52 | mov es, ax |
57 | mov es, ax |
Line 55... | Line 60... | ||
55 | mov cx, 64000 |
60 | mov cx, 64000 |
56 | rep stosb |
61 | rep stosb |
57 | ret |
62 | ret |
58 | clear_vga ENDP |
63 | clear_vga ENDP |
59 | 64 | ||
- | 65 | set_screen12 PROC |
|
- | 66 | mov ah, 0 ; set screen mode |
|
- | 67 | mov al, 12h ; graphic mode, 640x480 pixel, 16 colors (VGA) |
|
- | 68 | int 10h |
|
- | 69 | ret |
|
- | 70 | set_screen12 ENDP |
|
- | 71 | ||
60 | setup_paramblk PROC |
72 | setup_paramblk PROC |
61 | mov ax, cs |
73 | mov ax, cs |
62 | mov [paramblk + 4], ax ; cmdargs_seg |
74 | mov [paramblk + 4], ax ; cmdargs_seg |
63 | mov [paramblk + 8], ax ; fcb1_seg |
75 | mov [paramblk + 8], ax ; fcb1_seg |
64 | mov [paramblk + 12], ax ; fcb2_seg |
76 | mov [paramblk + 12], ax ; fcb2_seg |
65 | ret |
77 | ret |
66 | setup_paramblk ENDP |
78 | setup_paramblk ENDP |
67 | 79 | ||
- | 80 | set_numlock_on PROC |
|
68 | start: |
81 | push ds |
- | 82 | mov ax, 40h |
|
69 | mov ax, @data ; moving base address of data to ax |
83 | mov ds, ax ; go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html ) |
70 | mov ds, ax ; moving contents of ax into ds |
84 | mov bx, 17h ; Load Keyboard flag byte 0 |
- | 85 | mov al, [bx] ; read |
|
71 | ; data section now gets initialized |
86 | or al, 20h ; set bit 5 (numlock) to 1 |
- | 87 | mov [bx], al ; write |
|
- | 88 | pop ds |
|
- | 89 | ret |
|
- | 90 | set_numlock_on ENDP |
|
72 | 91 | ||
73 | ; Reduce size of own application to give the called applications more space |
- | |
74 | mov ah, 4ah |
92 | flush_keyb_buf PROC |
75 | mov al, 00h |
- | |
76 | mov bx, 100 ; 100 paragraphs a 16 byte = 1600 byte |
93 | mov ah, 0Ch ; Flush input buffer and input |
77 | ; EXE size is 1140 byte |
94 | mov al, 0 |
78 | int 21h |
95 | int 21h |
- | 96 | ret |
|
- | 97 | flush_keyb_buf ENDP |
|
79 | 98 | ||
80 | menu: |
- | |
81 | ; Video Mode VGA 12 |
- | |
82 | mov ah, 0 |
- | |
83 | mov al, 12h |
- | |
84 | int 10h |
99 | exit_to_dos PROC |
85 | - | ||
86 | ; Flush keyboard buffer |
- | |
87 | mov ah, 0ch |
100 | mov ah, 4ch |
88 | mov al, 0 |
101 | mov al, 00h |
89 | int 21h |
102 | int 21h |
- | 103 | ret |
|
- | 104 | exit_to_dos ENDP |
|
90 | 105 | ||
- | 106 | sleep_5 PROC |
|
- | 107 | mov ah, 86h |
|
- | 108 | mov cx, 004bh |
|
- | 109 | mov dx, 4000h |
|
91 | ; Print message |
110 | int 15h |
- | 111 | ret |
|
- | 112 | sleep_5 ENDP |
|
- | 113 | ||
- | 114 | print_menu_screen PROC |
|
92 | mov ah, 9 |
115 | mov ah, 9 |
93 | lea dx, menu1 |
116 | lea dx, menu1 |
94 | int 21h |
117 | int 21h |
95 | lea dx, menu2 |
118 | lea dx, menu2 |
96 | int 21h |
119 | int 21h |
Line 124... | Line 147... | ||
124 | int 21h |
147 | int 21h |
125 | lea dx, menu17 |
148 | lea dx, menu17 |
126 | int 21h |
149 | int 21h |
127 | lea dx, menu18 |
150 | lea dx, menu18 |
128 | int 21h |
151 | int 21h |
- | 152 | ret |
|
- | 153 | print_menu_screen ENDP |
|
- | 154 | ||
- | 155 | print_gameover_screen PROC |
|
- | 156 | mov ah, 9 |
|
- | 157 | lea dx, gameover1 |
|
- | 158 | int 21h |
|
- | 159 | lea dx, gameover2 |
|
- | 160 | int 21h |
|
- | 161 | lea dx, gameover3 |
|
- | 162 | int 21h |
|
- | 163 | ret |
|
- | 164 | print_gameover_screen ENDP |
|
- | 165 | ||
- | 166 | ; ------------------------------------------------------- |
|
- | 167 | ||
- | 168 | start: |
|
- | 169 | ; Setup data segment |
|
- | 170 | mov ax, @data ; moving base address of data to ax |
|
- | 171 | mov ds, ax ; moving contents of ax into ds |
|
- | 172 | ; data section now gets initialized |
|
- | 173 | ||
- | 174 | ; Preserve the original screen mode |
|
- | 175 | mov ah, 0Fh ; Query screen mode |
|
- | 176 | int 10h |
|
- | 177 | push ax ; actually, we are only interested in register al (screen mode), not in ah (column count) |
|
- | 178 | ||
- | 179 | ; Change numlock to ON |
|
- | 180 | ; DOSBox has a bug where the NumLock is not correctly set to the setting of the host system, |
|
- | 181 | ; so you have to press the NumLock key twice so that DOSBox recognizes the status. |
|
- | 182 | ; see: https://sourceforge.net/p/dosbox/bugs/71/ |
|
- | 183 | ; https://superuser.com/questions/255102/is-there-a-way-to-use-the-numeric-keypad-in-dosbox/1146986 |
|
- | 184 | ; Since the game uses number keys very often, we set NumLock to ON |
|
- | 185 | call set_numlock_on |
|
- | 186 | ||
- | 187 | ; Reduce size of own application to give the called applications more space |
|
- | 188 | ; see https://stackoverflow.com/a/10067627 |
|
- | 189 | mov ah, 4Ah |
|
- | 190 | mov al, 00h |
|
- | 191 | mov bx, 100 ; 100 paragraphs a 16 byte = 1600 byte |
|
- | 192 | ; EXE size is 1188 byte |
|
- | 193 | int 21h |
|
- | 194 | ||
- | 195 | menu: |
|
- | 196 | ; Video Mode VGA 12 |
|
- | 197 | call set_screen12 |
|
- | 198 | ||
- | 199 | ; Flush keyboard buffer |
|
- | 200 | call flush_keyb_buf |
|
- | 201 | ||
- | 202 | ; Print menu screen |
|
- | 203 | call print_menu_screen |
|
129 | 204 | ||
130 | retry: |
205 | retry: |
131 | ; Query keyboard input |
206 | ; Query keyboard input |
132 | mov ah, 07h ; Direct character input, without echo |
207 | mov ah, 07h ; Direct character input, without echo |
133 | int 21h |
208 | int 21h |
134 | cmp al, '1' |
209 | cmp al, '1' |
135 | je prog1 |
210 | je prog1 |
136 | cmp al, '2' |
211 | cmp al, '2' |
137 | je prog2 |
212 | je prog2 |
138 | cmp al, '9' |
213 | cmp al, '9' |
139 | je ende |
214 | je exit |
140 | 215 | ||
141 | ; Invalid input |
216 | ; Invalid input |
142 | jmp retry |
217 | jmp retry |
143 | 218 | ||
144 | prog1: |
219 | prog1: |
Line 147... | Line 222... | ||
147 | 222 | ||
148 | ; Setup parameter block for the EXEC command |
223 | ; Setup parameter block for the EXEC command |
149 | call setup_paramblk |
224 | call setup_paramblk |
150 | 225 | ||
151 | ; Start game 1 |
226 | ; Start game 1 |
152 | mov ah, 4bh ; execute |
227 | mov ah, 4Bh ; execute |
153 | mov al, 00h ; load and execute |
228 | mov al, 00h ; load and execute |
154 | mov bx, paramblk |
229 | mov bx, paramblk |
155 | lea dx, exename1 |
230 | lea dx, exename1 |
156 | int 21h |
231 | int 21h |
157 | 232 | ||
158 | ; Notify the player that the game is finished |
233 | ; Notify the player that the game has finished |
159 | jmp gameover |
234 | jmp gameover |
160 | 235 | ||
161 | prog2: |
236 | prog2: |
162 | ; Clear screen |
237 | ; Clear screen |
163 | call clear_vga |
238 | call clear_vga |
164 | 239 | ||
165 | ; Setup parameter block for the EXEC command |
240 | ; Setup parameter block for the EXEC command |
166 | call setup_paramblk |
241 | call setup_paramblk |
167 | 242 | ||
168 | ; Start game 2 |
243 | ; Start game 2 |
169 | mov ah, 4bh ; execute |
244 | mov ah, 4Bh ; execute |
170 | mov al, 00h ; load and execute |
245 | mov al, 00h ; load and execute |
171 | mov bx, paramblk |
246 | mov bx, paramblk |
172 | lea dx, exename2 |
247 | lea dx, exename2 |
173 | int 21h |
248 | int 21h |
174 | 249 | ||
175 | ; Notify the player that the game is finished |
250 | ; Notify the player that the game has finished |
176 | jmp gameover |
251 | jmp gameover |
177 | 252 | ||
178 | gameover: |
253 | gameover: |
179 | ; Print message |
254 | ; Print gameover screen |
180 | mov ah, 9 |
- | |
181 | lea dx, gameover1 |
255 | call print_gameover_screen |
182 | int 21h |
- | |
183 | lea dx, gameover2 |
- | |
184 | int 21h |
- | |
185 | lea dx, gameover3 |
- | |
186 | int 21h |
- | |
187 | 256 | ||
188 | ; Sleep approx 5 seconds |
257 | ; Give the player time to read the game over message (approx 5 seconds) |
189 | mov ah, 86h |
258 | call sleep_5 |
190 | mov cx, 004bh |
- | |
191 | mov dx, 4000h |
- | |
192 | int 15h |
- | |
193 | 259 | ||
194 | ; Go to the menu |
260 | ; Go back to the menu |
195 | jmp menu |
261 | jmp menu |
196 | 262 | ||
197 | ende: |
263 | exit: |
198 | ; Reset video mode to DOS default |
264 | ; Reset video mode to DOS default |
199 | mov ah, 0 |
265 | pop ax ; the video mode we have preserved at program start |
200 | mov al, 3 |
266 | mov ah, 0 ; set screen mode |
201 | int 10h |
267 | int 10h |
202 | 268 | ||
203 | ; Return to DOS |
269 | ; Return to DOS |
204 | mov ah, 4ch |
270 | call exit_to_dos |
- | 271 | ||
205 | mov al, 00h |
272 | ; ------------------------------------------------------- |
206 | int 21h |
- | |
207 | 273 | ||
208 | end start |
274 | end start |
209 | 275 |