Subversion Repositories Kolibri OS

Rev

Rev 2066 | Rev 7458 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2066 Rev 2683
1
VERSION equ 'ARCANOID II v. 0.30'
-
 
2
;               by jj
1
;               by jj
3
;        (jacek jerzy malinowski)
2
;        (jacek jerzy malinowski)
4
;
3
;
5
;   contact: 4nic8@casiocalc.org
4
;   contact: 4nic8@casiocalc.org
6
;----------------------------------------
5
;----------------------------------------
7
;   Compile with FASM for Menuet
-
 
8
;----------------------------------------
-
 
9
 
6
 
10
include 'lang.inc'
7
include 'lang.inc'
11
include '../../../macros.inc'
8
include '../../../macros.inc'
12
include 'ascl.inc'
9
include 'ascl.inc'
13
include 'ascgl.inc'
10
include 'ascgl.inc'
14
include 'asjc.inc'
11
include 'asjc.inc'
15
 
12
 
16
X_SIZE equ 400
13
X_SIZE equ 400
17
Y_SIZE equ 300
14
Y_SIZE equ 300
18
 
15
 
19
MAX_LEVEL equ 5
16
MAX_LEVEL equ 5
20
 
17
 
21
BACK_CL equ 0x00EFEF ; background color
18
BACK_CL equ 0x00EFEF ; background color
22
 
19
 
23
;    THE MAIN PROGRAM:
20
;    THE MAIN PROGRAM:
24
use32
21
use32
25
 
22
 
26
               org    0x0
23
               org    0x0
27
 
24
 
28
               db     'MENUET01'              ; 8 byte id
25
               db     'MENUET01'              ; 8 byte id
29
               dd     0x01                    ; header version
26
               dd     0x01                    ; header version
30
               dd     START                   ; start of code
27
               dd     START                   ; start of code
31
               dd     I_END                   ; size of image
28
               dd     I_END                   ; size of image
32
               dd     0x200000                ; memory for app
29
               dd     0x200000                ; memory for app
33
               dd     0x7fff0                 ; esp
30
               dd     0x7fff0                 ; esp
34
               dd     0x0 , 0x0               ; I_Param , I_Icon
31
               dd     0x0 , 0x0               ; I_Param , I_Icon
35
 
32
 
36
START:                          ; start of execution
33
START:                          ; start of execution
37
 
34
 
38
    bmptoimg bmp_file,img_bmp   ; loading ... ;]
35
    bmptoimg bmp_file,img_bmp   ; loading ... ;]
39
    getimg img_bmp,0,0,10,10,img_ball
36
    getimg img_bmp,0,0,10,10,img_ball
40
    getimg img_bmp,20,0,20,10,img_bonus
37
    getimg img_bmp,20,0,20,10,img_bonus
41
    getimg img_bmp,0,10,40,20,img_brick1
38
    getimg img_bmp,0,10,40,20,img_brick1
42
    getimg img_bmp,0,30,40,20,img_brick2
39
    getimg img_bmp,0,30,40,20,img_brick2
43
    getimg img_bmp,0,50,40,20,img_brick3
40
    getimg img_bmp,0,50,40,20,img_brick3
44
    getimg img_bmp,0,70,40,20,img_brick4
41
    getimg img_bmp,0,70,40,20,img_brick4
45
 
42
 
46
    call draw_window
43
    call draw_window
47
 
44
 
48
still:
45
still:
49
    cmp  [is_rolled_up], 1
46
    cmp  [is_rolled_up], 1
50
    jne  @f
47
    jne  @f
51
    jmp  .no_game
48
    jmp  .no_game
52
  @@:
49
  @@:
53
 
50
 
54
    if_e dword [level],0,.no_intro
51
    if_e dword [level],0,.no_intro
55
       call intro
52
       call intro
56
       jmp .no_game
53
       jmp .no_game
57
    .no_intro:
54
    .no_intro:
58
 
55
 
59
    if_e dword [mode],2,.end_if1
56
    if_e dword [mode],2,.end_if1
60
       call level_info
57
       call level_info
61
       jmp .no_game
58
       jmp .no_game
62
    .end_if1:
59
    .end_if1:
63
 
60
 
64
    if_e dword [mode],4,.end_if2
61
    if_e dword [mode],4,.end_if2
65
       call game_over
62
       call game_over
66
       jmp .no_game
63
       jmp .no_game
67
    .end_if2:
64
    .end_if2:
68
 
65
 
69
    call fast_gfx ; <-- the main engine
66
    call fast_gfx ; <-- the main engine
70
    .no_game:
67
    .no_game:
71
 
68
 
72
    mov  eax,11
69
    mov  eax,11
73
    mcall
70
    mcall
74
 
71
 
75
    cmp  eax,1                  ; redraw request ?
72
    cmp  eax,1                  ; redraw request ?
76
    je   red
73
    je   red
77
    cmp  eax,2                  ; key in buffer ?
74
    cmp  eax,2                  ; key in buffer ?
78
    je   key
75
    je   key
79
    cmp  eax,3                  ; button in buffer ?
76
    cmp  eax,3                  ; button in buffer ?
80
    je   button
77
    je   button
81
 
78
 
82
    jmp  still
79
    jmp  still
83
 
80
 
84
  red:                          ; redraw
81
  red:                          ; redraw
85
    mov  [is_rolled_up], 0
82
    mov  [is_rolled_up], 0
86
    mcall 9,proc_info,-1
83
    mcall 9,proc_info,-1
87
    test [proc_info+process_information.wnd_state], 0x04
84
    test [proc_info+process_information.wnd_state], 0x04
88
    jz   @f
85
    jz   @f
89
    mov  [is_rolled_up], 1
86
    mov  [is_rolled_up], 1
90
  @@:
87
  @@:
91
    call draw_window
88
    call draw_window
92
    jmp  still
89
    jmp  still
93
 
90
 
94
  key:                          ; key
91
  key:                          ; key
95
    mov  eax,2                  ; just read it and ignore
92
    mov  eax,2                  ; just read it and ignore
96
    mcall
93
    mcall
97
    cmp  ah,key_Esc ; if Esc ?
94
    cmp  ah,key_Esc ; if Esc ?
98
    jne  .no_q
95
    jne  .no_q
99
      or eax,-1
96
      or eax,-1
100
      mcall
97
      mcall
101
    .no_q:
98
    .no_q:
102
 
99
 
103
    if_e dword [mode],4,.end_if6
100
    if_e dword [mode],4,.end_if6
104
       jmp still
101
       jmp still
105
    .end_if6:
102
    .end_if6:
106
 
103
 
107
    cmp  ah,key_Space
104
    cmp  ah,key_Space
108
    jne  .no_space
105
    jne  .no_space
109
      if_e dword [mode],2,.end_if1
106
      if_e dword [mode],2,.end_if1
110
         mov dword [mode],0
107
         mov dword [mode],0
111
         jmp .no_space
108
         jmp .no_space
112
      .end_if1:
109
      .end_if1:
113
      mov dword [mode],1
110
      mov dword [mode],1
114
      call fast_gfx
111
      call fast_gfx
115
    .no_space:
112
    .no_space:
116
    xor ebx,ebx
113
    xor ebx,ebx
117
    mov bl,ah
114
    mov bl,ah
118
    if_e ebx,key_F1,.no_f1
115
    if_e ebx,key_F1,.no_f1
119
      inc dword [del]
116
      inc dword [del]
120
    .no_f1:
117
    .no_f1:
121
    if_e ebx,key_F2,.no_f2
118
    if_e ebx,key_F2,.no_f2
122
      if_a dword [del],0,.end_if3
119
      if_a dword [del],0,.end_if3
