Rev 485 | Rev 2526 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 485 | Rev 551 | ||
---|---|---|---|
1 | ; |
1 | ; |
2 | ; pipes for menuet {and now kolibri} |
2 | ; pipes for menuet {and now kolibri} |
3 | ; v1.2 |
3 | ; v1.2 |
4 | ; 2006 by Mario Birkner |
4 | ; 2006 by Mario Birkner |
5 | ; |
5 | ; |
6 | ; l.mod. 27.08.06/15:11 |
6 | ; l.mod. 27.08.06/15:11 |
7 | ; |
7 | ; |
8 | ; Compile with FASM |
8 | ; Compile with FASM |
9 | ; |
9 | ; |
10 | bgcolor equ 0x0074744A ;thx |
10 | bgcolor equ 0x0074744A ;thx |
11 | fgcolor equ 0x00E7C750 ;to |
11 | fgcolor equ 0x00E7C750 ;to |
12 | fg2color equ 0x00E0B0A0 ;colorref |
12 | fg2color equ 0x00E0B0A0 ;colorref |
13 | fg3color equ 0x007F7F55 |
13 | fg3color equ 0x007F7F55 |
14 | btcolor equ 0x005B6200 |
14 | btcolor equ 0x005B6200 |
15 | 15 | ||
16 | include '..\..\macros.inc' |
16 | include '..\..\macros.inc' |
17 | 17 | ||
18 | use32 |
18 | use32 |
19 | 19 | ||
20 | org 0x0 |
20 | org 0x0 |
21 | 21 | ||
22 | db 'MENUET01' ; 8 byte id |
22 | db 'MENUET01' ; 8 byte id |
23 | dd 0x01 ; header version |
23 | dd 0x01 ; header version |
24 | dd START ; start of code |
24 | dd START ; start of code |
25 | dd I_END ; size of image |
25 | dd I_END ; size of image |
26 | dd 0x100000 ; memory for app |
26 | dd 0x100000 ; memory for app |
27 | dd 0x7fff0 ; esp |
27 | dd 0x7fff0 ; esp |
28 | dd 0x0 , 0x0 ; I_Param , I_Icon |
28 | dd 0x0 , 0x0 ; I_Param , I_Icon |
29 | 29 | ||
30 | START: ; start of execution |
30 | START: ; start of execution |
31 | 31 | ||
32 | call draw_window |
32 | call draw_window |
33 | call draw_board |
33 | call draw_board |
34 | 34 | ||
35 | still: |
35 | still: |
36 | 36 | ||
37 | mov eax,10 ; wait here for event |
37 | mov eax,10 ; wait here for event |
38 | mcall |
38 | mcall |
39 | 39 | ||
40 | cmp eax,1 ; redraw request ? |
40 | cmp eax,1 ; redraw request ? |
41 | je red |
41 | je red |
42 | cmp eax,2 ; key in buffer ? |
42 | cmp eax,2 ; key in buffer ? |
43 | je key |
43 | je key |
44 | cmp eax,3 ; button in buffer ? |
44 | cmp eax,3 ; button in buffer ? |
45 | je button |
45 | je button |
46 | 46 | ||
47 | jmp still |
47 | jmp still |
48 | 48 | ||
49 | red: ; redraw |
49 | red: ; redraw |
50 | call draw_window |
50 | call draw_window |
51 | call draw_board |
51 | call draw_board |
52 | call draw_message |
52 | call draw_message |
53 | jmp still |
53 | jmp still |
54 | 54 | ||
55 | key: ; key |
55 | key: ; key |
56 | mov eax,2 ; just read it and ignore |
56 | mov eax,2 ; just read it and ignore |
57 | mcall |
57 | mcall |
58 | jmp still |
58 | jmp still |
59 | button: ; button |
59 | button: ; button |
60 | call get_input |
60 | call get_input |
61 | jmp still |
61 | jmp still |
62 | 62 | ||
63 | 63 | ||
64 | 64 | ||
65 | get_input: |
65 | get_input: |
66 | pusha |
66 | pusha |
67 | mov eax,17 ; get id |
67 | mov eax,17 ; get id |
68 | mcall |
68 | mcall |
69 | 69 | ||
70 | cmp ah,1 ; button id=1 ? |
70 | cmp ah,1 ; button id=1 ? |
71 | jne .noclose |
71 | jne .noclose |
72 | 72 | ||
73 | mov eax,-1 ; close this program |
73 | mov eax,-1 ; close this program |
74 | mcall |
74 | mcall |
75 | .noclose: |
75 | .noclose: |
76 | cmp ah,4 |
76 | cmp ah,4 |
77 | jne .moderate |
77 | jne .moderate |
78 | mov [diffic],1 |
78 | mov [diffic],1 |
79 | jmp .enddiffic |
79 | jmp .enddiffic |
80 | .moderate: |
80 | .moderate: |
81 | cmp ah,3 |
81 | cmp ah,3 |
82 | jne .easy |
82 | jne .easy |
83 | mov [diffic],3 |
83 | mov [diffic],3 |
84 | jmp .enddiffic |
84 | jmp .enddiffic |
85 | .easy: |
85 | .easy: |
86 | cmp ah,2 |
86 | cmp ah,2 |
87 | jne .board |
87 | jne .board |
88 | mov [diffic],5 |
88 | mov [diffic],5 |
89 | .enddiffic: |
89 | .enddiffic: |
90 | mov [score],0 |
90 | mov [score],0 |
91 | mov [speed],40 |
91 | mov [speed],40 |
92 | mov [level],1 |
92 | mov [level],1 |
93 | mov [stat],0 |
93 | mov [stat],0 |
94 | mov [time],0 |
94 | mov [time],0 |
95 | call draw_window |
95 | call draw_window |
96 | call scramble_board |
96 | call scramble_board |
97 | call draw_board |
97 | call draw_board |
98 | call countdown |
98 | call countdown |
99 | call wassermarsch |
99 | call wassermarsch |
100 | jmp .getno |
100 | jmp .getno |
101 | .board: |
101 | .board: |
102 | cmp [stat],2 |
102 | cmp [stat],2 |
103 | jge .getno |
103 | jge .getno |
104 | shr eax,8 ; -> 24bit id |
104 | shr eax,8 ; -> 24bit id |
105 | cmp eax,10 |
105 | cmp eax,10 |
106 | jle .getno |
106 | jle .getno |
107 | cmp eax,150 |
107 | cmp eax,150 |
108 | jg .getno |
108 | jg .getno |
109 | sub eax,10 |
109 | sub eax,10 |
110 | mov edi,eax |
110 | mov edi,eax |
111 | add edi,map |
111 | add edi,map |
112 | cmp [edi], byte 1 |
112 | cmp [edi], byte 1 |
113 | jg .nogerade |
113 | jg .nogerade |
114 | xor byte [edi], 1 |
114 | xor byte [edi], 1 |
115 | call draw_board |
115 | call draw_board |
116 | jmp .getno |
116 | jmp .getno |
117 | .nogerade: |
117 | .nogerade: |
118 | cmp [edi], byte 6 |
118 | cmp [edi], byte 6 |
119 | jge .getno |
119 | jge .getno |
120 | cmp [edi], byte 5 |
120 | cmp [edi], byte 5 |
121 | jne .rota |
121 | jne .rota |
122 | sub byte [edi],4 |
122 | sub byte [edi],4 |
123 | .rota: |
123 | .rota: |
124 | inc byte [edi] |
124 | inc byte [edi] |
125 | call draw_board |
125 | call draw_board |
126 | .getno: |
126 | .getno: |
127 | popa |
127 | popa |
128 | ret |
128 | ret |
129 | ;//// end of event detection |
129 | ;//// end of event detection |
130 | get_direction: ;Setzt Richtungs-Konstanten |
130 | get_direction: ;Setzt Richtungs-Konstanten |
131 | pusha ;IN: |
131 | pusha ;IN: |
132 | mov eax,[esp+28] ;eax - Richtung IN |
132 | mov eax,[esp+28] ;eax - Richtung IN |
133 | mov ebx,[esp+16] ;ebx - Teilchen (Map-Wert) |
133 | mov ebx,[esp+16] ;ebx - Teilchen (Map-Wert) |
134 | cmp ebx,0 ;OUT: |
134 | cmp ebx,0 ;OUT: |
135 | jne .no0 ;eax - Richtung OUT |
135 | jne .no0 ;eax - Richtung OUT |
136 | cmp eax,14 |
136 | cmp eax,14 |
137 | jne .o0 |
137 | jne .o0 |
138 | jmp .setout |
138 | jmp .setout |
139 | .o0: |
139 | .o0: |
140 | cmp eax,-14 |
140 | cmp eax,-14 |
141 | jne .col |
141 | jne .col |
142 | jmp .setout |
142 | jmp .setout |
143 | .no0: |
143 | .no0: |
144 | cmp ebx,1 |
144 | cmp ebx,1 |
145 | jne .no1 |
145 | jne .no1 |
146 | cmp eax,1 |
146 | cmp eax,1 |
147 | jne .o1 |
147 | jne .o1 |
148 | jmp .setout |
148 | jmp .setout |
149 | .o1: |
149 | .o1: |
150 | cmp eax,-1 |
150 | cmp eax,-1 |
151 | jne .col |
151 | jne .col |
152 | jmp .setout |
152 | jmp .setout |
153 | .no1: |
153 | .no1: |
154 | cmp ebx,2 |
154 | cmp ebx,2 |
155 | jne .no2 |
155 | jne .no2 |
156 | cmp eax,14 |
156 | cmp eax,14 |
157 | jne .o2 |
157 | jne .o2 |
158 | sub eax,13 |
158 | sub eax,13 |
159 | jmp .setout |
159 | jmp .setout |
160 | .o2: |
160 | .o2: |
161 | cmp eax,-1 |
161 | cmp eax,-1 |
162 | jne .col |
162 | jne .col |
163 | sub eax,13 |
163 | sub eax,13 |
164 | jmp .setout |
164 | jmp .setout |
165 | .no2: |
165 | .no2: |
166 | cmp ebx,3 |
166 | cmp ebx,3 |
167 | jne .no3 |
167 | jne .no3 |
168 | cmp eax,-14 |
168 | cmp eax,-14 |
169 | jne .o3 |
169 | jne .o3 |
170 | add eax,15 |
170 | add eax,15 |
171 | jmp .setout |
171 | jmp .setout |
172 | .o3: |
172 | .o3: |
173 | cmp eax,-1 |
173 | cmp eax,-1 |
174 | jne .col |
174 | jne .col |
175 | add eax,15 |
175 | add eax,15 |
176 | jmp .setout |
176 | jmp .setout |
177 | .no3: |
177 | .no3: |
178 | cmp ebx,4 |
178 | cmp ebx,4 |
179 | jne .no4 |
179 | jne .no4 |
180 | cmp eax,-14 |
180 | cmp eax,-14 |
181 | jne .o4 |
181 | jne .o4 |
182 | add eax,13 |
182 | add eax,13 |
183 | jmp .setout |
183 | jmp .setout |
184 | .o4: |
184 | .o4: |
185 | cmp eax,1 |
185 | cmp eax,1 |
186 | jne .col |
186 | jne .col |
187 | add eax,13 |
187 | add eax,13 |
188 | jmp .setout |
188 | jmp .setout |
189 | .no4: |
189 | .no4: |
190 | cmp ebx,5 |
190 | cmp ebx,5 |
191 | jne .no5 |
191 | jne .no5 |
192 | cmp eax,14 |
192 | cmp eax,14 |
193 | jne .o5 |
193 | jne .o5 |
194 | sub eax,15 |
194 | sub eax,15 |
195 | jmp .setout |
195 | jmp .setout |
196 | .o5: |
196 | .o5: |
197 | cmp eax,1 |
197 | cmp eax,1 |
198 | jne .col |
198 | jne .col |
199 | sub eax,15 |
199 | sub eax,15 |
200 | jmp .setout |
200 | jmp .setout |
201 | .no5: |
201 | .no5: |
202 | cmp ebx,6 |
202 | cmp ebx,6 |
203 | jne .no6 |
203 | jne .no6 |
204 | jmp .setout |
204 | jmp .setout |
205 | .no6: |
205 | .no6: |
206 | cmp ebx,7 |
206 | cmp ebx,7 |
207 | jne .no7 |
207 | jne .no7 |
208 | mov eax,14 |
208 | mov eax,14 |
209 | jmp .setout |
209 | jmp .setout |
210 | .no7: |
210 | .no7: |
211 | cmp ebx,8 |
211 | cmp ebx,8 |
212 | jne .no8 |
212 | jne .no8 |
213 | cmp eax,14 |
213 | cmp eax,14 |
214 | jne .col |
214 | jne .col |
215 | mov [stat],1 |
215 | mov [stat],1 |
216 | jmp .setout |
216 | jmp .setout |
217 | .no8: |
217 | .no8: |
218 | cmp ebx,16 ; cross 2x |
218 | cmp ebx,16 ; cross 2x |
219 | jne .col |
219 | jne .col |
220 | add [score],10 ; + 10 bonus points |
220 | add [score],10 ; + 10 bonus points |
221 | jmp .setout |
221 | jmp .setout |
222 | .col: |
222 | .col: |
223 | xor eax,eax |
223 | xor eax,eax |
224 | .setout: |
224 | .setout: |
225 | xor ebx,ebx |
225 | xor ebx,ebx |
226 | mov [esp+28],eax |
226 | mov [esp+28],eax |
227 | mov [esp+16],ebx |
227 | mov [esp+16],ebx |
228 | popa |
228 | popa |
229 | ret |
229 | ret |
230 | 230 | ||
231 | countdown: |
231 | countdown: |
232 | pusha |
232 | pusha |
233 | xor eax,eax |
233 | xor eax,eax |
234 | mov al,[diffic] |
234 | mov al,[diffic] |
235 | imul eax,10 |
235 | imul eax,10 |
236 | mov [time],eax |
236 | mov [time],eax |
237 | .udown: |
237 | .udown: |
238 | call show_score |
238 | call show_score |
239 | mov ecx,10 |
239 | mov ecx,10 |
240 | .down: |
240 | .down: |
241 | mov eax,5 |
241 | mov eax,5 |
242 | mov ebx,10 |
242 | mov ebx,10 |
243 | mcall |
243 | mcall |
244 | mov eax,11 |
244 | mov eax,11 |
245 | mcall |
245 | mcall |
246 | cmp eax,1 |
246 | cmp eax,1 |
247 | jne .nored |
247 | jne .nored |
248 | call draw_window |
248 | call draw_window |
249 | call draw_board |
249 | call draw_board |
250 | jmp .nothing |
250 | jmp .nothing |
251 | .nored: |
251 | .nored: |
252 | cmp eax,3 |
252 | cmp eax,3 |
253 | jne .nothing |
253 | jne .nothing |
254 | call get_input |
254 | call get_input |
255 | .nothing: |
255 | .nothing: |
256 | cmp [stat],0 ;bugfix 210806 |
256 | cmp [stat],0 ;bugfix 210806 |
257 | jnz .exitsub ;bugfix 210806 |
257 | jnz .exitsub ;bugfix 210806 |
258 | dec ecx |
258 | dec ecx |
259 | jnz .down |
259 | jnz .down |
260 | dec [time] |
260 | dec [time] |
261 | jnz .udown |
261 | jnz .udown |
262 | .exitsub: ;bugfix 210806 |
262 | .exitsub: ;bugfix 210806 |
263 | popa |
263 | popa |
264 | ret |
264 | ret |
265 | 265 | ||
266 | wassermarsch: |
266 | wassermarsch: |
267 | pusha |
267 | pusha |
268 | .restart: |
268 | .restart: |
269 | mov esi,map+16 ;start position |
269 | mov esi,map+16 ;start position |
270 | mov eax, 14 ;start-richtung |
270 | mov eax, 14 ;start-richtung |
271 | .findway: |
271 | .findway: |
272 | movzx ebx, byte [esi] |
272 | movzx ebx, byte [esi] |
273 | call get_direction |
273 | call get_direction |
274 | test eax,eax |
274 | test eax,eax |
275 | jz .collision |
275 | jz .collision |
276 | push eax |
276 | push eax |
277 | xor eax,eax |
277 | xor eax,eax |
278 | mov al,6 |
278 | mov al,6 |
279 | sub al,[diffic] |
279 | sub al,[diffic] |
280 | add [score],eax ;points/item = 6 - difficulty |
280 | add [score],eax ;points/item = 6 - difficulty |
281 | mov ecx,dword [speed] |
281 | mov ecx,dword [speed] |
282 | add byte [esi],10 |
282 | add byte [esi],10 |
283 | .down: |
283 | .down: |
284 | mov eax,5 |
284 | mov eax,5 |
285 | mov ebx,2 |
285 | mov ebx,2 |
286 | mcall |
286 | mcall |
287 | mov eax,11 |
287 | mov eax,11 |
288 | mcall |
288 | mcall |
289 | cmp eax,1 |
289 | cmp eax,1 |
290 | jne .nored |
290 | jne .nored |
291 | call draw_window |
291 | call draw_window |
292 | .nored: |
292 | .nored: |
293 | cmp eax,3 |
293 | cmp eax,3 |
294 | jne .noevnt |
294 | jne .noevnt |
295 | call get_input |
295 | call get_input |
296 | .noevnt: |
296 | .noevnt: |
297 | dec ecx |
297 | dec ecx |
298 | jnz .down |
298 | jnz .down |
299 | pop eax |
299 | pop eax |
300 | 300 | ||
301 | add esi,eax |
301 | add esi,eax |
302 | call draw_board |
302 | call draw_board |
303 | call show_score |
303 | call show_score |
304 | jmp .findway |
304 | jmp .findway |
305 | .collision: |
305 | .collision: |
306 | cmp [stat],1 |
306 | cmp [stat],1 |
307 | jne .loose |
307 | jne .loose |
308 | call draw_message |
308 | call draw_message |
309 | mov eax,5 |
309 | mov eax,5 |
310 | mov ebx,500 |
310 | mov ebx,500 |
311 | mcall |
311 | mcall |
312 | mov [stat],0 |
312 | mov [stat],0 |
313 | inc [level] |
313 | inc [level] |
314 | cmp [speed],6 ;waterflowdelay < 6 ? |
314 | cmp [speed],6 ;waterflowdelay < 6 ? |
315 | jle .skipsub |
315 | jle .skipsub |
316 | sub [speed],2 |
316 | sub [speed],2 |
317 | .skipsub: |
317 | .skipsub: |
318 | call draw_window |
318 | call draw_window |
319 | call scramble_board |
319 | call scramble_board |
320 | call draw_board |
320 | call draw_board |
321 | call countdown |
321 | call countdown |
322 | jmp .restart |
322 | jmp .restart |
323 | .loose: |
323 | .loose: |
324 | mov [stat],2 |
324 | mov [stat],2 |
325 | call draw_message |
325 | call draw_message |
326 | popa |
326 | popa |
327 | ret |
327 | ret |
328 | 328 | ||
329 | show_score: |
329 | show_score: |
330 | pusha |
330 | pusha |
331 | mov eax,13 ;clear time and score area |
331 | mov eax,13 ;clear time and score area |
332 | mov ebx,50 shl 16 +15 |
332 | mov ebx,50 shl 16 +15 |
333 | mov ecx,395 shl 16 +15 |
333 | mov ecx,395 shl 16 +15 |
334 | mov edx,bgcolor |
334 | mov edx,bgcolor |
335 | mcall |
335 | mcall |
336 | add ebx,60 shl 16 + 20 |
336 | add ebx,60 shl 16 + 20 |
337 | mcall |
337 | mcall |
338 | add ebx,80 shl 16 |
338 | add ebx,80 shl 16 |
339 | mcall |
339 | mcall |
340 | mov eax,47 |
340 | mov eax,47 |
341 | mov ebx,0x20000 |
341 | mov ebx,0x20000 |
342 | mov ecx,[time] |
342 | mov ecx,[time] |
343 | mov edx,50*65536+398 |
343 | mov edx,50*65536+398 |
344 | mov esi,fg2color |
344 | mov esi,fg2color |
345 | mcall |
345 | mcall |
346 | mov ebx,0x50000 |
346 | mov ebx,0x50000 |
347 | mov ecx,[score] |
347 | mov ecx,[score] |
348 | add edx,60 shl 16 |
348 | add edx,60 shl 16 |
349 | mcall |
349 | mcall |
350 | mov ebx,0x20000 |
350 | mov ebx,0x20000 |
351 | mov ecx,[level] |
351 | mov ecx,[level] |
352 | add edx,80 shl 16 |
352 | add edx,80 shl 16 |
353 | mcall |
353 | mcall |
354 | 354 | ||
355 | popa |
355 | popa |
356 | ret |
356 | ret |
357 | 357 | ||
358 | 358 | ||
359 | 359 | ||
360 | scramble_board: |
360 | scramble_board: |
361 | pusha |
361 | pusha |
362 | mov edi,map+16 ;startpunkt |
362 | mov edi,map+16 ;startpunkt |
363 | mov eax,7 ;wieder- |
363 | mov eax,7 ;wieder- |
364 | stosb ;herstellen |
364 | stosb ;herstellen |
365 | 365 | ||
366 | mov ebx, 0x00000007 ;modul m max-wert |
366 | mov ebx, 0x00000007 ;modul m max-wert |
367 | .loop_through: |
367 | .loop_through: |
368 | mov esi,edi |
368 | mov esi,edi |
369 | lodsb |
369 | lodsb |
370 | cmp eax, 9 |
370 | cmp eax, 9 |
371 | je .skip |
371 | je .skip |
372 | inc eax |
372 | inc eax |
373 | xor edx, edx |
373 | xor edx, edx |
374 | div ebx ;modulo -> edx |
374 | div ebx ;modulo -> edx |
375 | mov eax, edx |
375 | mov eax, edx |
376 | cmp eax,6 |
376 | cmp eax,6 |
377 | jne .skip |
377 | jne .skip |
378 | dec [half] |
378 | dec [half] |
379 | movzx eax, byte [half] |
379 | movzx eax, byte [half] |
380 | jnz .skip |
380 | jnz .skip |
381 | mov [half], byte 7 |
381 | mov [half], byte 7 |
382 | .skip: |
382 | .skip: |
383 | stosb |
383 | stosb |
384 | cmp edi,map+125 ;endpunkt erhalten |
384 | cmp edi,map+125 ;endpunkt erhalten |
385 | jge .exit |
385 | jge .exit |
386 | jmp .loop_through |
386 | jmp .loop_through |
387 | .exit: |
387 | .exit: |
388 | mov eax,8 |
388 | mov eax,8 |
389 | stosb |
389 | stosb |
390 | popa |
390 | popa |
391 | ret |
391 | ret |
392 | 392 | ||
393 | 393 | ||
394 | gen_image: |
394 | gen_image: |
395 | pusha |
395 | pusha |
396 | xor ebx,ebx ;default: kein wasser |
396 | xor ebx,ebx ;default: kein wasser |
397 | movzx eax,byte [map] ;erstes byte der map lesen (position) |
397 | movzx eax,byte [map] ;erstes byte der map lesen (position) |
398 | inc byte [map] ;position inkrementieren |
398 | inc byte [map] ;position inkrementieren |
399 | add eax,map ;zur position die map-adresse addieren |
399 | add eax,map ;zur position die map-adresse addieren |
400 | movzx esi,byte [eax] |
400 | movzx esi,byte [eax] |
401 | cmp esi,10 |
401 | cmp esi,10 |
402 | jl .nowater |
402 | jl .nowater |
403 | sub esi,10 ;map-werte+10 sind mit wasser gefuellt |
403 | sub esi,10 ;map-werte+10 sind mit wasser gefuellt |
404 | mov ebx,1 |
404 | mov ebx,1 |
405 | cmp esi,16 |
405 | cmp esi,16 |
406 | jne .nowater |
406 | jne .nowater |
407 | sub esi,10 |
407 | sub esi,10 |
408 | .nowater: |
408 | .nowater: |
409 | imul esi,3072 ;mapwert * 32*32*3 = image-adresse |
409 | imul esi,3072 ;mapwert * 32*32*3 = image-adresse |
410 | add esi,images |
410 | add esi,images |
411 | mov edi,0x10000 |
411 | mov edi,0x10000 |
412 | mov ecx,32*32*3 |
412 | mov ecx,32*32*3 |
413 | .gendd: ;RGB-Image im Speicher generieren |
413 | .gendd: ;RGB-Image im Speicher generieren |
414 | mov eax,dword [esi] ;byte aus imagemap lesen |
414 | mov eax,dword [esi] ;byte aus imagemap lesen |
415 | shl eax,8 |
415 | shl eax,8 |
416 | shr eax,8 |
416 | shr eax,8 |
417 | cmp ebx,0 |
417 | cmp ebx,0 |
418 | jz .nowcolor |
418 | jz .nowcolor |
419 | mov ebx,eax |
419 | mov ebx,eax |
420 | cmp ebx,0x00B0B5B0 |
420 | cmp ebx,0x00B0B5B0 |
421 | jne .nog1 |
421 | jne .nog1 |
422 | jmp .wcolor |
422 | jmp .wcolor |
423 | .nog1: |
423 | .nog1: |
424 | cmp ebx,0x00A0A5A0 |
424 | cmp ebx,0x00A0A5A0 |
425 | jne .nog2 |
425 | jne .nog2 |
426 | jmp .wcolor |
426 | jmp .wcolor |
427 | .nog2: |
427 | .nog2: |
428 | cmp ebx,0x00909590 |
428 | cmp ebx,0x00909590 |
429 | jne .nog3 |
429 | jne .nog3 |
430 | jmp .wcolor |
430 | jmp .wcolor |
431 | .nog3: |
431 | .nog3: |
432 | cmp ebx,0x00808580 |
432 | cmp ebx,0x00808580 |
433 | jne .nog4 |
433 | jne .nog4 |
434 | jmp .wcolor |
434 | jmp .wcolor |
435 | .nog4: |
435 | .nog4: |
436 | cmp ebx,0x00707570 |
436 | cmp ebx,0x00707570 |
437 | jne .nowcolor |
437 | jne .nowcolor |
438 | jmp .wcolor |
438 | jmp .wcolor |
439 | .wcolor: |
439 | .wcolor: |
440 | add eax,0x40 |
440 | add eax,0x40 |
441 | .nowcolor: |
441 | .nowcolor: |
442 | add esi,3 |
442 | add esi,3 |
443 | stosd |
443 | stosd |
444 | dec edi |
444 | dec edi |
445 | loop .gendd |
445 | loop .gendd |
446 | popa |
446 | popa |
447 | ret |
447 | ret |
448 | 448 | ||
449 | 449 | ||
450 | 450 | ||
451 | ; ********************************************* |
451 | ; ********************************************* |
452 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
452 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
453 | ; ********************************************* |
453 | ; ********************************************* |
454 | draw_message: |
454 | draw_message: |
455 | pusha |
455 | pusha |
456 | cmp [stat],0 |
456 | cmp [stat],0 |
457 | je .nomessage |
457 | je .nomessage |
458 | cmp [stat],3 |
458 | cmp [stat],3 |
459 | je .nomessage |
459 | je .nomessage |
460 | mov eax,13 |
460 | mov eax,13 |
461 | mov ebx,146 shl 16 + 200 |
461 | mov ebx,146 shl 16 + 200 |
462 | mov ecx,190 shl 16 + 40 |
462 | mov ecx,190 shl 16 + 40 |
463 | mov edx,0x0 |
463 | mov edx,0x0 |
464 | mcall |
464 | mcall |
465 | add ebx,2 shl 16 - 4 |
465 | add ebx,2 shl 16 - 4 |
466 | add ecx,2 shl 16 - 4 |
466 | add ecx,2 shl 16 - 4 |
467 | mov edx,fgcolor |
467 | mov edx,fgcolor |
468 | mcall |
468 | mcall |
469 | 469 | ||
470 | cmp [stat],1 |
470 | cmp [stat],1 |
471 | je .winmessage |
471 | je .winmessage |
472 | mov eax,4 |
472 | mov eax,4 |
473 | mov ebx,186 shl 16 +200 |
473 | mov ebx,186 shl 16 +200 |
474 | mov edx,lbl_gameover+1 |
474 | mov edx,lbl_gameover+1 |
475 | movzx esi,byte [lbl_gameover] |
475 | movzx esi,byte [lbl_gameover] |
476 | mov ecx,btcolor |
476 | mov ecx,btcolor |
477 | add ecx,0x10000000 |
477 | add ecx,0x10000000 |
478 | mcall |
478 | mcall |
479 | add ebx,8 shl 16 +17 |
479 | add ebx,8 shl 16 +17 |
480 | mov edx,lbl_yscore+1 |
480 | mov edx,lbl_yscore+1 |
481 | movzx esi,byte [lbl_yscore] |
481 | movzx esi,byte [lbl_yscore] |
482 | mov ecx,btcolor |
482 | mov ecx,btcolor |
483 | mcall |
483 | mcall |
484 | mov esi,ecx ;color |
484 | mov esi,ecx ;color |
485 | mov edx,ebx ;pos |
485 | mov edx,ebx ;pos |
486 | add edx,80 shl 16 |
486 | add edx,80 shl 16 |
487 | mov ebx,0x50000 ;type |
487 | mov ebx,0x50000 ;type |
488 | mov ecx,[score] ;inp |
488 | mov ecx,[score] ;inp |
489 | mov eax,47 |
489 | mov eax,47 |
490 | mcall |
490 | mcall |
491 | jmp .nomessage |
491 | jmp .nomessage |
492 | .winmessage: |
492 | .winmessage: |
493 | mov eax,4 |
493 | mov eax,4 |
494 | mov ebx,152 shl 16 +200 |
494 | mov ebx,152 shl 16 +200 |
495 | mov edx,lbl_win+1 |
495 | mov edx,lbl_win+1 |
496 | movzx esi,byte [lbl_win] |
496 | movzx esi,byte [lbl_win] |
497 | mov ecx,btcolor |
497 | mov ecx,btcolor |
498 | add ecx,0x10000000 |
498 | add ecx,0x10000000 |
499 | mcall |
499 | mcall |
500 | mov ebx,152 shl 16 +217 |
500 | mov ebx,152 shl 16 +217 |
501 | add edx,esi |
501 | add edx,esi |
502 | mov ecx,btcolor |
502 | mov ecx,btcolor |
503 | mcall |
503 | mcall |
504 | .nomessage: |
504 | .nomessage: |
505 | popa |
505 | popa |
506 | ret |
506 | ret |
507 | 507 | ||
508 | draw_board: |
508 | draw_board: |
509 | pusha |
509 | pusha |
510 | mov ebx,15*65536+32 |
510 | mov ebx,15*65536+32 |
511 | mov ecx,50*65536+32 |
511 | mov ecx,50*65536+32 |
512 | mov edx,15*65536+50 ;Spielfeldposition |
512 | mov edx,15*65536+50 ;Spielfeldposition |
513 | mov esi,10 ;Spielfeldgroesse Y |
513 | mov esi,10 ;Spielfeldgroesse Y |
514 | .vloop: |
514 | .vloop: |
515 | mov edi,14 ;Spielfeldgroesse X |
515 | mov edi,14 ;Spielfeldgroesse X |
516 | .hloop: |
516 | .hloop: |
517 | call gen_image |
517 | call gen_image |
518 | push edx |
518 | push edx |
519 | mov eax,8 |
519 | mov eax,8 |
520 | movsx edx, byte [map] |
520 | movsx edx, byte [map] |
521 | add edx,9 ;button-id = map-pos + 10;gen_image inkrements |
521 | add edx,9 ;button-id = map-pos + 10;gen_image inkrements |
522 | add edx,0x50000000 ;no button image - no esi need |
522 | add edx,0x50000000 ;no button image - no esi need |
523 | mcall |
523 | mcall |
524 | pop edx |
524 | pop edx |
525 | push ebx |
525 | push ebx |
526 | push ecx |
526 | push ecx |
527 | mov eax,7 |
527 | mov eax,7 |
528 | mov ebx,0x10000 |
528 | mov ebx,0x10000 |
529 | mov ecx,32 shl 16 +32 |
529 | mov ecx,32 shl 16 +32 |
530 | mcall |
530 | mcall |
531 | pop ecx |
531 | pop ecx |
532 | pop ebx |
532 | pop ebx |
533 | add edx,33 shl 16 |
533 | add edx,33 shl 16 |
534 | add ebx,33 shl 16 |
534 | add ebx,33 shl 16 |
535 | dec edi |
535 | dec edi |
536 | jnz .hloop |
536 | jnz .hloop |
537 | sub edx,14*(33 shl 16) ;Spielfeldgroesse X |
537 | sub edx,14*(33 shl 16) ;Spielfeldgroesse X |
538 | sub ebx,14*(33 shl 16) |
538 | sub ebx,14*(33 shl 16) |
539 | add edx,33 |
539 | add edx,33 |
540 | add ecx,33 shl 16 |
540 | add ecx,33 shl 16 |
541 | dec esi |
541 | dec esi |
542 | jnz .vloop |
542 | jnz .vloop |
543 | mov [map], byte 1 ;Map-Position zuruecksetzen |
543 | mov [map], byte 1 ;Map-Position zuruecksetzen |
544 | popa |
544 | popa |
545 | ret |
545 | ret |
546 | 546 | ||
547 | 547 | ||
548 | draw_window: |
548 | draw_window: |
549 | pusha |
549 | pusha |
550 | 550 | ||
551 | mov eax,12 ; function 12:tell os about windowdraw |
551 | mov eax,12 ; function 12:tell os about windowdraw |
552 | mov ebx,1 ; 1, start of draw |
552 | mov ebx,1 ; 1, start of draw |
553 | mcall |
553 | mcall |
554 | 554 | ||
555 | ; DRAW WINDOW |
555 | ; DRAW WINDOW |
556 | mov eax,0 ; function 0 : define and draw window |
556 | mov eax,0 ; function 0 : define and draw window |
557 | mov ebx,100*65536+492 ; [x start] *65536 + [x size] |
557 | mov ebx,100*65536+492 ; [x start] *65536 + [x size] |
558 | mov ecx,100*65536+420 ; [y start] *65536 + [y size] |
558 | mov ecx,100*65536+420 ; [y start] *65536 + [y size] |
559 | mov edx,bgcolor ; color of work area RRGGBB,8->color gl |
559 | mov edx,bgcolor ; color of work area RRGGBB,8->color gl |
560 | or edx,0x13000000 |
560 | or edx,0x14000000 |
561 | mov edi,title |
561 | mov edi,title |
562 | mcall |
562 | mcall |
563 | 563 | ||
564 | mov eax,8 |
564 | mov eax,8 |
565 | mov ebx,84*65536+72 |
565 | mov ebx,84*65536+72 |
566 | mov ecx,28*65536+15 |
566 | mov ecx,28*65536+15 |
567 | mov edx,2 |
567 | mov edx,2 |
568 | mov esi,btcolor |
568 | mov esi,btcolor |
569 | mcall |
569 | mcall |
570 | add ebx,76 shl 16 |
570 | add ebx,76 shl 16 |
571 | inc edx |
571 | inc edx |
572 | mcall |
572 | mcall |
573 | add ebx,76 shl 16 |
573 | add ebx,76 shl 16 |
574 | inc edx |
574 | inc edx |
575 | mcall |
575 | mcall |
576 | 576 | ||
577 | mov eax,4 |
577 | mov eax,4 |
578 | mov ebx,26 shl 16 +32 |
578 | mov ebx,26 shl 16 +32 |
579 | mov ecx,fgcolor |
579 | mov ecx,fgcolor |
580 | mov edx,lbl_toolbar+1 |
580 | mov edx,lbl_toolbar+1 |
581 | movsx esi, byte [lbl_toolbar] |
581 | movsx esi, byte [lbl_toolbar] |
582 | mcall |
582 | mcall |
583 | mov ebx,18 shl 16 +398 |
583 | mov ebx,18 shl 16 +398 |
584 | mov edx,lbl_score+1 |
584 | mov edx,lbl_score+1 |
585 | movsx esi, byte [lbl_score] |
585 | movsx esi, byte [lbl_score] |
586 | mcall |
586 | mcall |
587 | mov ebx,350 shl 16 +405 |
587 | mov ebx,350 shl 16 +405 |
588 | mov ecx,fg3color |
588 | mov ecx,fg3color |
589 | mov edx,lbl_copy+1 |
589 | mov edx,lbl_copy+1 |
590 | movsx esi,byte [lbl_copy] |
590 | movsx esi,byte [lbl_copy] |
591 | mcall |
591 | mcall |
592 | 592 | ||
593 | mov eax,12 ; function 12:tell os about windowdraw |
593 | mov eax,12 ; function 12:tell os about windowdraw |
594 | mov ebx,2 ; 2, end of draw |
594 | mov ebx,2 ; 2, end of draw |
595 | mcall |
595 | mcall |
596 | 596 | ||
597 | popa |
597 | popa |
598 | ret |
598 | ret |
599 | 599 | ||
600 | 600 | ||
601 | ; DATA AREA |
601 | ; DATA AREA |
602 | 602 | ||
603 | 603 | ||
604 | title db 'PIPES',0 |
604 | title db 'PIPES',0 |
605 | lbl_gameover: |
605 | lbl_gameover: |
606 | db 19 |
606 | db 19 |
607 | db 'G a m e O v e r !' |
607 | db 'G a m e O v e r !' |
608 | lbl_win: |
608 | lbl_win: |
609 | db 32 |
609 | db 32 |
610 | db ' G r e a t ! ' |
610 | db ' G r e a t ! ' |
611 | db " Let's goin'on! " |
611 | db " Let's goin'on! " |
612 | lbl_yscore: |
612 | lbl_yscore: |
613 | db 11 |
613 | db 11 |
614 | db 'Your Score:' |
614 | db 'Your Score:' |
615 | lbl_toolbar: |
615 | lbl_toolbar: |
616 | db 43 |
616 | db 43 |
617 | db 'New Game: Easy Moderate Hard' |
617 | db 'New Game: Easy Moderate Hard' |
618 | lbl_copy: |
618 | lbl_copy: |
619 | db 23 |
619 | db 23 |
620 | db 'v1.2 2006,Mario Birkner' |
620 | db 'v1.2 2006,Mario Birkner' |
621 | lbl_score: |
621 | lbl_score: |
622 | db 28 |
622 | db 28 |
623 | db 'Time: Score: Level:' |
623 | db 'Time: Score: Level:' |
624 | stat db 3 ;0=gameplay 1=won 2-lost 3=stopped |
624 | stat db 3 ;0=gameplay 1=won 2-lost 3=stopped |
625 | speed db 0 |
625 | speed db 0 |
626 | time dd 0 |
626 | time dd 0 |
627 | diffic db 0 ;1=hard 3=moderate 5=easy 8=dedicated to Wildwest - try it out! |
627 | diffic db 0 ;1=hard 3=moderate 5=easy 8=dedicated to Wildwest - try it out! |
628 | score dd 0 |
628 | score dd 0 |
629 | level dd 1 |
629 | level dd 1 |
630 | half db 1 ;reduces the random-crosses |
630 | half db 1 ;reduces the random-crosses |
631 | 631 | ||
632 | map: ;14*10 blocks + position |
632 | map: ;14*10 blocks + position |
633 | db 1 ;<- act. position |
633 | db 1 ;<- act. position |
634 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
634 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
635 | db 9,7,1,3,2,0,1,1,0,3,4,4,3,9 |
635 | db 9,7,1,3,2,0,1,1,0,3,4,4,3,9 |
636 | db 9,5,0,2,2,1,3,0,3,1,1,6,4,9 |
636 | db 9,5,0,2,2,1,3,0,3,1,1,6,4,9 |
637 | db 9,4,0,4,6,0,3,3,2,6,0,1,2,9 |
637 | db 9,4,0,4,6,0,3,3,2,6,0,1,2,9 |
638 | db 9,3,0,1,2,4,6,4,5,1,2,4,1,9 |
638 | db 9,3,0,1,2,4,6,4,5,1,2,4,1,9 |
639 | db 9,5,3,2,6,3,2,1,2,1,2,6,0,9 |
639 | db 9,5,3,2,6,3,2,1,2,1,2,6,0,9 |
640 | db 9,4,0,2,3,0,4,1,2,3,2,3,4,9 |
640 | db 9,4,0,2,3,0,4,1,2,3,2,3,4,9 |
641 | db 9,2,0,4,5,6,3,1,3,0,4,1,0,9 |
641 | db 9,2,0,4,5,6,3,1,3,0,4,1,0,9 |
642 | db 9,1,0,3,5,4,2,2,4,1,6,0,8,9 |
642 | db 9,1,0,3,5,4,2,2,4,1,6,0,8,9 |
643 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
643 | db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
644 | images: |
644 | images: |
645 | file 'pipes.raw' |
645 | file 'pipes.raw' |
646 | I_END:->> |
646 | I_END:->> |