Subversion Repositories aysalia

Rev

Rev 21 | Rev 23 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 22
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-06
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 10h
9
 
9
 
Line 11... Line 11...
11
 
11
 
12
.data
12
.data
13
 
13
 
14
    exename1  db "AYDOS1.GAM",0
14
    exename1  db "AYDOS1.GAM", 0
15
    exename2  db "AYDOS2.GAM",0
15
    exename2  db "AYDOS2.GAM", 0
16
    cmdargs   db 0,'',0dh
16
    cmdargs   db 0, '', 0Dh
17
 
17
 
18
    dummy_fcb db 36 dup(0)
18
    dummy_fcb db 36 dup(0)
19
 
19
 
20
    paramblk  dw 0          ; use environment of parent
20
    paramblk  dw 0          ; use environment of parent
21
              dw cmdargs    ; command line arguments
21
              dw cmdargs    ; command line arguments
Line 23... Line 23...
23
              dw dummy_fcb  ; fcb1
23
              dw dummy_fcb  ; fcb1
24
              dw 0          ; fcb1_seg
24
              dw 0          ; fcb1_seg
25
              dw dummy_fcb  ; fcb2
25
              dw dummy_fcb  ; fcb2
26
              dw 0          ; fcb2_seg
26
              dw 0          ; fcb2_seg
27
 
27
 
28
    menu1     db '', 13, 10, '$'
28
    menu1     db 13, 10, \
29
    menu2     db '', 13, 10, '$'
29
                 13, 10, \
30
    menu3     db '', 13, 10, '$'
30
                 13, 10, \
31
    menu4     db '', 13, 10, '$'
31
                 13, 10, \
32
    menu5     db '                            Aysalia DOS',13,10,'$'
32
                 '                            Aysalia DOS', 13, 10, \
33
    menu6     db '', 13, 10, '$'
33
                 13, 10, \
34
    menu7     db '', 13, 10, '$'
34
                 13, 10, \
35
    menu8     db '              Welches Spiel soll gestartet werden?',13,10,'$'
35
                 '              Welches Spiel soll gestartet werden?', 13, 10, \
36
    menu9     db '', 13, 10, '$'
36
                 13, 10, \
37
    menu10    db '              Dr',81h,'cke eine der folgenden Tasten:',13,10,'$'
37
                 '              Dr', 81h, 'cke eine der folgenden Tasten:', 13, 10, \
38
    menu11    db '', 13, 10, '$'
38
                 13, 10, \
39
    menu12    db '              1  Aysalia DOS I',13,10,'$'
39
                 '              1  Aysalia DOS I', 13, 10, \
40
    menu13    db '              2  Aysalia DOS II',13,10,'$'
40
                 '              2  Aysalia DOS II', 13, 10, \
41
    menu14    db '', 13, 10, '$'
41
                 13, 10, \
42
    menu15    db '              9  Beenden',13,10,'$'
42
                 '              9  Beenden', 13, 10, \
43
    menu16    db '', 13, 10, '$'
43
                 13, 10, \
44
    menu17    db '', 13, 10, '$'
44
                 13, 10, \
45
    menu18    db '', 13, 10, '$'       
45
                 13, 10, 0
46
   
46
   
47
    error1    db '',13,10,'$'
47
    error1    db 13, 10, \
48
    error2    db 'Fehler: Spiel kann nicht gestartet werden. Fehlt eine Datei?',13,10,'$'
48
                 'Fehler: Spiel kann nicht gestartet werden. Fehlt eine Datei?', 13, 10, \
49
    error3    db '',13,10,'$'
49
                 13, 10, 0
50
 
50
 
51
    gameover1 db '',13,10,'$'
51
    gameover1 db 13, 10, \
52
    gameover2 db 'Spiel zu Ende!',13,10,'$'
52
                 'Spiel zu Ende!', 13, 10, \
53
    gameover3 db '',13,10,'$'
53
                 13, 10, 0
54
 
54
 
55
; -------------------------------------------------------
55
; -------------------------------------------------------
56
 
56
 
57
.code
57
.code
58
 
58
 
59
clear_vga PROC
59
clear_vga PROC
60
    mov     ax, 0a000h
60
    mov     ax, 0A000h
61
    mov     es, ax
61
    mov     es, ax
62
    xor     di, di
62
    xor     di, di
63
    mov     ax, 0
63
    mov     ax, 0
64
    mov     cx, 64000
64
    mov     cx, 64000
65
    rep     stosb