123
         dec dword [del]
120
         dec dword [del]
124
      .end_if3:
121
      .end_if3:
125
    .no_f2:
122
    .no_f2:
126
 
123
 
127
 
124
 
128
    jmp  still
125
    jmp  still
129
 
126
 
130
  button:                       ; button
127
  button:                       ; button
131
    mov  eax,17                 ; get id
128
    mov  eax,17                 ; get id
132
    mcall
129
    mcall
133
 
130
 
134
    cmp  ah,1                   ; button id=1 ?
131
    cmp  ah,1                   ; button id=1 ?
135
    jne  noclose
132
    jne  noclose
136
 
133
 
137
    mov  eax,-1                 ; close this program
134
    mov  eax,-1                 ; close this program
138
    mcall
135
    mcall
139
  noclose:
136
  noclose:
140
 
137
 
141
    jmp  still
138
    jmp  still
142
 
139
 
143
;   *********************************************
140
;   *********************************************
144
;   ******* VIRTUAL SCREEN FUNCTIONS ************
141
;   ******* VIRTUAL SCREEN FUNCTIONS ************
145
;   *********************************************
142
;   *********************************************
146
 
143
 
147
show_screen:  ; flips the virtual screen to the window
144
show_screen:  ; flips the virtual screen to the window
148
    push_abc
145
    push_abc
149
 
146
 
150
    mov  eax,7
147
    mov  eax,7
151
    mov  ebx,screen
148
    mov  ebx,screen
152
    mov  ecx,X_SIZE*65536+Y_SIZE
149
    mov  ecx,X_SIZE*65536+Y_SIZE
153
    mov  edx,4*65536+20
150
    mov  edx,4*65536+20
154
    mcall
151
    mcall
155
 
152
 
156
    pop_abc
153
    pop_abc
157
ret
154
ret
158
 
155
 
159
put_bmp_screen: ; eax - y , ebx - x, esi - bmp
156
put_bmp_screen: ; eax - y , ebx - x, esi - bmp
160
    cmp ebx,X_SIZE-5
157
    cmp ebx,X_SIZE-5
161
    jb .ok1
158
    jb .ok1
162
      ret
159
      ret
163
    .ok1:
160
    .ok1:
164
    cmp eax,Y_SIZE-5
161
    cmp eax,Y_SIZE-5
165
    jb .ok2
162
    jb .ok2
166
      ret
163
      ret
167
    .ok2:
164
    .ok2:
168
 
165
 
169
    push_abc
166
    push_abc
170
    xor  ecx,ecx
167
    xor  ecx,ecx
171
    xor  edx,edx
168
    xor  edx,edx
172
    mov  edi,screen
169
    mov  edi,screen
173
    mov  ecx,3
170
    mov  ecx,3
174
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
171
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
175
    mov  ecx,X_SIZE
172
    mov  ecx,X_SIZE
176
    mul  ecx
173
    mul  ecx
177
    push eax ; #> 1
174
    push eax ; #> 1
178
    mov  eax,ebx
175
    mov  eax,ebx
179
    mov  ecx,3
176
    mov  ecx,3
180
    mul  ecx
177
    mul  ecx
181
    mov  ebx,eax
178
    mov  ebx,eax
182
    pop  edx ; #< 1
179
    pop  edx ; #< 1
183
    add  edx,ebx
180
    add  edx,ebx
184
    add  edi,edx ; sets the pointer to x,y of the screen
181
    add  edi,edx ; sets the pointer to x,y of the screen
185
 
182
 
186
    mov  cx,[si] ; loops 1
183
    mov  cx,[si] ; loops 1
187
    xor  ebx,ebx
184
    xor  ebx,ebx
188
    mov  ax,cx
185
    mov  ax,cx
189
    mov  dx,3
186
    mov  dx,3
190
    mul  dx
187
    mul  dx
191
    mov  bx,ax
188
    mov  bx,ax
192
 
189
 
193
    push ebx ;#>4
190
    push ebx ;#>4
194
 
191
 
195
    add  si,4
192
    add  si,4
196
    mov  ax,[si] ; loops 2
193
    mov  ax,[si] ; loops 2
197
    mov  cx,[si]
194
    mov  cx,[si]
198
    ;shr  ax,2
195
    ;shr  ax,2
199
    mov  dx,3   ; dx = ax *3
196
    mov  dx,3   ; dx = ax *3
200
    mul  dx
197
    mul  dx
201
    mov  bx,ax
198
    mov  bx,ax
202
    add  si,4
199
    add  si,4
203
 
200
 
204
 
201
 
205
    pop  ebx ;#<4
202
    pop  ebx ;#<4
206
    .l_y:
203
    .l_y:
207
       mov ax,cx
204
       mov ax,cx
208
       cld
205
       cld
209
       mov  cx,bx
206
       mov  cx,bx
210
       rep movs byte [edi],[esi]
207
       rep movs byte [edi],[esi]
211
       add edi,X_SIZE
208
       add edi,X_SIZE
212
       add edi,X_SIZE
209
       add edi,X_SIZE
213
       add edi,X_SIZE
210
       add edi,X_SIZE
214
       sub edi,ebx
211
       sub edi,ebx
215
       mov cx,ax
212
       mov cx,ax
216
    loop .l_y
213
    loop .l_y
217
 
214
 
218
    pop_abc
215
    pop_abc
219
ret
216
ret
220
 
217
 
221
rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color
218
rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color
222
    mov edi,ebx
219
    mov edi,ebx
223
    add ebx,ecx
220
    add ebx,ecx
224
    cmp ebx,X_SIZE
221
    cmp ebx,X_SIZE
225
    jb .ok1
222
    jb .ok1
226
      ret
223
      ret
227
    .ok1:
224
    .ok1:
228
    mov ebx,edi
225
    mov ebx,edi
229
 
226
 
230
    mov edi,eax
227
    mov edi,eax
231
    add eax,edx
228
    add eax,edx
232
    cmp eax,Y_SIZE
229
    cmp eax,Y_SIZE
233
    jb .ok2
230
    jb .ok2
234
      ret
231
      ret
235
    .ok2:
232
    .ok2:
236
    mov eax,edi
233
    mov eax,edi
237
    push_abc
234
    push_abc
238
    push ecx  ;#>2
235
    push ecx  ;#>2
239
    push edx  ;#>3
236
    push edx  ;#>3
240
 
237
 
241
    xor  ecx,ecx
238
    xor  ecx,ecx
242
    xor  edx,edx
239
    xor  edx,edx
243
    mov  edi,screen
240
    mov  edi,screen
244
    mov  ecx,3
241
    mov  ecx,3
245
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
242
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
246
    mov  ecx,X_SIZE
243
    mov  ecx,X_SIZE
247
    mul  ecx
244
    mul  ecx
248
    push eax ; #> 1
245
    push eax ; #> 1
249
    mov  eax,ebx
246
    mov  eax,ebx
250
    mov  ecx,3
247
    mov  ecx,3
251
    mul  ecx
248
    mul  ecx
252
    mov  ebx,eax
249
    mov  ebx,eax
253
    pop  edx ; #< 1
250
    pop  edx ; #< 1
254
    add  edx,ebx
251
    add  edx,ebx
255
 
252
 
256
    add  edi,edx ; sets the pointer to x,y of the screen
253
    add  edi,edx ; sets the pointer to x,y of the screen
257
 
254
 
258
    pop ecx ; #<3
255
    pop ecx ; #<3
259
    pop edx ; #<4
256
    pop edx ; #<4
260
    mov  eax,esi
257
    mov  eax,esi
261
    .l_y:
258
    .l_y:
262
       ;mov ax,cx
