Rev 25 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 25 | Rev 27 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ; Launches aydos1.gam and aydos2.gam |
3 | ; Launches aydos1.gam and aydos2.gam |
4 | ; Revision 2018-12-07 |
4 | ; Revision 2018-12-07 |
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 100h |
9 | 9 | ||
10 | ; ------------------------------------------------------- |
10 | ; ------------------------------------------------------- |
11 | 11 | ||
12 | .data |
12 | .data |
13 | 13 | ||
Line 80... | Line 80... | ||
80 | mov [paramblk + 12], ax ; fcb2_seg |
80 | mov [paramblk + 12], ax ; fcb2_seg |
81 | ret |
81 | ret |
82 | setup_paramblk ENDP |
82 | setup_paramblk ENDP |
83 | 83 | ||
84 | set_numlock_on PROC |
84 | set_numlock_on PROC |
- | 85 | push es |
|
- | 86 | ||
- | 87 | ; In Windows 98+, we cannot access the BIOS Data Area, |
|
- | 88 | ; so we use this technique to check if we are inside Windows. |
|
- | 89 | ; This code was taken from http://www.fysnet.net/chkwin.htm |
|
- | 90 | xor ax,ax ; point es:di to 0000:0000h |
|
- | 91 | mov es,ax ; |
|
- | 92 | mov di,ax ; |
|
- | 93 | mov ax,1602h ; Get API entry point |
|
- | 94 | int 2Fh ; call to multiplex interrupt |
|
- | 95 | mov ax,es ; |
|
- | 96 | or ax,ax ; if es:di doesn't point to 0000:0000h |
|
- | 97 | jnz short is_win ; then Windows is running a DOS box |
|
- | 98 | or di,di ; else |
|
- | 99 | jnz short is_win ; we are in True DOS |
|
- | 100 | ||
- | 101 | ; Now the actual code that sets numlock on |
|
85 | push ds |
102 | push ds |
86 | mov ax, 40h |
103 | mov ax, 40h |
87 | mov ds, ax ; Go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html ) |
104 | mov ds, ax ; Go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html ) |
88 | mov bx, 17h ; Load Keyboard flag byte 0 |
105 | mov bx, 17h ; Load Keyboard flag byte 0 |
89 | mov al, [bx] ; Read |
106 | mov al, [bx] ; Read |
90 | or al, 20h ; Set bit 5 (numlock) to 1 |
107 | or al, 20h ; Set bit 5 (numlock) to 1 |
91 | mov [bx], al ; Write |
108 | mov [bx], al ; Write |
92 | pop ds |
109 | pop ds |
- | 110 | ||
- | 111 | is_win: |
|
- | 112 | pop es |
|
93 | ret |
113 | ret |
94 | set_numlock_on ENDP |
114 | set_numlock_on ENDP |
95 | 115 | ||
96 | flush_keyb_buf PROC |
116 | flush_keyb_buf PROC |
97 | mov ah, 0Ch ; Flush input buffer and input |
117 | mov ah, 0Ch ; Flush input buffer and input |
Line 138... | Line 158... | ||
138 | ; cl = Color |
158 | ; cl = Color |
139 | mov ah, 0Eh |
159 | mov ah, 0Eh |
140 | print_color_string_again: |
160 | print_color_string_again: |
141 | mov bx, dx |
161 | mov bx, dx |
142 | mov al, [bx] |
162 | mov al, [bx] |
143 | cmp al, 0 ; is the character zero? then we are done |
163 | test al, al ; is the character zero? then we are done |
144 | je print_color_string_end |
164 | jz print_color_string_end |
145 | mov bl, cl |
165 | mov bl, cl |
146 | int 10h |
166 | int 10h |
147 | add dx, 1 ; go to next character |
167 | add dx, 1 ; go to next character |
148 | jmp print_color_string_again |
168 | jmp print_color_string_again |
149 | print_color_string_end: |
169 | print_color_string_end: |
Line 263... | Line 283... | ||
263 | 283 | ||
264 | ; Setup parameter block for the EXEC command |
284 | ; Setup parameter block for the EXEC command |
265 | call setup_paramblk |
285 | call setup_paramblk |
266 | 286 | ||
267 | ; Start game 1 |
287 | ; Start game 1 |
- | 288 | mov ax, @data ; ds:dx = ASCIZ program name (must include extension) |
|
- | 289 | mov ds, ax |
|
- | 290 | lea dx, exename1 |
|
- | 291 | mov ax, @data ; es:bx = Parameter block |
|
- | 292 | mov es, ax |
|
- | 293 | mov bx, paramblk |
|
268 | mov ah, 4Bh ; execute |
294 | mov ah, 4Bh ; execute |
269 | mov al, 00h ; load and execute |
295 | mov al, 00h ; load and execute |
270 | mov bx, paramblk |
- | |
271 | lea dx, exename1 |
- | |
272 | int 21h |
296 | int 21h ; DOS API |
273 | 297 | ||
274 | ; Is everything OK? Or is the GAM file missing? |
298 | ; Is everything OK? Or is the GAM file missing? |
275 | jc error |
299 | jc error |
276 | 300 | ||
277 | ; Notify the player that the game has finished |
301 | ; Notify the player that the game has finished |
Line 283... | Line 307... | ||
283 | 307 | ||
284 | ; Setup parameter block for the EXEC command |
308 | ; Setup parameter block for the EXEC command |
285 | call setup_paramblk |
309 | call setup_paramblk |
286 | 310 | ||
287 | ; Start game 2 |
311 | ; Start game 2 |
- | 312 | mov ax, @data ; ds:dx = ASCIZ program name (must include extension) |
|
- | 313 | mov ds, ax |
|
- | 314 | lea dx, exename2 |
|
- | 315 | mov ax, @data ; es:bx = Parameter block |
|
- | 316 | mov es, ax |
|
- | 317 | mov bx, paramblk |
|
288 | mov ah, 4Bh ; execute |
318 | mov ah, 4Bh ; execute |
289 | mov al, 00h ; load and execute |
319 | mov al, 00h ; load and execute |
290 | mov bx, paramblk |
- | |
291 | lea dx, exename2 |
- | |
292 | int 21h |
320 | int 21h ; DOS API |
293 | 321 | ||
294 | ; Is everything OK? Or is the GAM file missing? |
322 | ; Is everything OK? Or is the GAM file missing? |
295 | jc error |
323 | jc error |
296 | 324 | ||
297 | ; Notify the player that the game has finished |
325 | ; Notify the player that the game has finished |