65
    rep     stosb
Line 82... Line 82...
82
setup_paramblk ENDP
82
setup_paramblk ENDP
83
 
83
 
84
set_numlock_on PROC
84
set_numlock_on PROC
85
    push    ds
85
    push    ds
86
    mov     ax, 40h
86
    mov     ax, 40h
87
    mov     ds, ax        ; go to BIOS Data Area ( http://stanislavs.org/helppc/bios_data_area.html )
87
    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
88
    mov     bx, 17h       ; Load Keyboard flag byte 0
89
    mov     al, [bx]      ; read
89
    mov     al, [bx]      ; Read
90
    or      al, 20h       ; set bit 5 (numlock) to 1
90
    or      al, 20h       ; Set bit 5 (numlock) to 1
91
    mov     [bx], al      ; write
91
    mov     [bx], al      ; Write
92
    pop     ds
92
    pop     ds
93
    ret
93
    ret
94
set_numlock_on ENDP
94
set_numlock_on ENDP
95
 
95
 
96
flush_keyb_buf PROC
96
flush_keyb_buf PROC
Line 99... Line 99...
99
    int     21h
99
    int     21h
100
    ret
100
    ret
101
flush_keyb_buf ENDP
101
flush_keyb_buf ENDP
102
 
102
 
103
exit_to_dos PROC
103
exit_to_dos PROC
104
    mov     ah, 4ch
104
    mov     ah, 4Ch
105
    mov     al, 00h
105
    mov     al, 00h
106
    int     21h
106
    int     21h
107
    ret
107
    ret
108
exit_to_dos ENDP
108
exit_to_dos ENDP
109
 
109
 
110
sleep_5 PROC
110
sleep_5 PROC
111
    mov     ah, 00h
111
    mov     ah, 00h
112
    int     1Ah
112
    int     1Ah
113
    cmp     dx, 7FFFh
113
    cmp     dx, 7FFFh
114
    jg      upperhalf
114
    jg      sleep_5_upperhalf
115
lowerhalf:
115
sleep_5_lowerhalf:
116
    mov     bx, dx
116
    mov     bx, dx
117
    add     bx, 91   ; 18.2 = 1 sec (therefore 91 = 5 sec)
117
    add     bx, 91        ; 18.2 = 1 sec (therefore 91 = 5 sec)
118
lowerhalf_again:
118
sleep_5_lowerhalf_again:
119
    int     1Ah
119
    int     1Ah
120
    cmp     dx, bx
120
    cmp     dx, bx
121
    jl      lowerhalf_again
121
    jl      sleep_5_lowerhalf_again
122
    ret
122
    ret
123
upperhalf:
123
sleep_5_upperhalf:
124
    mov     bx, dx
124
    mov     bx, dx
125
    sub     bx, 7FFFh
125
    sub     bx, 7FFFh
126
    add     bx, 91   ; 18.2 = 1 sec (therefore 91 = 5 sec)
126
    add     bx, 91        ; 18.2 = 1 sec (therefore 91 = 5 sec)
127
upperhalf_again:
127
sleep_5_upperhalf_again:
128
    int     1Ah
128
    int     1Ah
129
    sub     dx, 7FFFh
129
    sub     dx, 7FFFh
130
    cmp     dx, bx
130
    cmp     dx, bx
131
    jl      upperhalf_again
131
    jl      sleep_5_upperhalf_again
132
    ret
132
    ret
133
sleep_5 ENDP
133
sleep_5 ENDP
134
 
134
 
135
print_menu_screen PROC
135
print_color_string PROC
-
 
136
    ; This function requires:
-
 
137
    ; dx = Pointer to zero terminated string
-
 
138
    ; cl = Color
-
 
139
    mov     ah, 0Eh
-
 
140
print_color_string_again:
-
 
141
    mov     al, 0
-
 
142
    mov     bx, dx
-
 
143
    cmp     [bx], al
-
 
144
    je      print_color_string_end
-
 
145
    mov     al, [bx]
-
 
146
    mov     bl, cl
-
 
147
    int     10h
-
 
148
    add     dx, 1
-
 
149
    jmp     print_color_string_again
-
 
150
print_color_string_end:
-
 
151
    ret
-
 
152
print_color_string ENDP
-
 
153
 
-
 
154
set_bg_color PROC
-
 
155
    ; This function requires:
-
 
156
    ; bl = Color
136
    mov     ah, 0Bh
157
    mov     ah, 0Bh
137
    mov     bh, 00h
158
    mov     bh, 00h
138
    mov     bl, 8     ; green
-
 
139
    int     10h
159
    int     10h
-
 
160
    ret
-
 
161
set_bg_color ENDP
140
 
162
 
-
 
163
print_menu_screen PROC
-
 
164
    ; Move cursor to 0, 0
-
 
165
    mov     ah, 02h       ; set cursor position
-
 
166
    mov     dh, 0         ; line
-
 
167
    mov     dl, 0         ; column
-
 
168
    mov     bh, 0         ; page
141
    mov     ah, 9
169
    int     10h
-
 
170
 
-
 
171
    ; Set background color
-
 
172
    mov     bl, 8         ; dark green background
-
 
173
    call    set_bg_color
-
 
174
   
-
 
175
    ; Set text color
-
 
176
    mov     cl, 0Fh       ; white font
142
    lea     dx, menu1
177
    lea     dx, menu1
143
    int     21h
-
 
144
    lea     dx, menu2
-
 
145
    int     21h
-
 
146
    lea     dx, menu3
-
 
147
    int     21h
-
 
148
    lea     dx, menu4
-
 
149
    int     21h
-
 
150
    lea     dx, menu5
-
 
151
    int     21h
-
 
152
    lea     dx, menu6
-
 
153
    int     21h
-
 
154
    lea     dx, menu7
-
 
155
    int     21h
-
 
156
    lea     dx, menu8
-
 
157
    int     21h
-
 
158
    lea     dx, menu9
-
 
159
    int     21h
-
 
160
    lea     dx, menu10
178
    call    print_color_string
161
    int     21h
-
 
162
    lea     dx, menu11
-
 
163
    int     21h
-
 
164
    lea     dx, menu12
-
 
165
    int     21h
-
 
166
    lea     dx, menu13
-
 
167
    int     21h
-
 
168
    lea     dx, menu14
-
 
169
    int     21h
-
 
170
    lea     dx, menu15
-
 
171
    int     21h
-
 
172
    lea     dx, menu16
-
 
173
    int     21h
-
 
174
    lea     dx, menu17
-
 
175
    int     21h
-
 
176
    lea     dx, menu18
-
 
177
    int     21h
179
   
178
    ret
180
    ret
179
print_menu_screen ENDP
181
print_menu_screen ENDP
180
 
182
 
181
print_error_screen PROC
183
print_error_screen PROC
-
 
184
    ; Move cursor to 0, 0
-
 
185
    mov     ah, 02h       ; set cursor position
182
    mov     ah, 0Bh
186
    mov     dh, 0         ; line
183
    mov     bh, 00h
187
    mov     dl, 0         ; column
184
    mov     bl, 4     ; red
188
    mov     bh, 0         ; page
185
    int     10h
189
    int     10h
186
 
190
 
-
 
191
    ; Set background color
-
 
192
    mov     bl, 4         ; dark red background
-
 
193
    call    set_bg_color
-
 
194
   
187
    mov     ah, 9
195
    ; Set text color
-
 
196
    mov     cl, 0Fh       ; white font
188
    lea     dx, error1
197
    lea     dx, error1
189
    int     21h
-
 
190
    lea     dx, error2
198
    call    print_color_string
191
    int     21h
199
   
192
    lea     dx, error3
-
 
193
    int     21h
-
 
194
    ret
200
    ret
195
print_error_screen ENDP
201
print_error_screen ENDP
196
 
202
 
197
print_gameover_screen PROC
203
print_gameover_screen PROC
198
    mov     ah, 0Bh
-
 
199
    mov     bh, 00h
-
 
200
    mov     bl, 4     ; red
204
    ; Keep cursor position
201
    int     10h
-
 
202
 
205
 
-
 
206
    ; Set background color
-
 
207
    mov     bl, 4    ; dark red background
-
 
208
    call    set_bg_color
-
 
209
   
203
    mov     ah, 9
210
    ; Set text color
-
 
211
    mov     cl, 0Fh  ; white font
204
    lea     dx, gameover1
212
    lea     dx, gameover1
205
    int     21h
-
 
206
    lea     dx, gameover2
213
    call    print_color_string
207
    int     21h
214
   
208
    lea     dx, gameover3
-
 
209
    int     21h
-
 
210
    ret
215
    ret
211
print_gameover_screen ENDP
216
print_gameover_screen ENDP
212
 
217
 
213
; -------------------------------------------------------
218
; -------------------------------------------------------
214
 
219