259
       ;mov ax,cx
263
       push  ecx
260
       push  ecx
264
       cld
261
       cld
265
       mov  ecx,edx
262
       mov  ecx,edx
266
       .l_x:
263
       .l_x:
267
         ;rep movs byte [edi],[esi]
264
         ;rep movs byte [edi],[esi]
268
         mov  word [edi],ax
265
         mov  word [edi],ax
269
         push eax
266
         push eax
270
         shr  eax,16
267
         shr  eax,16
271
         mov  byte [edi+2],al
268
         mov  byte [edi+2],al
272
         add  edi,3
269
         add  edi,3
273
         pop  eax
270
         pop  eax
274
       loop .l_x
271
       loop .l_x
275
 
272
 
276
       add edi,X_SIZE
273
       add edi,X_SIZE
277
       add edi,X_SIZE
274
       add edi,X_SIZE
278
       add edi,X_SIZE
275
       add edi,X_SIZE
279
       sub edi,edx
276
       sub edi,edx
280
       sub edi,edx
277
       sub edi,edx
281
       sub edi,edx
278
       sub edi,edx
282
       ;mov cx,ax
279
       ;mov cx,ax
283
       pop  ecx
280
       pop  ecx
284
    loop .l_y
281
    loop .l_y
285
 
282
 
286
    pop_abc
283
    pop_abc
287
ret
284
ret
288
 
285
 
289
grad_rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color, d
286
grad_rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color, d
290
    push edi  ;#>0
287
    push edi  ;#>0
291
    mov edi,ebx
288
    mov edi,ebx
292
    add ebx,ecx
289
    add ebx,ecx
293
    cmp ebx,X_SIZE
290
    cmp ebx,X_SIZE
294
    jb .ok1
291
    jb .ok1
295
      pop edi ;#<0
292
      pop edi ;#<0
296
      ret
293
      ret
297
    .ok1:
294
    .ok1:
298
    mov ebx,edi
295
    mov ebx,edi
299
 
296
 
300
    mov edi,eax
297
    mov edi,eax
301
    add eax,edx
298
    add eax,edx
302
    cmp eax,Y_SIZE
299
    cmp eax,Y_SIZE
303
    jb .ok2
300
    jb .ok2
304
      pop edi ;#<0
301
      pop edi ;#<0
305
      ret
302
      ret
306
    .ok2:
303
    .ok2:
307
    mov eax,edi
304
    mov eax,edi
308
 
305
 
309
    pop edi ;#<0
306
    pop edi ;#<0
310
    push_abc
307
    push_abc
311
 
308
 
312
    push edi  ;#>5
309
    push edi  ;#>5
313
    push ecx  ;#>2
310
    push ecx  ;#>2
314
    push edx  ;#>3
311
    push edx  ;#>3
315
 
312
 
316
    xor  ecx,ecx
313
    xor  ecx,ecx
317
    xor  edx,edx
314
    xor  edx,edx
318
    mov  edi,screen
315
    mov  edi,screen
319
    mov  ecx,3
316
    mov  ecx,3
320
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
317
    mul  ecx  ; xx = 3*y*X_SIZE+3*x
321
    mov  ecx,X_SIZE
318
    mov  ecx,X_SIZE
322
    mul  ecx
319
    mul  ecx
323
    push eax ; #> 1
320
    push eax ; #> 1
324
    mov  eax,ebx
321
    mov  eax,ebx
325
    mov  ecx,3
322
    mov  ecx,3
326
    mul  ecx
323
    mul  ecx
327
    mov  ebx,eax
324
    mov  ebx,eax
328
    pop  edx ; #< 1
325
    pop  edx ; #< 1
329
    add  edx,ebx
326
    add  edx,ebx
330
 
327
 
331
    add  edi,edx ; sets the pointer to x,y of the screen
328
    add  edi,edx ; sets the pointer to x,y of the screen
332
 
329
 
333
    pop ecx ; #<3
330
    pop ecx ; #<3
334
    pop edx ; #<2
331
    pop edx ; #<2
335
    mov  eax,esi
332
    mov  eax,esi
336
    pop esi ; #<5
333
    pop esi ; #<5
337
    .l_y:
334
    .l_y:
338
       ;mov ax,cx
335
       ;mov ax,cx
339
       push  ecx
336
       push  ecx
340
       cld
337
       cld
341
       mov  ecx,edx
338
       mov  ecx,edx
342
       .l_x:
339
       .l_x:
343
         ;rep movs byte [edi],[esi]
340
         ;rep movs byte [edi],[esi]
344
         mov  word [edi],ax
341
         mov  word [edi],ax
345
         push eax
342
         push eax
346
         shr  eax,16
343
         shr  eax,16
347
         mov  byte [edi+2],al
344
         mov  byte [edi+2],al
348
         add  edi,3
345
         add  edi,3
349
         pop  eax
346
         pop  eax
350
       loop .l_x
347
       loop .l_x
351
 
348
 
352
       add edi,X_SIZE
349
       add edi,X_SIZE
353
       add edi,X_SIZE
350
       add edi,X_SIZE
354
       add edi,X_SIZE
351
       add edi,X_SIZE
355
       sub edi,edx
352
       sub edi,edx
356
       sub edi,edx
353
       sub edi,edx
357
       sub edi,edx
354
       sub edi,edx
358
       add eax,esi
355
       add eax,esi
359
       ;mov cx,ax
356
       ;mov cx,ax
360
       pop  ecx
357
       pop  ecx
361
    loop .l_y
358
    loop .l_y
362
 
359
 
363
    pop_abc
360
    pop_abc
364
ret
361
ret
365
 
362
 
366
 
363
 
367
fill_screen: ; eax - screen color ( 0x00RRGGBB )
364
fill_screen: ; eax - screen color ( 0x00RRGGBB )
368
    push_abc
365
    push_abc
369
    mov  edi,screen
366
    mov  edi,screen
370
    cld
367
    cld
371
    mov  ecx,X_SIZE*Y_SIZE
368
    mov  ecx,X_SIZE*Y_SIZE
372
    .lab1:
369
    .lab1:
373
        mov  [edi],eax
370
        mov  [edi],eax
374
        add  edi,3
371
        add  edi,3
375
    loop .lab1
372
    loop .lab1
376
    pop_abc
373
    pop_abc
377
ret
374
ret
378
 
375
 
379
grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack
376
grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack
380
    push_abc
377
    push_abc
381
    mov  edi,screen
378
    mov  edi,screen
382
    cld
379
    cld
383
    mov  ecx,Y_SIZE
380
    mov  ecx,Y_SIZE
384
    mov  dl,0
381
    mov  dl,0
385
    .lab1:
382
    .lab1:
386
       push ecx
383
       push ecx
387
       mov ecx,X_SIZE
384
       mov ecx,X_SIZE
388
       .lab2:
385
       .lab2:
389
         mov  [edi],eax
386
         mov  [edi],eax
390
         add  edi,3
387
         add  edi,3
391
       loop .lab2
388
       loop .lab2
392
       mov dh,1  ; dl = 1 - dl
389
       mov dh,1  ; dl = 1 - dl
393
       sub dh,dl
390
       sub dh,dl
394
       mov dl,dh
391
       mov dl,dh
395
       cmp dl,0
392
       cmp dl,0
396
       jne .no_ch  ; if (dl==0)
393
       jne .no_ch  ; if (dl==0)
397
         add  eax,ebx ; change gradient
394
         add  eax,ebx ; change gradient
398
       .no_ch:
395
       .no_ch:
399
       pop ecx
396
       pop ecx
400
    loop .lab1
397
    loop .lab1
401
    pop_abc
