Rev 6024 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6024 | Rev 7468 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | dd 0x01 ; header version |
13 | dd 0x01 ; header version |
14 | dd START ; start of code |
14 | dd START ; start of code |
15 | dd IM_END ; size of image |
15 | dd IM_END ; size of image |
16 | dd 0x300000 ; memory for app |
16 | dd 0x300000 ; memory for app |
17 | dd 0x300000 ; esp |
17 | dd 0x300000 ; esp |
18 | dd temp_area, 0x0 ; I_Param , I_Path |
18 | dd 0x0, 0x0 ; I_Param , I_Path |
Line 19... | Line 19... | ||
19 | 19 | ||
Line 20... | Line 20... | ||
20 | ;****************************************************************************** |
20 | ;****************************************************************************** |
21 | 21 | ||
22 | include '..\..\..\macros.inc' |
22 | include '..\..\..\macros.inc' |
23 | include 'ascl.inc' |
23 | include 'ascl.inc' |
Line -... | Line 24... | ||
- | 24 | include 'ascgl.inc' |
|
- | 25 | include 'ascgml.inc' |
|
Line 24... | Line -... | ||
24 | include 'ascgl.inc' |
- | |
25 | include 'ascgml.inc' |
- | |
Line -... | Line 26... | ||
- | 26 | ||
26 | 27 | AREA_W = 640 |
|
27 | 28 | AREA_H = 480 |
|
28 | START: ; start of execution |
29 | |
29 | call draw_window |
30 | |
30 | 31 | START: ; start of execution |
|
31 | convbmp pongfile, tsoi |
32 | convbmp pongfile, tsoi |
32 | bmptoimg pongfile, tsoi,pong |
33 | bmptoimg pongfile, tsoi,pong |
- | 34 | getimg pong, 0, 0, 80, 4, img |
|
33 | getimg pong, 0, 0, 80, 4, img |
35 | getimg pong, 0, 4, 80, 4, img2 |
Line 34... | Line 36... | ||
34 | getimg pong, 0, 4, 80, 4, img2 |
36 | getimg pong, 5, 38, 15, 15, img3 |
35 | getimg pong, 5, 38, 15, 15, img3 |
37 | getimg pong, 0, 10, 80, 20, img5 |
Line 36... | Line 38... | ||
36 | getimg pong, 0, 8, 80, 20, img5 |
38 | fullimg imgbr, 80, 4, 0x00000000 ;black for rocket |
37 | fullimg img4, 80 ,20 ,0x00000000 ;black for rocket |
39 | fullimg imgbg, 80, 20, 0x00000000 ;black for grav |
38 | fullimg img6, 15 ,15 ,0x00000000 ;black for ball |
40 | fullimg imgbb, 12, 12, 0x00000000 ;black for ball |
39 | 41 | ||
Line -... | Line 42... | ||
- | 42 | still: |
|
40 | still: |
43 | scevent red,key,button |
41 | scevent red,key,button |
44 | |
42 | - | ||
43 | ;mcall 48, 4 ;get skin width |
45 | ;mcall 48, 4 ;get skin height |
44 | ;sub [skin_h], 16 |
46 | ;sub [skin_h], 16 |
- | 47 | ;div eax, 2 |
|
45 | ;div eax, 2 |
48 | ;mov [skin_h], eax |
46 | ;mov [skin_h], eax |
49 | |
47 | 50 | remember_old_coordinates: |
|
Line 48... | Line 51... | ||
48 | outcount [scoreb], 300, 4, 0x10000000 + cl_Blue, 5 shl 16 |
51 | m2m [ply1x_old], [ply1x] |
49 | outcount [scorea], 350, 4, 0x10000000 + cl_Red, 5 shl 16 |
52 | m2m [ply1y_old], [ply1y] |
50 | 53 | m2m [ply2x_old], [ply2x] |
|
Line 82... | Line 85... | ||
82 | jng by_n |
85 | jng by_n |
83 | dec [ballyv] |
86 | dec [ballyv] |
84 | by_n: |
87 | by_n: |
Line 85... | Line 88... | ||
85 | 88 | ||
86 | ;ball collusion of screen |
89 | ;ball collusion of screen |
87 | cmp [ballx], 640-32 |
90 | cmp [ballx], AREA_W-12 |
88 | jna xa_ok |
91 | jna xa_ok |
89 | neg [ballxv] |
92 | neg [ballxv] |
90 | xa_ok: |
93 | xa_ok: |
91 | cmp [ballx], 6 |
94 | cmp [ballx], 6 |
92 | jnb xb_ok |
95 | jnb xb_ok |
93 | neg [ballxv] |
96 | neg [ballxv] |
Line 94... | Line 97... | ||
94 | xb_ok: |
97 | xb_ok: |
95 | 98 | ||
96 | ;if ball far out of screen come back |
99 | ;if ball far out of screen come back |
97 | ; is not work already |
100 | ; is not work already |
98 | cmp [bally], 466 |
- | |
99 | jng yax_ok |
101 | cmp [bally], AREA_H-30 ;check RED fails |
- | 102 | jng yax_ok |
|
100 | call draw_window |
103 | inc [scoreb] |
101 | inc [scoreb] |
104 | call draw_score |
102 | mov [bally], 240 |
105 | mov [bally], 240 |
103 | mov [ballx], 310 |
106 | mov [ballx], 310 |
104 | mov [ballyv], 2 |
107 | mov [ballyv], 2 |
105 | random 5, [ballxv] |
108 | random 5, [ballxv] |
106 | sub [ballxv], 2 |
109 | sub [ballxv], 2 |
107 | yax_ok: |
110 | yax_ok: |
108 | cmp [bally], 30 |
- | |
109 | jnl yax_ok2 |
111 | cmp [bally], 0 ;check BLUE fails |
- | 112 | jnl yax_ok2 |
|
110 | call draw_window |
113 | inc [scorea] |
111 | inc [scorea] |
114 | call draw_score |
112 | mov [bally], 240 |
115 | mov [bally], 240 |
113 | mov [ballx], 310 |
116 | mov [ballx], 310 |
114 | mov [ballyv], 2 |
117 | mov [ballyv], 2 |
Line 238... | Line 241... | ||
238 | nograv: |
241 | nograv: |
239 | mov [gravx], 1000 |
242 | mov [gravx], 1000 |
240 | mov [gravy], 1000 |
243 | mov [gravy], 1000 |
241 | endgrav: |
244 | endgrav: |
Line -... | Line 245... | ||
- | 245 | ||
- | 246 | ;next code checks were coordinates of player1 and player2 |
|
- | 247 | ;changed or not |
|
- | 248 | ; if yes => fill old |
|
242 | 249 | ; if no => do not fill old |
|
- | 250 | redraw_images: |
|
- | 251 | ;player1 |
|
- | 252 | ;if (ply1x!=ply1x_old) || (ply1y!=ply1y_old) fill1 |
|
- | 253 | mov eax, [ply1x] |
|
- | 254 | cmp [ply1x_old], eax |
|
- | 255 | jne fill1 |
|
- | 256 | mov eax, [ply1y] |
|
- | 257 | cmp [ply1y_old],eax |
|
- | 258 | jne fill1 |
|
- | 259 | jmp no_fill1 |
|
- | 260 | fill1: |
|
- | 261 | setimg [ply1x_old], [ply1y_old], imgbr |
|
243 | redraw_images: |
262 | no_fill1: |
- | 263 | setimg [ply1x], [ply1y], img |
|
- | 264 | ||
- | 265 | ;player2 |
|
- | 266 | ;if (ply2x!=ply2x_old) || (ply2y!=ply2y_old) fill2 |
|
- | 267 | mov eax, [ply2x] |
|
- | 268 | cmp [ply2x_old], eax |
|
- | 269 | jne fill2 |
|
- | 270 | mov eax, [ply2y] |
|
- | 271 | cmp [ply2y_old],eax |
|
- | 272 | jne fill2 |
|
- | 273 | jmp no_fill2 |
|
- | 274 | fill2: |
|
- | 275 | setimg [ply2x_old], [ply2y_old], imgbr |
|
244 | setimg [ply1x], [ply1y], img |
276 | no_fill2: |
- | 277 | setimg [ply2x], [ply2y], img2 |
|
- | 278 | ||
- | 279 | ;ball |
|
245 | setimg [ply2x], [ply2y], img2 |
280 | setimg [ballx_old], [bally_old], imgbb |
- | 281 | setimg [ballx], [bally], img3 |
|
- | 282 | ||
- | 283 | ;grav |
|
246 | setimg [ballx], [bally], img3 |
284 | setimg [gravx_old], [gravy_old], imgbg |
Line 247... | Line 285... | ||
247 | setimg [gravx], [gravy], img5 |
285 | setimg [gravx], [gravy], img5 |
Line 248... | Line 286... | ||
248 | 286 | ||
Line 266... | Line 304... | ||
266 | add [ply1rx], 32 ;16 |
304 | add [ply1rx], 32 ;16 |
267 | no_r: |
305 | no_r: |
268 | cmp ah, key_Up |
306 | cmp ah, key_Up |
269 | jne no_u |
307 | jne no_u |
270 | sub [ply1ry], 16 |
308 | sub [ply1ry], 16 |
- | 309 | cmp [ply1ry], 0 |
|
- | 310 | jb no_u |
|
- | 311 | mov [ply1ry], 0 |
|
271 | no_u: |
312 | no_u: |
272 | cmp ah, key_Down |
313 | cmp ah, key_Down |
273 | jne no_d |
314 | jne no_d |
274 | add [ply1ry], 16 |
315 | add [ply1ry], 16 |
- | 316 | cmp [ply1ry], AREA_H-50 |
|
- | 317 | jl no_d |
|
- | 318 | mov [ply1ry], AREA_H-50 |
|
275 | no_d: |
319 | no_d: |
276 | cmp ah, key_Space |
320 | cmp ah, key_Space |
277 | jne no_sp |
321 | jne no_sp |
278 | mov [gravtime], 100 |
322 | mov [gravtime], 100 |
279 | no_sp: |
323 | no_sp: |
Line 280... | Line 324... | ||
280 | 324 | ||
Line 281... | Line 325... | ||
281 | jmp still |
325 | jmp still |
282 | 326 | ||
283 | button: ; button |
- | |
284 | mov eax, 17 ; get id |
327 | button: |
285 | mcall |
328 | mcall 17 ; get id |
286 | cmp ah, 1 ; button id=1 ? |
329 | cmp ah, 1 ; button id=1 ? |
287 | jne noclose |
- | |
288 | mov eax, -1 ; close this program |
330 | jne noclose |
289 | mcall |
331 | mcall -1 ; close this program |
Line 290... | Line 332... | ||
290 | noclose: |
332 | noclose: |
291 | jmp still |
333 | jmp still |
292 | 334 | ||
293 | 335 | ||
294 | draw_window: |
- | |
Line -... | Line 336... | ||
- | 336 | draw_window: |
|
- | 337 | mcall 12,1 ;start window redraw |
|
- | 338 | mcall 0, <10, AREA_W+5+9>, <10, 480+35>, 0x34000000,, wtitle |
|
- | 339 | mcall 12,2 ;end window redraw |
|
- | 340 | ||
Line 295... | Line 341... | ||
295 | mcall 12,1 ;start window redraw |
341 | draw_score: |
296 | mcall 0, <10, 640+8>, <10, 480+24>, 0x14000000,, wtitle |
342 | mcall 13, <10, 100>, |
297 | mcall 12,2 ;end window redraw |
343 | outcount [scoreb], 10, AREA_H-17, 0x01000000 + cl_Blue, 3 shl 16 |
Line -... | Line 344... | ||
- | 344 | outcount [scorea], 50, AREA_H-17, 0x01000000 + cl_Red, 3 shl 16 |
|
- | 345 | ret |
|
- | 346 | ||
- | 347 | ; DATA AREA |
|
- | 348 | wtitle db 'PONG: use Arrow Keys and Space',0 |
|
- | 349 | ;skin_h dd 25 |
|
- | 350 | ||
- | 351 | ply1x_old dd ? |
|
- | 352 | ply1y_old dd ? |
|
298 | ret |
353 | ply2x_old dd ? |
299 | 354 | ply2y_old dd ? |
|
Line 300... | Line 355... | ||
300 | 355 | gravx_old dd ? |
|
301 | ; DATA AREA |
356 | gravy_old dd ? |
302 | wtitle db 'PONG: USE ARROW KEYS SCORE:',0 |
357 | ballx_old dd ? |
Line 303... | Line 358... | ||
303 | ;skin_h dd 25 |
358 | bally_old dd ? |
304 | 359 | ||
Line 305... | Line 360... | ||
305 | xt dd 100 |
360 | xt dd 100 |
306 | yt dd 100 |
361 | yt dd 100 |
Line 307... | Line 362... | ||
307 | 362 | ||
308 | gravtime dd 10 |
363 | gravtime dd 10 |
Line 309... | Line 364... | ||
309 | gravx dd 1000 |
364 | gravx dd 1000 |
Line 334... | Line 389... | ||
334 | 389 | ||
Line 335... | Line 390... | ||
335 | IM_END: |
390 | IM_END: |
Line -... | Line 391... | ||
- | 391 | ||
336 | 392 | temp rb 20000 |
|
337 | temp rb 20000 |
393 | |
338 | 394 | ;real images |
|
339 | pong rb 80*60*3+8 |
395 | pong rb 80*60*3+8 |
340 | img rb 32*32*3+8 |
- | |
341 | img2 rb 32*32*3+8 |
396 | img rb 32*32*3+8 |
342 | img3 rb 32*32*3+8 |
- | |
Line -... | Line 397... | ||
- | 397 | img2 rb 32*32*3+8 |
|
- | 398 | img3 rb 32*32*3+8 |
|
- | 399 | img5 rb 32*32*3+8 |
|
343 | img4 rb 80*20*3+8 |
400 | |
Line 344... | Line 401... | ||
344 | img5 rb 32*32*3+8 |
401 | ;black to clean old images |