398
    pop_abc
402
ret
399
ret
403
 
400
 
404
 
401
 
405
bmp_fill_screen: ; esi - pointer to a backgroung bmp
402
bmp_fill_screen: ; esi - pointer to a backgroung bmp
406
    push_abc
403
    push_abc
407
    mov  edi,screen
404
    mov  edi,screen
408
    cld
405
    cld
409
    mov  ecx,X_SIZE*Y_SIZE
406
    mov  ecx,X_SIZE*Y_SIZE
410
      rep movs dword  [edi],[esi]
407
      rep movs dword  [edi],[esi]
411
    pop_abc
408
    pop_abc
412
ret
409
ret
413
 
410
 
414
;___________________
411
;___________________
415
intro:  ; INTRO    ;
412
intro:  ; INTRO    ;
416
    cmp  [is_rolled_up], 1
413
    cmp  [is_rolled_up], 1
417
    jne  @f
414
    jne  @f
418
    ret
415
    ret
419
  @@:
416
  @@:
420
    label 140,200,VERSION,0x100000FF
417
    label 146,200,'ARCANOID II  v0.30',0x100000FF
421
    label 120,220,'by jj (jacek jerzy malinowski)',0x050505
418
    label 120,220,'by jj (jacek jerzy malinowski)',0x050505
422
    label 100,240,'press SPACE to start a new game',0x10FF0800
419
    label 100,240,'press SPACE to start a new game',0x10FF0800
423
    label 15,240,'F1 + delay',0xFFA8FF
420
    label 15,240,'F1 + delay',0xFFA8FF
424
    label 15,260,'F2 + delay',0xFFA8FF
421
    label 15,260,'F2 + delay',0xFFA8FF
425
    delay 10
422
    delay 10
426
ret
423
ret
427
 
424
 
428
;___________________
425
;___________________
429
level_info:
426
level_info:
430
    cmp  [is_rolled_up], 1
427
    cmp  [is_rolled_up], 1
431
    jne  @f
428
    jne  @f
432
    ret
429
    ret
433
  @@:
430
  @@:
434
    label 170,230,'L E V E L',0x100000FF
431
    label 170,230,'L E V E L',0x100000FF
435
    outcount [level],195,250,0x100000FF,2*65536
432
    outcount [level],195,250,0x100000FF,2*65536
436
    label 100,270,'press SPACE to start the level',0x10FF0800
433
    label 100,270,'press SPACE to start the level',0x10FF0800
437
    delay 10
434
    delay 10
438
ret
435
ret
439
 
436
 
440
;_________________________
437
;_________________________
441
game_over:  ; GAME OVER  ;
438
game_over:  ; GAME OVER  ;
442
    mov  eax,0x00FF00
439
    mov  eax,0x00FF00
443
    mov  ebx,0xFF01
440
    mov  ebx,0xFF01
444
    .g_ok:
441
    .g_ok:
445
    call grad_fill_screen
442
    call grad_fill_screen
446
    call show_screen  ; flips the screen
443
    call show_screen  ; flips the screen
447
    label 120,150,'G  A  M  E    O  V  E  R',0x10050505
444
    label 120,150,'G  A  M  E    O  V  E  R',0x10050505
448
    label 140,200,'Thanks for playing',0x0FFF800
445
    label 140,200,'Thanks for playing',0x0FFF800
449
    delay 20
446
    delay 20
450
ret
447
ret
451
 
448
 
452
 
449
 
453
;-----------------------------;
450
;-----------------------------;
454
; THE MAIN THE GAME'S ENGINE ;
451
; THE MAIN THE GAME'S ENGINE ;
455
;-----------------------------;
452
;-----------------------------;
456
fast_gfx:
453
fast_gfx:
457
    ; the background gradient
454
    ; the background gradient
458
    if_e  dword [level],0,.no_0
455
    if_e  dword [level],0,.no_0
459
      mov  eax,0xFF
456
      mov  eax,0xFF
460
      mov  ebx,0xFEFF
457
      mov  ebx,0xFEFF
461
      jmp .g_ok
458
      jmp .g_ok
462
    .no_0:
459
    .no_0:
463
    if_e  dword [level],1,.no_1
460
    if_e  dword [level],1,.no_1
464
      mov  eax,BACK_CL
461
      mov  eax,BACK_CL
465
      mov  ebx,0xFFFF
462
      mov  ebx,0xFFFF
466
      jmp .g_ok
463
      jmp .g_ok
467
    .no_1:
464
    .no_1:
468
    if_e  dword [level],2,.no_2
465
    if_e  dword [level],2,.no_2
469
      mov  eax,0xFF0000
466
      mov  eax,0xFF0000
470
      mov  ebx,0xFF00FF
467
      mov  ebx,0xFF00FF
471
      jmp .g_ok
468
      jmp .g_ok
472
    .no_2:
469
    .no_2:
473
 
470
 
474
    mov  eax,BACK_CL
471
    mov  eax,BACK_CL
475
    mov  ebx,0xFFFF
472
    mov  ebx,0xFFFF
476
    .g_ok:
473
    .g_ok:
477
    call grad_fill_screen
474
    call grad_fill_screen
478
 
475
 
479
    mov  eax,37  ; get mouse position
476
    mov  eax,37  ; get mouse position
480
    mov  ebx,1
477
    mov  ebx,1
481
    mcall
478
    mcall
482
    shr  eax,16
479
    shr  eax,16
483
    mov  [x],eax
480
    mov  [x],eax
484
    add  eax,[s_x]
481
    add  eax,[s_x]
485
    cmp  eax,X_SIZE  ; controls if the pad is in the screen
482
    cmp  eax,X_SIZE  ; controls if the pad is in the screen
486
    jb   .ok
483
    jb   .ok
487
      cmp eax,0x7FFF ; if < 0
484
      cmp eax,0x7FFF ; if < 0
488
      jb  .upper
485
      jb  .upper
489
        mov [x],0
486
        mov [x],0
490
        jmp .ok
487
        jmp .ok
491
      .upper:        ; if > X_SIZE - pad size
488
      .upper:        ; if > X_SIZE - pad size
492
      mov dword [x],X_SIZE-1
489
      mov dword [x],X_SIZE-1
493
      mov eax,[s_x]
490
      mov eax,[s_x]
494
      sub dword [x],eax
491
      sub dword [x],eax
495
    .ok:
492
    .ok:
496
    mov  ebx,[x]
493
    mov  ebx,[x]
497
    mov  eax,[y]
494
    mov  eax,[y]
498
    mov  ecx,[s_x]
495
    mov  ecx,[s_x]
499
    mov  edx,15
496
    mov  edx,15
500
    mov  esi,0xFF0000
497
    mov  esi,0xFF0000
501
    mov  edi,0xF0000F
498
    mov  edi,0xF0000F
502
    call grad_rect_screen
499
    call grad_rect_screen
503
 
500
 
504
    call draw_level
501
    call draw_level
505
 
502
 
506
    cmp dword [mode],1
503
    cmp dword [mode],1
507
    jne .no_go ; is the game started ?
504
    jne .no_go ; is the game started ?
508
      mov eax,[v_x]
505
      mov eax,[v_x]
509
      add dword [b_x],eax
506
      add dword [b_x],eax
510
      mov eax,[v_y]
507
      mov eax,[v_y]
511
      add dword [b_y],eax
508
      add dword [b_y],eax
512
      jmp .go
509
      jmp .go
513
    .no_go:
510
    .no_go:
514
      mov eax,[x] ; b_x = x + x_s/2
511
      mov eax,[x] ; b_x = x + x_s/2
515
      mov ebx,[s_x]
512
      mov ebx,[s_x]
516
      shr ebx,1
513
      shr ebx,1
517
      add eax,ebx
514
      add eax,ebx
518
      mov dword [b_x],eax
515
      mov dword [b_x],eax
519
      mov eax,[y] ; b_y = y - 10
516
      mov eax,[y] ; b_y = y - 10
520
      sub eax,10
517
      sub eax,10
521
      mov dword [b_y],eax
518
      mov dword [b_y],eax
522
 
519
 
523
      mov dword [v_x],1
520
      mov dword [v_x],1
524
      mov dword [v_y],-1
521
      mov dword [v_y],-1
525
    .go:
522
    .go:
526
    ;TEST WHERE IS THE BALL:
523
    ;TEST WHERE IS THE BALL:
527
    cmp dword [b_x],0x7FFFFFFF
524
    cmp dword [b_x],0x7FFFFFFF
528
    jb .b_ok2 ; if out of the screen (left)
525
    jb .b_ok2 ; if out of the screen (left)
529
      mov dword [b_x],0
526
      mov dword [b_x],0
530
      mov eax,0
527
      mov eax,0
531
      sub eax,[v_x]
528
      sub eax,[v_x]
532
      mov [v_x],eax
529
      mov [v_x],eax
533
    .b_ok2:
530
    .b_ok2:
534
    cmp dword [b_x],X_SIZE-10
531
    cmp dword [b_x],X_SIZE-10
535
    jb .b_ok1 ; if out of the screen (right)
532
    jb .b_ok1 ; if out of the screen (right)
536
      mov dword [b_x],X_SIZE-11
533
      mov dword [b_x],X_SIZE-11
537
      mov eax,0
534
      mov eax,0
538
      sub eax,[v_x]
535
      sub eax,[v_x]
539
      mov [v_x],eax
536
      mov [v_x],eax
540
    .b_ok1:
537
    .b_ok1:
541
    cmp dword [b_y],0x7FFFFFFF
538
    cmp dword [b_y],0x7FFFFFFF
542
    jb .b_ok3 ; if out of the screen (up)
539
    jb .b_ok3 ; if out of the screen (up)
543
      mov dword [b_y],0
540
      mov dword [b_y],0
544
      mov eax,0
541
      mov eax,0
545
      sub eax,[v_y]
542
      sub eax,[v_y]
546
      mov [v_y],eax
543
      mov [v_y],eax
547
    .b_ok3:
544
    .b_ok3:
548
    cmp dword [b_y],Y_SIZE-10
545
    cmp dword [b_y],Y_SIZE-10
549
    jb .b_ok4 ; if out of the screen (down)
546
    jb .b_ok4 ; if out of the screen (down)
550
      mov dword [mode],0
547
      mov dword [mode],0
551
      if_e dword [lives],0,.end_if5
548
      if_e dword [lives],0,.end_if5
552
         mov dword [mode],4 ; GAME OVER
549
         mov dword [mode],4 ; GAME OVER
553
         jmp still
550
         jmp still
554
      .end_if5:
551
      .end_if5:
555
         dec dword [lives]
552
         dec dword [lives]
556
      .end_else4:
553
      .end_else4:
557
      call draw_window
554
      call draw_window
558
    .b_ok4:
555
    .b_ok4:
559
 
556
 
560
    imgtoimg img_ball,dword [b_x],dword [b_y],screen_img
557
    imgtoimg img_ball,dword [b_x],dword [b_y],screen_img
561
 
558
 
562
    call show_screen  ; flips the screen
559
    call show_screen  ; flips the screen
563
    delay dword [del]
560
    delay dword [del]
564
 
561
 
565
    call do_tests ; does all needed tests
562
    call do_tests ; does all needed tests
566
ret
563
ret
567
;----------------------;
564
;----------------------;
568
; BALL & BRICKS EVENTS ;
565
; BALL & BRICKS EVENTS ;
569
;----------------------;
566
;----------------------;
570
MAX_SPEED equ 3
567
MAX_SPEED equ 3
571
do_tests:
568
do_tests:
572
    ; BALL <-> PAD
569
    ; BALL <-> PAD
573
    mov eax,[b_x]
570
    mov eax,[b_x]
574
    add eax,10
571
    add eax,10
575
    cmp eax,[x] ; if (b_x+10)>[pad x]
572
    cmp eax,[x] ; if (b_x+10)>[pad x]
576
    jb .skip        ; &&
573
    jb .skip        ; &&
577
    mov eax,[b_x]
574
    mov eax,[b_x]
578
    mov ebx,[s_x]
575
    mov ebx,[s_x]
579
    add ebx,[x]
576
    add ebx,[x]
580
    cmp eax,ebx ; if b_x < x + s_x
577
    cmp eax,ebx ; if b_x < x + s_x
581
    ja .skip     ; &&
578
    ja .skip     ; &&
582
    mov eax,[b_y]
579
    mov eax,[b_y]
583
    add eax,10
580
    add eax,10
584
    cmp eax,[y] ; if (b_y+10) > y
581
    cmp eax,[y] ; if (b_y+10) > y
585
    jb .skip
582
    jb .skip
586
    sub eax,15
583
    sub eax,15
587
    cmp eax,[y] ; if b_y < y+15
584
    cmp eax,[y] ; if b_y < y+15
588
    ja .skip
585
    ja .skip
589
      cmp dword [v_y],0x7FFFFF ; if v_y > 0
586
      cmp dword [v_y],0x7FFFFF ; if v_y > 0
590
      ja .skip
587
      ja .skip
591
      cmp dword [v_y],MAX_SPEED; speedup:
588
      cmp dword [v_y],MAX_SPEED; speedup:
592
      ja .skip_s
589
      ja .skip_s
593
        inc dword [speed_t]
590
        inc dword [speed_t]
594
        cmp dword [speed_t],5
591
        cmp dword [speed_t],5
595
        jb .skip_s
592
        jb .skip_s
596
        inc dword [v_y]
593
        inc dword [v_y]
597
        mov dword [speed_t],0
594
        mov dword [speed_t],0
598
      .skip_s:
595
      .skip_s:
599
      inc dword [speed_t]
596
      inc dword [speed_t]
600
      mov eax,0
597
      mov eax,0
601
      sub eax,[v_y]
598
      sub eax,[v_y]
602
      mov [v_y],eax
599
      mov [v_y],eax
603
      ;counting v_x:--------
600
      ;counting v_x:--------
604
      mov eax,[b_x]
601
      mov eax,[b_x]
605
      sub eax,[x]
602
      sub eax,[x]
606
      sub eax,5
603
      sub eax,5
607
      mov ecx,eax
604
      mov ecx,eax
608
      if_a eax,100,.end_if3
605
      if_a eax,100,.end_if3
609
        mov eax,0
606
        mov eax,0
610
        sub eax,[v_x]
607
        sub eax,[v_x]
611
        mov [v_x],eax
608
        mov [v_x],eax
612
        jmp .skip
609
        jmp .skip
613
      .end_if3:
610
      .end_if3:
614
      if_a eax,20,.end_if2
611
      if_a eax,20,.end_if2
615
        sub eax,20
612
        sub eax,20
616
        shr eax,2
613
        shr eax,2
617
        mov [v_x],eax
614
        mov [v_x],eax
618
        jmp .skip
615
        jmp .skip
619
      .end_if2:
616
      .end_if2:
620
        mov ebx,20
617
        mov ebx,20
621
        sub ebx,ecx
618
        sub ebx,ecx
622
        shr ebx,2
619
        shr ebx,2
623
        mov dword [v_x],0
620
        mov dword [v_x],0
624
        sub dword [v_x],ebx
621
        sub dword [v_x],ebx
625
    .skip:
622
    .skip:
626
 
623
 
627
    ; BALL <-> BRICK
624
    ; BALL <-> BRICK
628
    mov dword [coliz],0
625
    mov dword [coliz],0
629
    call colision
626
    call colision
630
    if_e dword [coliz],1,.end_if6
627
    if_e dword [coliz],1,.end_if6
631
       ;abs dword [v_y]
628
       ;abs dword [v_y]
632
       ;abs dword [v_x]
629
       ;abs dword [v_x]
633
       ret
630
       ret
634
    .end_if6:
631
    .end_if6:
635
    add dword [b_x],10
632
    add dword [b_x],10
636
    call colision
633
    call colision
637
    sub dword [b_x],10
634
    sub dword [b_x],10
638
    if_e dword [coliz],1,.end_if7
635
    if_e dword [coliz],1,.end_if7
639
       ;abs dword [v_y]
636
       ;abs dword [v_y]
640
       ;abs dword [v_x]
637
       ;abs dword [v_x]
641
       ch_sign dword [v_x]
638
       ch_sign dword [v_x]
642
       ret
639
       ret
643
    .end_if7:
640
    .end_if7:
644
    add dword [b_y],10
641
    add dword [b_y],10
645
    call colision
642
    call colision
646
    sub dword [b_y],10
643
    sub dword [b_y],10
647
    if_e dword [coliz],1,.end_if8
644
    if_e dword [coliz],1,.end_if8
648
       ;abs dword [v_y]
645
       ;abs dword [v_y]
649
       ;abs dword [v_x]
646
       ;abs dword [v_x]
650
       ;ch_sign dword [v_y]
647
       ;ch_sign dword [v_y]
651
       ret
648
       ret
652
    .end_if8:
649
    .end_if8:
653
    add dword [b_x],10
650
    add dword [b_x],10
654
    add dword [b_y],10
651
    add dword [b_y],10
655
    call colision
652
    call colision
656
    sub dword [b_x],10
653
    sub dword [b_x],10
657
    sub dword [b_y],10
654
    sub dword [b_y],10
658
    if_e dword [coliz],1,.end_if9
655
    if_e dword [coliz],1,.end_if9
659
       ;abs dword [v_y]
656
       ;abs dword [v_y]
660
       ;abs dword [v_x]
657
       ;abs dword [v_x]
661
       ;ch_sign dword [v_x]
658
       ;ch_sign dword [v_x]
662
       ;ch_sign dword [v_y]
659
       ;ch_sign dword [v_y]
663
 
660
 
664
       ret
661
       ret
665
    .end_if9:
662
    .end_if9:
666
 
663
 
667
 
664
 
668
ret
665
ret
669
 
666
 
670
colision:
667
colision:
671
 
668
 
672
    mov  esi,levels
669
    mov  esi,levels
673
    mov  eax,[level] ; eax = levels*100
670
    mov  eax,[level] ; eax = levels*100
674
    mov  bx,100
671
    mov  bx,100
675
    mul  bx
672
    mul  bx
676
    add  esi,eax
673
    add  esi,eax
677
    ;--------------
674
    ;--------------
678
    xor  edx,edx
675
    xor  edx,edx
679
    mov  eax,[b_x]
676
    mov  eax,[b_x]
680
    mov  ebx,40
677
    mov  ebx,40
681
    div  ebx
678
    div  ebx
682
    mov  ecx,eax
679
    mov  ecx,eax
683
    push edx ;#>1
680
    push edx ;#>1
684
 
681
 
685
    xor edx,edx
682
    xor edx,edx
686
    mov  eax,[b_y]
683
    mov  eax,[b_y]
687
    mov  ebx,20
684
    mov  ebx,20
688
    div  ebx
685
    div  ebx
689
    push edx ;#>2
686
    push edx ;#>2
690
    cmp  eax,9 ; out of the bricks board
687
    cmp  eax,9 ; out of the bricks board
691
    ja .ok2
688
    ja .ok2
692
    mov  ebx,10
689
    mov  ebx,10
693
    mul  ebx
690
    mul  ebx
694
    add  eax,ecx
691
    add  eax,ecx
695
    add  esi,eax
692
    add  esi,eax
696
 
693
 
697
    cmp byte [esi],0 ; 0 - no brick
694
    cmp byte [esi],0 ; 0 - no brick
698
    je .ok2
695
    je .ok2
699
      if_ne byte [esi],4,.end_if1
696
      if_ne byte [esi],4,.end_if1
700
        dec byte [esi]
697
        dec byte [esi]
701
      .end_if1:
698
      .end_if1:
702
      mov dword [coliz],1
699
      mov dword [coliz],1
703
      pop ebx ;#<2
700
      pop ebx ;#<2
704
      pop eax ;#<1
701
      pop eax ;#<1
705
      cmp ecx,8 ; x < 5 || x >35 - x inv
702
      cmp ecx,8 ; x < 5 || x >35 - x inv
706
      jb  .inv
703
      jb  .inv
707
      cmp ecx,33
704
      cmp ecx,33
708
      ja  .inv
705
      ja  .inv
709
      jmp .no_inv
706
      jmp .no_inv
710
      .inv:
707
      .inv:
711
        mov eax,0
708
        mov eax,0
712
        sub eax,[v_x]
709
        sub eax,[v_x]
713
        mov [v_x],eax
710
        mov [v_x],eax
714
        ;jmp .no_ok
711
        ;jmp .no_ok
715
      .no_inv:
712
      .no_inv:
716
      cmp ebx,6 ; if y < 5 || y>15 - y inv
713
      cmp ebx,6 ; if y < 5 || y>15 - y inv
717
      jb .inv_y
714
      jb .inv_y
718
      cmp ebx,14
715
      cmp ebx,14
719
      ja .inv_y
716
      ja .inv_y
720
      jmp .no_ok
717
      jmp .no_ok
721
        .inv_y:
718
        .inv_y:
722
        mov eax,0
719
        mov eax,0
723
        sub eax,[v_y]
720
        sub eax,[v_y]
724
        mov [v_y],eax
721
        mov [v_y],eax
725
      .no_ok:
722
      .no_ok:
726
      jmp .ok
723
      jmp .ok
727
    .ok2:
724
    .ok2:
728
      pop eax ;#<1
725
      pop eax ;#<1
729
      pop eax ;#<2
726
      pop eax ;#<2
730
    .ok:
727
    .ok:
731
 
728
 
732
 
729
 
733
ret
730
ret
734
 
731
 
735
;-----------------------------------;
732
;-----------------------------------;
736
; DRAWS CURRENT LEVEL ON THE SCREEN ;
733
; DRAWS CURRENT LEVEL ON THE SCREEN ;
737
;-----------------------------------;
734
;-----------------------------------;
738
draw_level:
735
draw_level:
739
    mov  esi,levels
736
    mov  esi,levels
740
    mov  eax,[level] ; eax = levels*100
737
    mov  eax,[level] ; eax = levels*100
741
    mov  bx,100
738
    mov  bx,100
742
    mul  bx
739
    mul  bx
743
    add  esi,eax
740
    add  esi,eax
744
    mov  ecx,10
741
    mov  ecx,10
745
    mov  eax,0
742
    mov  eax,0
746
    mov dword [l_end],1
743
    mov dword [l_end],1
747
    .l_y:
744
    .l_y:
748
      push ecx ;#>1
745
      push ecx ;#>1
749
      mov ebx,0
746
      mov ebx,0
750
      mov ecx,10
747
      mov ecx,10
751
      .l_x:
748
      .l_x:
752
        cmp byte [esi],1 ; if 1 ?
749
        cmp byte [esi],1 ; if 1 ?
753
        push esi;#>2
750
        push esi;#>2
754
        jne .no_1
751
        jne .no_1
755
          mov  esi,img_brick1
752
          mov  esi,img_brick1
756
          call put_bmp_screen
753
          call put_bmp_screen
757
          mov dword [l_end],0
754
          mov dword [l_end],0
758
        .no_1:
755
        .no_1:
759
        cmp byte [esi],2 ; if 2 ?
756
        cmp byte [esi],2 ; if 2 ?
760
        jne .no_2
757
        jne .no_2
761
          mov  esi,img_brick2
758
          mov  esi,img_brick2
762
          call put_bmp_screen
759
          call put_bmp_screen
763
          mov dword [l_end],0
760
          mov dword [l_end],0
764
        .no_2:
761
        .no_2:
765
        cmp byte [esi],3 ; if 3 ?
762
        cmp byte [esi],3 ; if 3 ?
766
        jne .no_3
763
        jne .no_3
767
          mov  esi,img_brick3
764
          mov  esi,img_brick3
768
          call put_bmp_screen
765
          call put_bmp_screen
769
          mov dword [l_end],0
766
          mov dword [l_end],0
770
        .no_3:
767
        .no_3:
771
        cmp byte [esi],4 ; if 4 ?
768
        cmp byte [esi],4 ; if 4 ?
772
        jne .no_4
769
        jne .no_4
773
          mov  esi,img_brick4
770
          mov  esi,img_brick4
774
          call put_bmp_screen
771
          call put_bmp_screen
775
        .no_4:
772
        .no_4:
776
 
773
 
777
        add ebx,40
774
        add ebx,40
778
        pop esi ;#<2
775
        pop esi ;#<2
779
        inc esi
776
        inc esi
780
      loop .l_x
777
      loop .l_x
781
      add eax,20 ;#<1
778
      add eax,20 ;#<1
782
      pop  ecx
779
      pop  ecx
783
    loop .l_y
780
    loop .l_y
784
;----------------
781
;----------------
785
; NEXT LEVEL
782
; NEXT LEVEL
786
    if_e dword [l_end],1,.end_if ; all bricks are taken
783
    if_e dword [l_end],1,.end_if ; all bricks are taken
787
    if_e dword [mode],1,.end_if
784
    if_e dword [mode],1,.end_if
788
        add dword [level],1
785
        add dword [level],1
789
        if_a dword [level],MAX_LEVEL,.end_if2
786
        if_a dword [level],MAX_LEVEL,.end_if2
790
           mov dword [mode],4 ; game over
787
           mov dword [mode],4 ; game over
791
           jmp still
788
           jmp still
792
        .end_if2:
789
        .end_if2:
793
        call fast_gfx
790
        call fast_gfx
794
        mov dword [mode],2
791
        mov dword [mode],2
795
    .end_if:
792
    .end_if:
796
ret
793
ret
797
 
794
 
798
;   *********************************************
795
;   *********************************************
799
;   *******  WINDOW DEFINITIONS AND DRAW ********
796
;   *******  WINDOW DEFINITIONS AND DRAW ********
800
;   *********************************************
797
;   *********************************************
801
 
798
 
802
 
799
 
803
draw_window:
800
draw_window:
804
 
801
 
-
 
802
    mcall 12,1
-
 
803
    mcall 0,<100,X_SIZE+8>,<100,Y_SIZE+21>,0x14ffffff, , VERSION
805
    startwd
-
 
806
 
-
 
807
    window 100,100,X_SIZE+8,Y_SIZE+21,0x04ffffff
804
 
808
    label 8,8,VERSION,cl_White+font_Big
805
	
809
    label 200,8,'LIVES:',0x10ddeeff
806
	label 200,8,'LIVES:',0x10ffffff
810
    outcount dword [lives],250,8,0x10ddeeff,65536
807
    outcount dword [lives],250,8,0x10ffffff,65536
811
 
808
 
812
    cmp [is_rolled_up], 1
809
    cmp [is_rolled_up], 1
813
    je  @f
810
    je  @f
814
    call fast_gfx
811
    call fast_gfx
815
  @@:
812
  @@:
816
 
813
 
817
    endwd
814
    mcall 12,2
818
 
815
 
819
    ret
816
    ret
820
 
817
 
821
;-----------;####################
818
;-----------;####################
822
; DATA AREA ;####################
819
; DATA AREA ;####################
823
;-----------;####################
820
;-----------;####################
-
 
821
 
-
 
822
VERSION db 'ARCANOID II', 0
824
 
823
 
825
is_rolled_up dd 0
824
is_rolled_up dd 0
826
 
825
 
827
 lives dd 5
826
 lives dd 5
828
 mode dd 0
827
 mode dd 0
829
 l_end dd 0 ; if 1 the level is over
828
 l_end dd 0 ; if 1 the level is over
830
; PAD x:
829
; PAD x:
831
 x   dd 20
830
 x   dd 20
832
 y   dd Y_SIZE-20
831
 y   dd Y_SIZE-20
833
; PAD length:
832
; PAD length:
834
 s_x dd 40
833
 s_x dd 40
835
 
834
 
836
; the ball stuff ;-)
835
; the ball stuff ;-)
837
 b_x dd 100
836
 b_x dd 100
838
 b_y dd 250
837
 b_y dd 250
839
 v_y dd 0
838
 v_y dd 0
840
 v_x dd 3
839
 v_x dd 3
841
 
840
 
842
 speed_t dd 0 ; 1/10 times speedup
841
 speed_t dd 0 ; 1/10 times speedup
843
 del dd 1 ; delay
842
 del dd 1 ; delay
844
 
843
 
845
 coliz dd 0 ; if 1 then colizion with a brick
844
 coliz dd 0 ; if 1 then colizion with a brick
846
 
845
 
847
; LEVELS:
846
; LEVELS:
848
level dd 0
847
level dd 0
849
levels:
848
levels:
850
;LEVEL 0:
849
;LEVEL 0:
851
db 0,0,0,0,0,0,0,0,0,0
850
db 0,0,0,0,0,0,0,0,0,0
852
db 0,4,0,0,4,4,0,0,0,4
851
db 0,4,0,0,4,4,0,0,0,4
853
db 4,0,4,0,4,0,4,0,4,0
852
db 4,0,4,0,4,0,4,0,4,0
854
db 4,0,4,0,4,0,4,0,4,0
853
db 4,0,4,0,4,0,4,0,4,0
855
db 4,4,4,0,4,4,0,0,4,0
854
db 4,4,4,0,4,4,0,0,4,0
856
db 4,0,4,0,4,0,4,0,4,0
855
db 4,0,4,0,4,0,4,0,4,0
857
db 4,0,4,0,4,0,4,0,0,4
856
db 4,0,4,0,4,0,4,0,0,4
858
db 0,0,0,0,0,0,0,0,0,0
857
db 0,0,0,0,0,0,0,0,0,0
859
db 0,0,0,0,0,0,0,0,0,0
858
db 0,0,0,0,0,0,0,0,0,0
860
db 0,0,0,0,0,0,0,0,0,0
859
db 0,0,0,0,0,0,0,0,0,0
861
 
860
 
862
;LEVEL 1:
861
;LEVEL 1:
863
db 1,1,1,1,1,1,1,1,1,1
862
db 1,1,1,1,1,1,1,1,1,1
864
db 0,3,0,0,3,3,0,0,0,3
863
db 0,3,0,0,3,3,0,0,0,3
865
db 3,0,3,0,3,0,3,0,3,0
864
db 3,0,3,0,3,0,3,0,3,0
866
db 3,0,3,0,3,0,3,0,3,0
865
db 3,0,3,0,3,0,3,0,3,0
867
db 3,3,3,0,3,3,0,0,3,0
866
db 3,3,3,0,3,3,0,0,3,0
868
db 3,0,3,0,3,0,3,0,3,0
867
db 3,0,3,0,3,0,3,0,3,0
869
db 3,0,3,0,3,0,3,0,0,3
868
db 3,0,3,0,3,0,3,0,0,3
870
db 2,2,2,2,2,2,2,2,2,2
869
db 2,2,2,2,2,2,2,2,2,2
871
db 1,1,1,1,1,1,1,1,1,1
870
db 1,1,1,1,1,1,1,1,1,1
872
db 1,1,1,1,1,1,1,1,1,1
871
db 1,1,1,1,1,1,1,1,1,1
873
;LEVEL 2:
872
;LEVEL 2:
874
db 3,3,3,3,0,0,3,3,3,3
873
db 3,3,3,3,0,0,3,3,3,3
875
db 3,1,1,1,0,0,1,1,1,3
874
db 3,1,1,1,0,0,1,1,1,3
876
db 3,1,2,1,3,3,1,2,1,3
875
db 3,1,2,1,3,3,1,2,1,3
877
db 0,1,0,1,3,3,1,0,1,0
876
db 0,1,0,1,3,3,1,0,1,0
878
db 2,1,2,1,1,1,1,2,1,2
877
db 2,1,2,1,1,1,1,2,1,2
879
db 0,1,0,1,2,2,1,0,1,0
878
db 0,1,0,1,2,2,1,0,1,0
880
db 2,1,2,1,1,1,1,2,1,2
879
db 2,1,2,1,1,1,1,2,1,2
881
db 0,1,0,1,1,1,1,0,1,0
880
db 0,1,0,1,1,1,1,0,1,0
882
db 0,0,0,1,0,0,1,0,0,0
881
db 0,0,0,1,0,0,1,0,0,0
883
db 0,0,0,1,0,0,1,0,0,0
882
db 0,0,0,1,0,0,1,0,0,0
884
;LEVEL 3:
883
;LEVEL 3:
885
db 1,2,3,1,2,3,1,3,2,1
884
db 1,2,3,1,2,3,1,3,2,1
886
db 2,3,1,2,3,1,3,3,1,2
885
db 2,3,1,2,3,1,3,3,1,2
887
db 3,1,2,3,1,2,3,1,2,3
886
db 3,1,2,3,1,2,3,1,2,3
888
db 1,2,3,1,2,3,1,3,2,1
887
db 1,2,3,1,2,3,1,3,2,1
889
db 2,3,1,2,3,1,3,3,1,2
888
db 2,3,1,2,3,1,3,3,1,2
890
db 3,1,2,3,1,2,3,1,2,3
889
db 3,1,2,3,1,2,3,1,2,3
891
db 1,2,1,2,1,2,1,2,1,2
890
db 1,2,1,2,1,2,1,2,1,2
892
db 1,0,1,0,1,0,1,0,1,0
891
db 1,0,1,0,1,0,1,0,1,0
893
db 0,0,3,0,0,0,0,3,0,0
892
db 0,0,3,0,0,0,0,3,0,0
894
db 0,0,3,0,0,0,0,3,0,0
893
db 0,0,3,0,0,0,0,3,0,0
895
;LEVEL 4:
894
;LEVEL 4:
896
db 0,0,0,1,1,1,1,0,0,0
895
db 0,0,0,1,1,1,1,0,0,0
897
db 0,0,1,2,2,2,2,1,0,0
896
db 0,0,1,2,2,2,2,1,0,0
898
db 1,1,1,2,2,2,2,1,1,1
897
db 1,1,1,2,2,2,2,1,1,1
899
db 1,0,1,0,2,2,0,1,0,1
898
db 1,0,1,0,2,2,0,1,0,1
900
db 0,1,1,2,2,2,2,1,1,0
899
db 0,1,1,2,2,2,2,1,1,0
901
db 0,0,1,2,2,2,2,1,0,0
900
db 0,0,1,2,2,2,2,1,0,0
902
db 0,0,1,2,2,2,2,1,0,0
901
db 0,0,1,2,2,2,2,1,0,0
903
db 0,0,1,2,3,3,2,1,0,0
902
db 0,0,1,2,3,3,2,1,0,0
904
db 0,0,1,2,2,2,2,1,0,0
903
db 0,0,1,2,2,2,2,1,0,0
905
db 0,0,0,1,1,1,1,0,0,0
904
db 0,0,0,1,1,1,1,0,0,0
906
;LEVEL 5:
905
;LEVEL 5:
907
db 1,1,1,1,1,1,1,1,1,1
906
db 1,1,1,1,1,1,1,1,1,1
908
db 1,2,0,0,3,2,0,0,2,1
907
db 1,2,0,0,3,2,0,0,2,1
909
db 1,2,0,0,2,3,0,0,2,1
908
db 1,2,0,0,2,3,0,0,2,1
910
db 2,2,0,0,3,2,0,0,2,2
909
db 2,2,0,0,3,2,0,0,2,2
911
db 0,0,0,0,2,3,0,0,0,0
910
db 0,0,0,0,2,3,0,0,0,0
912
db 0,0,0,1,1,1,1,0,0,0
911
db 0,0,0,1,1,1,1,0,0,0
913
db 0,0,1,1,0,0,1,1,0,0
912
db 0,0,1,1,0,0,1,1,0,0
914
db 0,0,1,1,0,0,1,1,0,0
913
db 0,0,1,1,0,0,1,1,0,0
915
db 2,1,2,1,2,1,2,1,2,1
914
db 2,1,2,1,2,1,2,1,2,1
916
db 1,2,1,2,1,2,1,2,1,2
915
db 1,2,1,2,1,2,1,2,1,2
917
 
916
 
918
 
917
 
919
; BITMAPs and IMAGEs
918
; BITMAPs and IMAGEs
920
bmp_file:
919
bmp_file:
921
    file 'arcanii.bmp'
920
    file 'arcanii.bmp'
922
 
921
 
923
img_bmp:
922
img_bmp:
924
    rb 40*90*3+8
923
    rb 40*90*3+8
925
img_brick1:
924
img_brick1:
926
    rb 40*20*3+8
925
    rb 40*20*3+8
927
img_brick2:
926
img_brick2:
928
    rb 40*20*3+8
927
    rb 40*20*3+8
929
img_brick3:
928
img_brick3:
930
    rb 40*20*3+8
929
    rb 40*20*3+8
931
img_brick4:
930
img_brick4:
932
    rb 40*20*3+8
931
    rb 40*20*3+8
933
img_ball:
932
img_ball:
934
    rb 10*10*3+8
933
    rb 10*10*3+8
935
img_bonus:
934
img_bonus:
936
    rb 20*10*3+8
935
    rb 20*10*3+8
937
 
936
 
938
 
937
 
939
screen_img:
938
screen_img:
940
    dd X_SIZE
939
    dd X_SIZE
941
    dd Y_SIZE
940
    dd Y_SIZE
942
screen:
941
screen:
943
    rb X_SIZE*Y_SIZE*3
942
    rb X_SIZE*Y_SIZE*3
944
proc_info:
943
proc_info:
945
    rb 1024
944
    rb 1024
946
I_END:
945
I_END:
947
>
946
>
948
>
947
>
949
>
948
>
950
>
949
>
951
>
950
>
952
>
951
>
953
>
952
>
954
>
953
>
955
>
954
>
956
>
955
>
957
>
956
>
958
>
957
>
959
>
958
>
960
>
959
>
961
>
960
>