Subversion Repositories Kolibri OS

Rev

Rev 1522 | Rev 1677 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1518 dunkaist 1
;;===HEADER====================================================================================================================
2
 
3
use32
4
    org 0x0
5
    db  'MENUET01'
1566 dunkaist 6
    dd  0x01,start,i_end,d_end,stacktop,0x0,cur_dir_path
1518 dunkaist 7
 
8
;;---HEADER--------------------------------------------------------------------------------------------------------------------
9
 
10
include '../../../proc32.inc'
11
include '../../../macros.inc'
12
include '../../../system/launch/trunk/mem.inc'
13
include '../../../develop/libraries/libs-dev/.test/dll.inc'
14
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
1520 dunkaist 15
;include '../../../system/board/trunk/debug.inc'
1518 dunkaist 16
 
17
;;===Define_chapter============================================================================================================
18
 
1566 dunkaist 19
GRID_WIDTH                  equ     28
20
GRID_HEIGHT                 equ     14
21
 
22
MIN_SQUARE_SIDE_LENGTH      equ     9
23
 
1518 dunkaist 24
SCORE_EAT                   equ     100
25
 
26
LEFT                        equ     0
27
DOWN                        equ     1
28
UP                          equ     2
29
RIGHT                       equ     3
30
 
1566 dunkaist 31
struct  LEVEL
32
    field                   db      GRID_WIDTH*GRID_HEIGHT  dup (?)
33
    snake_dots              db      6   dup (?)
34
    snake_direction         dd      ?
35
    snake_direction_next    dd      ?
36
    number_of_stones        dd      ?
37
ends
38
 
39
CLASSIC_MODE                equ     0
40
LEVELS_MODE                 equ     1
41
 
42
CLASSIC_MODE_FIRST_LEVEL    equ     0
43
LEVELS_MODE_FIRST_LEVEL     equ     1
44
 
45
EAT_TO_END_LEVEL            equ     12
46
PAUSE_BETWEEN_LEVELS        equ     250
47
PAUSE_WHILE_DRAWING_SPLASH  equ     4
48
 
49
CHAMPION_NAME_LENGTH        equ     15
50
LAST_LEVEL_NUMBER           equ     12
51
 
1518 dunkaist 52
;;---Define_chapter------------------------------------------------------------------------------------------------------------
53
 
54
start:
55
 
56
stdcall dll.Load,@IMPORT
57
    or   eax, eax
58
    jnz  Exit
59
 
60
align 4
61
 
62
    mov  eax, cur_dir_path
63
  @@:
64
    cmp  byte[eax], 0
65
     jz  @f
66
    inc  eax
67
     jmp @b
68
  @@:
69
    mov  dword[eax],    '.ini'
70
 
1520 dunkaist 71
      invoke  ini.get_int, cur_dir_path, aPreferences, aSpeed, 80
1518 dunkaist 72
    neg  eax
73
    add  [time_wait_limit],    eax
1522 dunkaist 74
      invoke  ini.get_str, cur_dir_path, aPreferences, aTheme, aTheme_name, 31, aTheme_name
75
 
76
      invoke  ini.get_int, cur_dir_path, aTheme_name, aDecorations, 2
1566 dunkaist 77
    mov  [decorations], eax
1522 dunkaist 78
      invoke  ini.get_color, cur_dir_path, aTheme_name, aBackground_color, 0x000000
1518 dunkaist 79
    or   [background_color],    eax
80
    or   [window_style],    eax
1566 dunkaist 81
      invoke  ini.get_color, cur_dir_path, aTheme_name, aDecorations_color, 0xAAAA00
1518 dunkaist 82
    or   [decorations_color],  eax
1522 dunkaist 83
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_color, 0x1111ff
1518 dunkaist 84
    or   [snake_color], eax
1566 dunkaist 85
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_head_color, 0x6B6Bff
1518 dunkaist 86
    or   [snake_head_color], eax
1522 dunkaist 87
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_picture_color, 0x4488ff
1518 dunkaist 88
    or   [snake_picture_color], eax
1522 dunkaist 89
      invoke  ini.get_color, cur_dir_path, aTheme_name, aVersion_picture_color, 0x55ff55
1518 dunkaist 90
    or   [version_picture_color],   eax
1522 dunkaist 91
      invoke  ini.get_color, cur_dir_path, aTheme_name, aPause_picture_color, 0x11ff11
1518 dunkaist 92
    or   [pause_picture_color], eax
1522 dunkaist 93
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_picture_color, 0xff1111
1518 dunkaist 94
    or   [game_over_picture_color], eax
1566 dunkaist 95
      invoke  ini.get_color, cur_dir_path, aTheme_name, aYou_win_picture_color, 0xffff11
96
    or   [you_win_picture_color],   eax
1522 dunkaist 97
      invoke  ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11
1518 dunkaist 98
    or   [eat_color],   eax
1522 dunkaist 99
      invoke  ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777
1518 dunkaist 100
    or   [navigation_strings_color], eax
1522 dunkaist 101
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900
1518 dunkaist 102
    or   [game_over_strings_color],  eax
1522 dunkaist 103
      invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff
1518 dunkaist 104
    or   [score_string_color],   eax
1566 dunkaist 105
      invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_string_color, 0xffffff
106
    or   [level_string_color],  eax
1522 dunkaist 107
      invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff
1518 dunkaist 108
    or   [hiscore_string_color],   eax
1522 dunkaist 109
      invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff
1518 dunkaist 110
    or   [champion_string_color],   eax
1522 dunkaist 111
      invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44
1518 dunkaist 112
    or   [game_over_hiscore_color], eax
1522 dunkaist 113
      invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff
1518 dunkaist 114
    or   [score_number_color],   eax
1566 dunkaist 115
      invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_number_color, 0xffffff
116
    or   [level_number_color],  eax
1522 dunkaist 117
      invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff
1518 dunkaist 118
    or   [hiscore_number_color],   eax
1522 dunkaist 119
      invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff
1518 dunkaist 120
    or   [champion_name_color],   eax
1522 dunkaist 121
      invoke  ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00
1566 dunkaist 122
    or   [edit1.shift_color],   eax
123
      invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_color, 0xDDDDDD
124
    or   [button_color],    eax
125
      invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_text_color, 0x000000
126
    or   [button_text_color],   eax
127
      invoke  ini.get_color, cur_dir_path, aTheme_name, aStone_color, 0x5f8700
128
    or   [stone_color], eax
129
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00
130
    or   [splash_background_color],    eax
131
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_number_color, 0x000000
132
    or   [splash_level_number_color],   eax
133
      invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_string_color, 0x000000
134
    or   [splash_level_string_color],   eax
1518 dunkaist 135
 
1566 dunkaist 136
      invoke  ini.get_int, cur_dir_path, aReserved, aSquare_side_length, 19
137
    mov  [square_side_length],  eax
138
      invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, CHAMPION_NAME_LENGTH, champion_name_classic
139
      invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_classic, 777
140
    or   [hi_score_classic],    eax
141
      invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, CHAMPION_NAME_LENGTH, champion_name_levels
142
      invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_levels, 777
143
    or   [hi_score_levels], eax
144
 
1520 dunkaist 145
    mov  eax, [background_color]
1566 dunkaist 146
    mov  [edit1.color], eax
147
    mov  [edit1.focus_border_color],    eax
148
    mov  [edit1.blur_border_color], eax
1520 dunkaist 149
    mov  eax, [game_over_hiscore_color]
1566 dunkaist 150
    mov  [edit1.text_color],    eax
1520 dunkaist 151
 
1566 dunkaist 152
      mcall     37,4,cursor_data,2                  ; load empty cursor (for "hiding" cursor while level_mode)
153
    mov  [cursor_handle],   eax
154
 
1522 dunkaist 155
      call      Set_geometry
156
 
1518 dunkaist 157
include 'first_menu.asm'            ; First menu body and functions
158
include 'level.asm'                 ; Level body and functions (game process)
159
include 'pause.asm'                 ; Pause body and functions
160
include 'game_over.asm'             ; Game_over body and functions
161
 
162
;;===Some_functions============================================================================================================
163
 
1566 dunkaist 164
 
165
Save_do_smth_else_and_exit:
166
    ;;===Save_do_smth_else_and_exit============================================================================================
167
 
168
      mcall     37,6,[cursor_handle]                ; delete cursor
169
 
170
      invoke    ini.set_int, cur_dir_path, aReserved, aSquare_side_length, [square_side_length]
171
 
172
    mov  edi, champion_name_classic
173
    xor  al,  al
174
    mov  ecx, CHAMPION_NAME_LENGTH+1
175
    cld
176
    repne scasb
177
    neg  ecx
178
    add  ecx, CHAMPION_NAME_LENGTH
179
      invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, ecx
180
      invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_classic, [hi_score_classic]
181
 
182
    mov  edi, champion_name_levels
183
    xor  al,  al
184
    mov  ecx, CHAMPION_NAME_LENGTH+1
185
    cld
186
    repne scasb
187
    neg  ecx
188
    add  ecx, CHAMPION_NAME_LENGTH
189
      invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, ecx
190
      invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_levels, [hi_score_levels]
191
 
192
    ;;---Save_do_smth_else_and_exit--------------------------------------------------------------------------------------------
193
 
194
 
1518 dunkaist 195
Exit:
1522 dunkaist 196
    ;;===Exit==================================================================================================================
1518 dunkaist 197
 
198
    or  eax,    -1
199
    int 0x40
200
 
1522 dunkaist 201
    ;;---Exit------------------------------------------------------------------------------------------------------------------
202
 
203
 
204
Set_geometry:
205
    ;;===Set_geometry==========================================================================================================
206
 
1566 dunkaist 207
    mov  eax, [square_side_length]
208
    inc  eax                                            ; space between squares
1522 dunkaist 209
    mov  [g_s],   eax
210
 
211
    mov  eax, [g_s]
212
    shr  eax, 1
213
    mov  ebx, eax
214
    shr  ebx, 1
215
    add  eax, ebx
216
    mov  [g_e], eax
217
 
218
    mov  eax, [g_s]
219
    add  eax, [g_e]
220
    mov  [gbxm1],   eax
221
 
222
    mov  eax, [g_e]
223
    add  eax, 25
224
    mov  [gbym1],   eax
225
 
1566 dunkaist 226
    mov  edx, GRID_WIDTH
1522 dunkaist 227
    mov  eax, [g_s]
228
    mul  dx
229
    mov  [gw_mul_gs],   eax
230
 
1566 dunkaist 231
    mov  edx, GRID_HEIGHT
1522 dunkaist 232
    mov  eax, [g_s]
233
    mul  dx
234
    mov  [gh_mul_gs],   eax
235
 
236
    mov  eax, [gbxm1]
237
    add  eax, [gw_mul_gs]
238
    mov  [gbxm1_plus_gw_mul_gs],    eax
239
 
240
    mov  eax, [gbym1]
241
    add  eax, [gh_mul_gs]
242
    mov  [gbym1_plus_gh_mul_gs],    eax
243
 
244
    mov  eax, [g_s]
245
    shl  eax, 16
246
    add  eax, [g_s]
247
    mov  [gs_shl16_gs], eax
248
 
249
    mov  eax, [gbxm1]
250
    shl  eax, 16
251
    add  eax, [gbxm1]
252
    mov  [gbxm1_shl16_gbxm1],   eax
253
 
254
    mov  eax, [gbym1]
255
    shl  eax, 16
256
    add  eax, [gbym1]
257
    mov  [gbym1_shl16_gbym1],   eax
258
 
259
 
260
    mov  eax, [gw_mul_gs]
261
    add  eax, [gbxm1]
262
    add  eax, [gbxm1]
263
    add  eax, 5*2                                   ; skin width
264
    mov  [window_width],    eax
265
 
1566 dunkaist 266
      mcall     48,4                                ; get skin header height
267
    add  eax, [gh_mul_gs]
1522 dunkaist 268
    add  eax, [gbym1]
269
    add  eax, [g_e]
270
    add  eax, 30
1566 dunkaist 271
    add  eax, 5                                      ; skin height (bottom part)
1522 dunkaist 272
    mov  [window_height],   eax
273
 
274
      mcall     48, 5
275
    mov  dx,  ax
276
    shr  eax, 16
277
    sub  dx,  ax
278
    cmp  dx, word[window_width]                     ; does window fit to work area width?
279
     jnl @f
280
    dec  [square_side_length]
281
     jmp Set_geometry
282
  @@:
283
 
284
    mov  cx,  bx
285
    shr  ebx, 16
286
    sub  cx,  bx
287
    cmp  cx, word[window_height]                     ; does window fit to work area height?
288
     jnl @f
289
    dec  [square_side_length]
290
     jmp Set_geometry
291
  @@:
292
 
293
    sub  dx,  word[window_width]
294
    shr  dx,  1
295
    mov  word[wp_x],    dx
296
    sub  cx,  word[window_height]
297
    shr  cx,  1
298
    mov  dx,  cx
299
    shr  cx,  1
300
    add  cx,  dx
301
    mov  word[wp_y],    cx
302
 
303
    mov  [top_strings], 8
304
    mov  eax, [window_height]
305
    sub  eax, 50
306
    mov  [bottom_top_strings],  eax
307
    add  eax, 6
308
    mov  [bottom_middle_strings],  eax
309
    add  eax, 6
310
    mov  [bottom_bottom_strings],  eax
311
 
312
    sub  eax, 4
1566 dunkaist 313
    mov  [edit1.top],   eax
1522 dunkaist 314
 
1566 dunkaist 315
 
316
    mov  eax, [g_s]
317
    shl  eax, 2
318
    sub  eax, 2
319
    mov  [button_width_short],  eax
320
    mov  eax, [g_s]
321
    shl  eax, 3
322
    add  eax, [g_s]
323
    sub  eax, 2
324
    mov  [button_width_long],   eax
325
    mov  eax, [g_s]
326
    sub  eax, 2
327
    mov  [button_height],   eax
328
 
329
    mov  bl,  0x10
330
    mov  cl,  0x08
331
 
332
    mov  al,  byte[g_s]
333
    mul  bl
334
    mov  bx,  ax
335
    add  bx,  word[gbxm1]
336
    inc  bx
337
 
338
    mov  al,  byte[g_s]
339
    mul  cl
340
    mov  cx,  ax
341
    add  cx,  word[gbym1]
342
    inc  cx
343
 
344
    mov  [button_x_left],   ebx
345
    mov  [button_y_top],    ecx
346
 
347
    add  ebx, [g_s]
348
    add  ebx, [g_s]
349
    add  ebx, [g_s]
350
    add  ebx, [g_s]
351
    add  ebx, [g_s]
352
 
353
    mov  [button_x_right],  ebx
354
 
355
    add  ecx,  [g_s]
356
    add  ecx,  [g_s]
357
 
358
    mov  [button_y_middle], ecx
359
 
360
    add  ecx,  [g_s]
361
    add  ecx,  [g_s]
362
 
363
    mov  [button_y_bottom], ecx
364
 
365
 
1522 dunkaist 366
    ret
367
 
368
    ;;---Set_geometry------------------------------------------------------------------------------------------------------
369
 
370
 
1566 dunkaist 371
Increase_geometry:
372
    ;;===Increase_geometry=================================================================================================
373
 
374
    inc  [square_side_length]
375
      call      Set_geometry
376
      mcall     67,[wp_x],[wp_y],[window_width],[window_height]
377
 
378
    ret
379
 
380
    ;;---Increase_geometry-------------------------------------------------------------------------------------------------
381
 
382
 
383
Decrease_geometry:
384
    ;;===Decrease_geometry=================================================================================================
385
 
386
    cmp  [square_side_length],  MIN_SQUARE_SIDE_LENGTH
387
     je  @f
388
    dec  [square_side_length]
389
      call      Set_geometry
390
      mcall     67,[wp_x],[wp_y],[window_width],[window_height]
391
 
392
  @@:
393
    ret
394
 
395
    ;;---Decrease_geometry-------------------------------------------------------------------------------------------------
396
 
397
 
1518 dunkaist 398
Draw_decorations:
399
    ;;===Draw_decorations==================================================================================================
400
 
1566 dunkaist 401
    mov  al, byte[decorations]
1522 dunkaist 402
    dec  al
403
     jz  grid_lines
404
    dec  al
405
     jz  grid_lines_with_ends
406
    dec  al
407
     jz  grid_lines_with_corners
408
    dec  al
409
     jz  grid_dots
410
    dec  al
411
     jz  borders_lines
412
    dec  al
413
     jz  borders_lines_with_corners
414
    dec  al
415
     jz  borders_dots
416
    dec  al
417
     jz  corners_dots
418
    dec  al
419
     jz  corners_inner
420
    dec  al
421
     jz  corners_outer
422
    dec  al
423
     jz  corners_crosses
1518 dunkaist 424
    ret
425
 
426
 
427
  grid_lines:
428
 
429
    mov  eax, 38
1522 dunkaist 430
;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1)
431
    mov  ebx, [gbxm1_shl16_gbxm1]
432
;mov  ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP)
433
    mov  ecx, [gbym1_shl16_gbym1]
434
    add  ecx, [gh_mul_gs]
1518 dunkaist 435
    mov  edx, [decorations_color]
1566 dunkaist 436
    mov  esi, GRID_WIDTH
1522 dunkaist 437
    add  esi, 1
1518 dunkaist 438
 
439
  @@:
440
      mcall
1522 dunkaist 441
    add  ebx, [gs_shl16_gs]
442
    dec  esi
443
     jnz @b
1518 dunkaist 444
 
1522 dunkaist 445
;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)
446
    mov  ebx, [gbxm1_shl16_gbxm1]
447
    add  ebx, [gw_mul_gs]
448
    mov  ecx, [gbym1_shl16_gbym1]
1566 dunkaist 449
    mov  esi, GRID_HEIGHT
1522 dunkaist 450
    add  esi, 1
1518 dunkaist 451
 
452
  @@:
453
      mcall
1522 dunkaist 454
    add  ecx, [gs_shl16_gs]
455
    dec  esi
456
     jnz @b
1518 dunkaist 457
 
458
    ret
459
 
460
 
461
  grid_lines_with_ends:
462
 
463
    mov  eax, 38
1522 dunkaist 464
    mov  ebx, [gbxm1_shl16_gbxm1]
465
    mov  ecx, [gbym1]
466
    sub  ecx, [g_e]
467
    shl  ecx, 16
468
    add  ecx, [gbym1_plus_gh_mul_gs]
469
    add  ecx, [g_e]
1518 dunkaist 470
    mov  edx, [decorations_color]
1566 dunkaist 471
    mov  esi, GRID_WIDTH
1522 dunkaist 472
    add  esi, 1
1518 dunkaist 473
 
474
  @@:
475
      mcall
1522 dunkaist 476
    add  ebx, [gs_shl16_gs]
477
    dec  esi
478
     jnz @b
1518 dunkaist 479
 
1522 dunkaist 480
    mov  ebx, [gbxm1]
481
    sub  ebx, [g_e]
482
    shl  ebx, 16
483
    add  ebx, [gbxm1_plus_gw_mul_gs]
484
    add  ebx, [g_e]
485
    mov  ecx, [gbym1_shl16_gbym1]
1566 dunkaist 486
    mov  esi, GRID_HEIGHT
1522 dunkaist 487
    add  esi, 1
1518 dunkaist 488
 
489
  @@:
490
      mcall
1522 dunkaist 491
    add  ecx, [gs_shl16_gs]
492
    dec  esi
493
     jnz @b
1518 dunkaist 494
 
495
    ret
496
 
497
 
498
  grid_lines_with_corners:
499
 
500
      call      grid_lines
501
      call      corners_outer
502
 
503
    ret
504
 
505
 
506
  grid_dots:
507
 
508
    mov  eax, 1
1522 dunkaist 509
    mov  ebx, [gbxm1]
510
    mov  ecx, [gbym1]
1518 dunkaist 511
    mov  edx, [decorations_color]
512
 
513
  @@:
514
      mcall
1522 dunkaist 515
    add  ebx, [g_s]
516
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 517
     jng @b
1522 dunkaist 518
    add  ecx, [g_s]
519
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 520
     jg  @f
1522 dunkaist 521
    mov  ebx, [gbxm1]
1518 dunkaist 522
     jmp @b
523
 
524
  @@:
525
    ret
526
 
527
 
528
  borders_lines:
529
 
1522 dunkaist 530
    mov  eax, 38
531
    mov  ebx, [gbxm1_shl16_gbxm1]
532
    mov  ecx, [gbym1_shl16_gbym1]
533
    add  ecx, [gh_mul_gs]
534
    mov  edx, [decorations_color]
535
      mcall
1518 dunkaist 536
 
1522 dunkaist 537
    mov  ebx, [gbxm1_plus_gw_mul_gs]
538
    shl  ebx, 16
539
    add  ebx, [gbxm1_plus_gw_mul_gs]
540
      mcall
541
 
542
    mov  ebx, [gbxm1_shl16_gbxm1]
543
    add  ebx, [gw_mul_gs]
544
    mov  ecx, [gbym1_shl16_gbym1]
545
      mcall
546
 
547
    mov  ecx, [gbym1_plus_gh_mul_gs]
548
    shl  ecx, 16
549
    add  ecx, [gbym1_plus_gh_mul_gs]
550
      mcall
551
 
1518 dunkaist 552
    ret
553
 
554
 
1522 dunkaist 555
  borders_lines_with_corners:
1518 dunkaist 556
 
557
      call      borders_lines
558
      call      corners_outer
559
 
560
    ret
561
 
562
 
563
  borders_dots:
564
 
565
    mov  eax, 1
1522 dunkaist 566
    mov  ebx, [gbxm1]
567
    mov  ecx, [gbym1]
1518 dunkaist 568
    mov  edx, [decorations_color]
569
  @@:
570
      mcall
1522 dunkaist 571
    add  ebx, [g_s]
572
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 573
     jng @b
574
 
1522 dunkaist 575
    mov  ebx, [gbxm1]
576
    mov  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 577
  @@:
578
      mcall
1522 dunkaist 579
    add  ebx, [g_s]
580
    cmp  ebx, [gbxm1_plus_gw_mul_gs]
1518 dunkaist 581
     jng @b
582
 
1522 dunkaist 583
    mov  ebx, [gbxm1]
584
    mov  ecx, [gbym1]
1518 dunkaist 585
  @@:
586
      mcall
1522 dunkaist 587
    add  ecx, [g_s]
588
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 589
     jng @b
590
 
1522 dunkaist 591
    mov  ebx, [gbxm1_plus_gw_mul_gs]
592
    mov  ecx, [gbym1]
1518 dunkaist 593
  @@:
594
      mcall
1522 dunkaist 595
    add  ecx, [g_s]
596
    cmp  ecx, [gbym1_plus_gh_mul_gs]
1518 dunkaist 597
     jng @b
598
 
599
    ret
600
 
601
 
602
  corners_dots:
603
 
1522 dunkaist 604
    mov  eax, 13
605
    mov  ebx, [gbxm1]
606
    dec  ebx
607
    shl  ebx, 16
608
    add  ebx, 2
609
    mov  ecx, [gbym1]
610
    dec  ecx
611
    shl  ecx, 16
612
    add  ecx, 2
613
    mov  edx, [decorations_color]
614
      mcall
1518 dunkaist 615
 
1522 dunkaist 616
    mov  ebx, [gbxm1_plus_gw_mul_gs]
617
    shl  ebx, 16
618
    add  ebx, 2
619
      mcall
620
 
621
    mov  ebx, [gbxm1]
622
    dec  ebx
623
    shl  ebx, 16
624
    add  ebx, 2
625
    mov  ecx, [gbym1_plus_gh_mul_gs]
626
    shl  ecx, 16
627
    add  ecx, 2
628
      mcall
629
 
630
    mov  ebx, [gbxm1_plus_gw_mul_gs]
631
    shl  ebx, 16
632
    add  ebx, 2
633
      mcall
634
 
1518 dunkaist 635
    ret
636
 
637
 
638
  corners_inner:
639
 
1522 dunkaist 640
    mov  eax, 38
641
    mov  ebx, [gbxm1_shl16_gbxm1]
642
    add  ebx, [g_e]
643
    mov  ecx, [gbym1_shl16_gbym1]
644
    mov  edx, [decorations_color]
645
      mcall
1518 dunkaist 646
 
1522 dunkaist 647
    mov  ecx, [gbym1_plus_gh_mul_gs]
648
    shl  ecx, 16
649
    add  ecx, [gbym1_plus_gh_mul_gs]
650
      mcall
651
 
652
    mov  ebx, [gbxm1_plus_gw_mul_gs]
653
    sub  ebx, [g_e]
654
    shl  ebx, 16
655
    add  ebx, [gbxm1_plus_gw_mul_gs]
656
      mcall
657
 
658
    mov  ecx, [gbym1_shl16_gbym1]
659
      mcall
660
 
661
    mov  ebx, [gbxm1_shl16_gbxm1]
662
    mov  ecx, [gbym1_shl16_gbym1]
663
    add  ecx, [g_e]
664
      mcall
665
 
666
    mov  ebx, [gbxm1_plus_gw_mul_gs]
667
    shl  ebx, 16
668
    add  ebx, [gbxm1_plus_gw_mul_gs]
669
      mcall
670
 
671
    mov  ecx, [gbym1_plus_gh_mul_gs]
672
    sub  ecx, [g_e]
673
    shl  ecx, 16
674
    add  ecx, [gbym1_plus_gh_mul_gs]
675
      mcall
676
 
677
    mov  ebx, [gbxm1_shl16_gbxm1]
678
      mcall
679
 
1518 dunkaist 680
    ret
681
 
682
 
683
  corners_outer:
684
 
1522 dunkaist 685
    mov  eax, 38
686
    mov  ebx, [gbxm1_shl16_gbxm1]
687
    sub  ebx, [g_e]
688
    mov  ecx, [gbym1_shl16_gbym1]
689
    mov  edx, [decorations_color]
690
      mcall
1518 dunkaist 691
 
1522 dunkaist 692
    mov  ecx, [gbym1_plus_gh_mul_gs]
693
    shl  ecx, 16
694
    add  ecx, [gbym1_plus_gh_mul_gs]
695
      mcall
696
 
697
    mov  ebx, [gbxm1_plus_gw_mul_gs]
698
    shl  ebx, 16
699
    add  ebx, [gbxm1_plus_gw_mul_gs]
700
    add  ebx, [g_e]
701
      mcall
702
 
703
    mov  ecx, [gbym1_shl16_gbym1]
704
      mcall
705
 
706
    mov  ebx, [gbxm1_shl16_gbxm1]
707
    mov  ecx, [gbym1_shl16_gbym1]
708
    sub  ecx, [g_e]
709
      mcall
710
 
711
    mov  ebx, [gbxm1_plus_gw_mul_gs]
712
    shl  ebx, 16
713
    add  ebx, [gbxm1_plus_gw_mul_gs]
714
      mcall
715
 
716
    mov  ecx, [gbym1_plus_gh_mul_gs]
717
    shl  ecx, 16
718
    add  ecx, [gbym1_plus_gh_mul_gs]
719
    add  ecx, [g_e]
720
      mcall
721
 
722
    mov  ebx, [gbxm1_shl16_gbxm1]
723
      mcall
724
 
1518 dunkaist 725
    ret
726
 
727
 
728
  corners_crosses:
729
 
730
      call      corners_inner
731
      call      corners_outer
732
 
733
    ret
734
 
735
 
736
    ;;---Draw_decorations--------------------------------------------------------------------------------------------------
737
 
738
 
739
Draw_square:
740
    ;;===Draw_square=======================================================================================================
741
    ;; bl   -   x_coord
742
    ;; bh   -   y_coord
743
    ;; edx  -   color
744
 
1566 dunkaist 745
    push eax ebx ecx edx
746
 
1518 dunkaist 747
    mov  cl,  bh
748
 
1522 dunkaist 749
    mov  al,  byte[g_s]
1518 dunkaist 750
    mul  bl
751
    mov  bx,  ax
1522 dunkaist 752
    add  bx,  word[gbxm1]
753
    inc  bx
1518 dunkaist 754
    shl  ebx, 16
1522 dunkaist 755
    add  ebx, [g_s]
756
    dec  ebx
1518 dunkaist 757
 
1522 dunkaist 758
    mov  al,  byte[g_s]
1518 dunkaist 759
    mul  cl
760
    mov  cx,  ax
1522 dunkaist 761
    add  cx,  word[gbym1]
762
    inc  cx
1518 dunkaist 763
    shl  ecx, 16
1522 dunkaist 764
    add  ecx, [g_s]
765
    dec  ecx
1566 dunkaist 766
 
1518 dunkaist 767
      mcall     13
768
 
1566 dunkaist 769
    pop  edx ecx ebx eax
770
 
1518 dunkaist 771
    ret
772
 
773
    ;;---Draw_square-------------------------------------------------------------------------------------------------------
774
 
775
 
776
Draw_menu_esc:
777
    ;;===Draw_menu_esc=====================================================================================================
778
 
1522 dunkaist 779
    mov  ebx, [window_width]
780
    shr  ebx, 1
1566 dunkaist 781
    sub  ebx, string_menu_esc.size*3+6
1522 dunkaist 782
    shl  ebx, 16
783
    add  ebx, dword[top_strings]
784
      mcall     4, ,[navigation_strings_color],string_menu_esc
1518 dunkaist 785
 
786
    ret
787
 
788
    ;;---Draw_menu_esc-----------------------------------------------------------------------------------------------------
789
 
790
 
791
Draw_score_string:
792
    ;;===Draw_score_string=================================================================================================
1522 dunkaist 793
 
794
    mov  ebx, [window_width]
795
    shr  ebx, 3
796
    sub  ebx, 5
797
    shl  ebx, 16
798
    add  ebx, dword[bottom_top_strings]
799
      mcall     4, ,[score_string_color],string_score
1566 dunkaist 800
 
1518 dunkaist 801
    ret
1566 dunkaist 802
 
1518 dunkaist 803
    ;;---Draw_score_string-------------------------------------------------------------------------------------------------
804
 
805
 
806
Draw_score_number:
807
    ;;===Draw_score_number=================================================================================================
1522 dunkaist 808
 
809
    mov  edx, [window_width]
810
    shr  edx, 3
1566 dunkaist 811
    sub  edx, 5+1
812
    add  edx, string_score.size*6
1522 dunkaist 813
    shl  edx, 16
814
    add  edx, dword[bottom_top_strings]
815
      mcall     47,0x00070000,[score], ,[score_number_color],[background_color]
1566 dunkaist 816
 
1518 dunkaist 817
    ret
1566 dunkaist 818
 
1518 dunkaist 819
    ;;---Draw_score_number-------------------------------------------------------------------------------------------------
820
 
821
 
822
Draw_hiscore_string:
823
    ;;===Draw_hiscore_string===============================================================================================
824
 
1522 dunkaist 825
    mov  ebx, [window_width]
826
    shr  ebx, 3
827
    neg  ebx
828
    add  ebx, [window_width]
1566 dunkaist 829
    sub  ebx, string_hi_score.size*6+7*6+5
1522 dunkaist 830
    shl  ebx, 16
831
    add  ebx, dword[bottom_top_strings]
832
      mcall     4, ,[hiscore_string_color],string_hi_score
1518 dunkaist 833
 
834
    ret
835
 
836
    ;;---Draw_hiscore_string-----------------------------------------------------------------------------------------------
837
 
1566 dunkaist 838
 
1518 dunkaist 839
Draw_hiscore_number:
1566 dunkaist 840
    ;;===Draw_hiscore_number===================================================================================================
1518 dunkaist 841
 
1522 dunkaist 842
    mov  edx, [window_width]
843
    shr  edx, 3
844
    neg  edx
845
    add  edx, [window_width]
846
    sub  edx, 7*6+6
847
    shl  edx, 16
848
    add  edx, dword[bottom_top_strings]
1518 dunkaist 849
 
1566 dunkaist 850
    cmp  [play_mode],   CLASSIC_MODE
851
     jne @f
852
    mov  ecx, [hi_score_classic]
853
     jmp .done
854
  @@:
855
    mov  ecx, [hi_score_levels]
856
 
857
  .done:
858
      mcall     47,0x00070000, , ,[hiscore_number_color]
859
 
1518 dunkaist 860
    ret
861
 
1566 dunkaist 862
    ;;---Draw_hiscore_number---------------------------------------------------------------------------------------------------
863
 
864
 
1518 dunkaist 865
Draw_champion_string:
1566 dunkaist 866
    ;;===Draw_champion_string==================================================================================================
1518 dunkaist 867
 
1522 dunkaist 868
    mov  ebx, [window_width]
869
    shr  ebx, 3
870
    neg  ebx
871
    add  ebx, [window_width]
1566 dunkaist 872
    sub  ebx, string_champion.size*6+7*6+5
1522 dunkaist 873
    shl  ebx, 16
874
    add  ebx, dword[bottom_bottom_strings]
875
      mcall     4, ,[champion_string_color],string_champion
1518 dunkaist 876
 
877
    ret
878
 
879
    ;;---Draw_champion_string----------------------------------------------------------------------------------------------
880
 
881
 
882
Draw_champion_name:
883
    ;;===Draw_champion_name================================================================================================
884
 
1522 dunkaist 885
    mov  ebx, [window_width]
886
    shr  ebx, 3
887
    neg  ebx
888
    add  ebx, [window_width]
1566 dunkaist 889
    sub  ebx, CHAMPION_NAME_LENGTH/2*6+7*6+6                ; there is no difference between length of champion names for other play_modes
890
    add  ebx, CHAMPION_NAME_LENGTH/2*6
1522 dunkaist 891
    shl  ebx, 16
892
    add  ebx, dword[bottom_bottom_strings]
1518 dunkaist 893
 
1566 dunkaist 894
    cmp  [play_mode],   CLASSIC_MODE
895
     jne @f
896
    mov  edx, champion_name_classic
897
     jmp .done
898
  @@:
899
    mov  edx, champion_name_levels
900
 
901
  .done:
902
      mcall     4, ,[champion_name_color],
903
 
1518 dunkaist 904
    ret
905
 
906
    ;;---Draw_champion_name------------------------------------------------------------------------------------------------
907
 
908
 
909
Draw_picture:
910
    ;;===Draw_picture======================================================================================================
911
    ;;  in  :
1522 dunkaist 912
    ;;           ax =   number of left square *0x100+ picture width (in squares)
913
    ;;           cx =   number of top square *0x100+ picture height (in squares)
1518 dunkaist 914
    ;;          edx =   picture color
1522 dunkaist 915
    ;;          esi =   pointer to picture data
1518 dunkaist 916
    ;;
917
 
1522 dunkaist 918
    add  al,  ah
919
    add  cl,  ch
920
    mov  bh,  ch
921
 
1518 dunkaist 922
  .draw:
1522 dunkaist 923
    mov  bl,  ah
1518 dunkaist 924
 
925
  .loop:
1522 dunkaist 926
    cmp  byte[esi], 0
1518 dunkaist 927
     jz  @f
1522 dunkaist 928
    push eax ebx ecx esi
1518 dunkaist 929
      call      Draw_square
1522 dunkaist 930
    pop  esi ecx ebx eax
1518 dunkaist 931
 
932
  @@:
1522 dunkaist 933
    inc  esi
1518 dunkaist 934
    inc  bl
1522 dunkaist 935
    cmp  bl,  al
1518 dunkaist 936
     jne .loop
937
 
1522 dunkaist 938
    inc  bh
939
    cmp  bh,  cl
940
     jne .draw
1518 dunkaist 941
    ret
942
 
943
    ;;---Draw_picture------------------------------------------------------------------------------------------------------
944
 
945
 
946
Draw_on_map:
947
    ;;===Draw_on_map=======================================================================================================
948
    ;;  in  :
949
    ;;           al =   x coord
950
    ;;           ah =   y coord
951
    ;;           cl =   value to draw
952
    ;;
953
 
1566 dunkaist 954
    push eax ebx edx
955
 
1518 dunkaist 956
    and  eax, 0x0000ffff
957
    xor  bx,  bx
958
    mov  bl,  al
959
    shr  ax,  8
1566 dunkaist 960
    mov  dx,  GRID_WIDTH
1518 dunkaist 961
    mul  dx
962
    add  ax,  bx
1566 dunkaist 963
    mov  edx, field_map
964
    add  edx, eax
965
    mov  [edx], cl
966
 
967
    pop edx ebx eax
1518 dunkaist 968
 
969
    ret
970
 
1566 dunkaist 971
    ;;---Draw_on_map-----------------------------------------------------------------------------------------------------------
1518 dunkaist 972
 
973
 
974
Get_from_map:
1566 dunkaist 975
    ;;===Get_from_map==========================================================================================================
1518 dunkaist 976
    ;;  in  :
977
    ;;           al =   x coord
978
    ;;           ah =   y coord
979
    ;;  out :
1522 dunkaist 980
    ;;           bl =   value on map
1518 dunkaist 981
    ;;
982
 
983
    push eax
984
 
985
    and  eax, 0x0000ffff
986
    xor  bx,  bx
987
    mov  bl,  al
988
    shr  ax,  8
1566 dunkaist 989
    mov  dx,  GRID_WIDTH
1518 dunkaist 990
    mul  dx
991
    add  ax,  bx
992
    mov  edi, field_map
993
    add  edi, eax
994
    mov  bl,  [edi]
995
 
996
    pop  eax
997
 
998
    ret
999
 
1566 dunkaist 1000
    ;;---Get_from_map-----------------------------------------------------------------------------------------------------------
1518 dunkaist 1001
 
1002
 
1566 dunkaist 1003
Load_level:
1004
    ;;===Load_level=============================================================================================================
1005
    ;;  in  :
1006
    ;;          cur_level_number    =   level number to load
1007
    ;;
1518 dunkaist 1008
 
1566 dunkaist 1009
    mov  eax, [cur_level_number]
1010
    mov  edx, stage_00
1011
  @@:
1012
    test al,  al
1013
     jz  @f
1014
    add  edx, 410
1015
    dec  al
1016
     jmp @b
1017
  @@:
1018
 
1019
    mov  [cur_level],   edx
1518 dunkaist 1020
 
1566 dunkaist 1021
    mov  esi, edx
1022
    add  esi, LEVEL.field
1023
    mov  edi, field_map
1024
    mov  ecx, GRID_WIDTH*GRID_HEIGHT/4
1025
    rep  movsd
1518 dunkaist 1026
 
1566 dunkaist 1027
    mov  esi, edx
1028
    add  esi, LEVEL.snake_dots
1029
    mov  edi, snake_dots
1030
    mov  ecx, 3
1031
    rep  movsw
1032
 
1033
    mov  esi, edx
1034
    add  esi, LEVEL.snake_direction
1035
    mov  eax, [esi]
1036
    mov  [snake_direction], eax
1037
 
1038
    mov  esi, edx
1039
    add  esi, LEVEL.snake_direction_next
1040
    mov  eax, [esi]
1041
    mov  [snake_direction_next],    eax
1042
 
1043
    mov  esi, edx
1044
    add  esi, LEVEL.number_of_stones
1045
    mov  eax, [esi]
1046
    mov  [number_of_free_dots], GRID_WIDTH*GRID_HEIGHT-3
1047
    sub  [number_of_free_dots], eax
1048
 
1049
    mov  ax,  word[snake_dots]
1050
    mov  cl,  1
1051
      call      Draw_on_map
1052
    mov  ax,  word[snake_dots+2]
1053
    mov  cl,  1
1054
      call      Draw_on_map
1055
    mov  ax,  word[snake_dots+4]
1056
    mov  cl,  1
1057
      call      Draw_on_map
1058
 
1059
    mov  [action],  0
1060
    mov  [snake_length_x2], 6
1061
 
1062
    ret
1063
 
1064
    ;;---Load_level-------------------------------------------------------------------------------------------------------------
1065
 
1066
 
1067
Draw_stones:
1068
    ;;===Draw_stones============================================================================================================
1069
 
1070
    mov  ax,  0*0x100+GRID_WIDTH
1071
    mov  cx,  0*0x100+GRID_HEIGHT
1072
    mov  edx, [stone_color]
1073
    mov  esi, [cur_level]
1074
    add  esi, LEVEL.field
1075
      call      Draw_picture
1076
 
1077
    ret
1078
 
1079
    ;;---Draw_stones------------------------------------------------------------------------------------------------------------
1080
 
1081
 
1082
Hide_cursor:
1083
    ;;===Hide_cursor===========================================================================================================
1084
 
1085
      mcall     37,5,[cursor_handle]
1086
 
1087
    ret
1088
 
1089
    ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
1090
 
1091
 
1092
Show_cursor:
1093
    ;;===Hide_cursor===========================================================================================================
1094
 
1095
      mcall     37,5,0
1096
 
1097
    ret
1098
 
1099
    ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
1100
 
1101
 
1102
;;---Some_functions-------------------------------------------------------------------------------------------------------------
1103
 
1104
 
1105
;;===Variables==================================================================================================================
1106
 
1518 dunkaist 1107
window_title                db      'Snake',0
1108
window_style                dd      0x34000000
1109
time_before_waiting         dd      0x0
1110
time_to_wait                dd      0x0
1111
time_wait_limit             dd      101
1112
 
1566 dunkaist 1113
play_mode                   dd      0x0
1518 dunkaist 1114
 
1566 dunkaist 1115
square_side_length          dd      19
1116
 
1522 dunkaist 1117
gbxm1                       dd      30
1118
gbym1                       dd      30
1119
 
1566 dunkaist 1120
szZ string_score            ,'SCORE : '
1121
szZ string_hi_score         ,'HI-SCORE : '
1122
;szZ string_player           ,'PLAYER :'
1123
szZ string_champion         ,'CHAMPION : '
1124
szZ string_level            ,'LEVEL : '
1125
;szZ string_hi_level         ,'HI-LEVEL :'
1126
szZ string_pause_space      ,'PAUSE - ',0x27,'SPACE',0x27
1127
szZ string_resume_space     ,'RESUME - ',0x27,'SPACE',0x27
1128
szZ string_menu_esc         ,'MENU - ',0x27,'ESC',0x27
1129
szZ string_apply_name_enter ,'APPLY NAME - ',0x27,'ENTER',0x27
1130
szZ press_to_start          ,'PRESS ',0x27,'ENTER',0x27,' TO START'
1131
szZ press_esc_to_exit       ,'PRESS ',0x27,'ESC',0x27,' TO EXIT'
1518 dunkaist 1132
;press_F2_to_options         db      'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0
1133
 
1566 dunkaist 1134
szZ string_congratulations  ,'   Congratulations!!! New hi-score is : '
1135
szZ string_enter_your_name  ,'You are the champion! Enter your name : '
1522 dunkaist 1136
 
1566 dunkaist 1137
szZ string_button_play      ,'PLAY'
1138
szZ string_button_exit      ,'EXIT'
1139
szZ string_button_inc       ,'+INC+'
1140
szZ string_button_dec       ,'-dec-'
1141
szZ string_button_pm_classic,'CLASSIC mode'
1142
szZ string_button_pm_levels ,'LEVELS mode'
1518 dunkaist 1143
 
1566 dunkaist 1144
is_new_record               dd      0
1518 dunkaist 1145
 
1566 dunkaist 1146
action                      dd      0
1518 dunkaist 1147
 
1566 dunkaist 1148
picture_first_menu_snake    db      1,1,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,\
1149
                                    1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,1,\
1150
                                    1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,1,\
1151
                                    0,0,0,1,0,1,0,1,1,0,1,1,1,1,0,1,0,1,0,0,1,0,0,0,\
1152
                                    1,1,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,1,1,1
1153
 
1518 dunkaist 1154
 
1522 dunkaist 1155
picture_first_menu_version  db      1,1,1,1,0,0,0,1,1,1,1,\
1566 dunkaist 1156
                                    1,0,0,1,0,0,0,1,0,0,0,\
1157
                                    1,0,0,1,0,0,0,1,1,1,1,\
1522 dunkaist 1158
                                    1,0,0,1,0,0,0,0,0,0,1,\
1159
                                    1,1,1,1,0,1,0,1,1,1,1
1518 dunkaist 1160
 
1566 dunkaist 1161
picture_pause               db      1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,\
1162
                                    1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,\
1163
                                    1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,\
1164
                                    1,1,1,0,0,1,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1,1,1,1,\
1165
                                    1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,1,0,0,0,\
1166
                                    1,0,0,0,0,1,0,0,1,0,0,1,1,0,0,1,1,1,1,0,1,1,1,1
1518 dunkaist 1167
 
1566 dunkaist 1168
picture_game_over           db      0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1169
                                    0,1,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,0,\
1170
                                    1,0,0,0,0,0,1,0,0,0,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,\
1171
                                    1,0,0,1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,1,1,0,0,0,0,0,\
1172
                                    1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,\
1173
                                    0,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,0,0,0,0,\
1174
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1175
                                    0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1176
                                    0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,\
1177
                                    0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,\
1178
                                    0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,1,0,0,0,1,\
1179
                                    0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,1,1,1,0,\
1180
                                    0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,0,0,0,1
1518 dunkaist 1181
 
1566 dunkaist 1182
picture_you_win             db      1,0,0,0,1,0,0,1,1,1,0,0,1,0,0,0,1,\
1183
                                    1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,\
1184
                                    0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,1,\
1185
                                    0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,\
1186
                                    0,0,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,\
1187
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1188
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1189
                                    0,1,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0,\
1190
                                    0,1,0,1,0,1,0,0,1,0,0,1,1,0,0,1,0,\
1191
                                    0,1,0,1,0,1,0,0,1,0,0,1,0,1,0,1,0,\
1192
                                    0,1,0,1,0,1,0,0,1,0,0,1,0,0,1,1,0,\
1193
                                    0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,1,0
1518 dunkaist 1194
 
1566 dunkaist 1195
picture_level               db      1,0,0,0,0,1,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,\
1196
                                    1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,\
1197
                                    1,0,0,0,0,1,1,1,0,0,1,0,0,1,0,1,1,1,0,0,1,0,0,0,\
1198
                                    1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,\
1199
                                    1,1,1,1,0,1,1,1,1,0,1,1,0,0,0,1,1,1,1,0,1,1,1,1
1200
 
1201
digits_font                 db      1,1,1,1,\
1202
                                    1,0,0,1,\
1203
                                    1,0,0,1,\
1204
                                    1,0,0,1,\
1205
                                    1,1,1,1,\
1206
                                    \
1207
                                    0,0,1,0,\
1208
                                    0,1,1,0,\
1209
                                    0,0,1,0,\
1210
                                    0,0,1,0,\
1211
                                    0,0,1,0,\
1212
                                    \
1213
                                    1,1,1,1,\
1214
                                    0,0,0,1,\
1215
                                    1,1,1,1,\
1216
                                    1,0,0,0,\
1217
                                    1,1,1,1,\
1218
                                    \
1219
                                    1,1,1,1,\
1220
                                    0,0,0,1,\
1221
                                    0,1,1,1,\
1222
                                    0,0,0,1,\
1223
                                    1,1,1,1,\
1224
                                    \
1225
                                    1,0,0,1,\
1226
                                    1,0,0,1,\
1227
                                    1,1,1,1,\
1228
                                    0,0,0,1,\
1229
                                    0,0,0,1,\
1230
                                    \
1231
                                    1,1,1,1,\
1232
                                    1,0,0,0,\
1233
                                    1,1,1,1,\
1234
                                    0,0,0,1,\
1235
                                    1,1,1,1,\
1236
                                    \
1237
                                    1,1,1,1,\
1238
                                    1,0,0,0,\
1239
                                    1,1,1,1,\
1240
                                    1,0,0,1,\
1241
                                    1,1,1,1,\
1242
                                    \
1243
                                    1,1,1,1,\
1244
                                    0,0,0,1,\
1245
                                    0,0,0,1,\
1246
                                    0,0,0,1,\
1247
                                    0,0,0,1,\
1248
                                    \
1249
                                    1,1,1,1,\
1250
                                    1,0,0,1,\
1251
                                    1,1,1,1,\
1252
                                    1,0,0,1,\
1253
                                    1,1,1,1,\
1254
                                    \
1255
                                    1,1,1,1,\
1256
                                    1,0,0,1,\
1257
                                    1,1,1,1,\
1258
                                    0,0,0,1,\
1259
                                    1,1,1,1
1260
 
1261
stage_00:
1262
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1263
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1264
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1265
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1266
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1267
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1268
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1269
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1270
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1271
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1272
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1273
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1274
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1275
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1276
 
1277
.snake_dots                 db      3,3, 4,3, 5,3
1278
.snake_direction            dd      RIGHT
1279
.snake_direction_next       dd      RIGHT
1280
.number_of_stones           dd      0
1281
 
1282
stage_01:
1283
.field                      db      2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,\
1284
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1285
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1286
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1287
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1288
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1289
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1290
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1291
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1292
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1293
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1294
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1295
                                    2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,\
1296
                                    2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2
1297
 
1298
.snake_dots                 db      3,3, 4,3, 5,3
1299
.snake_direction            dd      RIGHT
1300
.snake_direction_next       dd      RIGHT
1301
.number_of_stones           dd      36
1302
 
1303
stage_02:
1304
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1305
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1306
                                    0,0,0,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,0,0,0,\
1307
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1308
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1309
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1310
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1311
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1312
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1313
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1314
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,\
1315
                                    0,0,0,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,0,0,0,\
1316
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1317
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1318
 
1319
.snake_dots                 db      7,5, 8,5, 9,5
1320
.snake_direction            dd      RIGHT
1321
.snake_direction_next       dd      RIGHT
1322
.number_of_stones           dd      40
1323
 
1324
stage_03:
1325
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1326
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1327
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1328
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1329
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1330
                                    0,0,0,0,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,0,0,0,0,\
1331
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1332
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1333
                                    0,0,0,0,2,2,2,2,2,2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,0,0,0,0,\
1334
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1335
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1336
                                    0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1337
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1338
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1339
 
1340
.snake_dots                 db      23,0, 22,0, 21,0
1341
.snake_direction            dd      LEFT
1342
.snake_direction_next       dd      LEFT
1343
.number_of_stones           dd      44
1344
 
1345
stage_04:
1346
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1347
                                    0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,\
1348
                                    0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,\
1349
                                    0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,\
1350
                                    0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,\
1351
                                    0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,\
1352
                                    0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,\
1353
                                    0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,\
1354
                                    0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,\
1355
                                    0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,\
1356
                                    0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,\
1357
                                    0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,\
1358
                                    0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,\
1359
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1360
 
1361
.snake_dots                 db      19,6, 19,7, 19,8
1362
.snake_napravlenie          dd      DOWN
1363
.snake_napravlenie_next     dd      DOWN
1364
.number_of_stones           dd      40
1365
 
1366
stage_05:
1367
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1368
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1369
                                    0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1370
                                    0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1371
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1372
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1373
                                    0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,\
1374
                                    0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,\
1375
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1376
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1377
                                    0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,\
1378
                                    0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,\
1379
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1380
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1381
 
1382
.snake_dots                 db      0,0, 0,1, 1,1
1383
.snake_direction            dd      RIGHT
1384
.snake_direction_next       dd      RIGHT
1385
.number_of_stones           dd      112
1386
 
1387
stage_06:
1388
.field                      db      0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1389
                                    0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1390
                                    0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1391
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,\
1392
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,\
1393
                                    0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1394
                                    0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,\
1395
                                    0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1396
                                    0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1397
                                    0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,\
1398
                                    0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,\
1399
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,\
1400
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,\
1401
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0
1402
 
1403
.snake_dots                 db      0,0, 0,1, 1,1
1404
.snake_direction            dd      RIGHT
1405
.snake_direction_next       dd      RIGHT
1406
.number_of_stones           dd      128
1407
 
1408
stage_07:
1409
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1410
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1411
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1412
                                    0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,\
1413
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,\
1414
                                    0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,2,0,0,0,0,0,0,\
1415
                                    0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,\
1416
                                    0,0,0,0,0,0,2,0,2,2,2,2,2,2,2,2,2,2,0,2,0,2,0,0,0,0,0,0,\
1417
                                    0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,\
1418
                                    0,0,0,0,0,0,2,0,2,2,2,2,2,2,2,2,2,2,2,2,0,2,0,0,0,0,0,0,\
1419
                                    0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,\
1420
                                    0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,\
1421
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1422
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1423
 
1424
.snake_dots                 db      8,1, 9,1, 10,1
1425
.snake_direction            dd      RIGHT
1426
.snake_direction_next       dd      RIGHT
1427
.number_of_stones           dd      83
1428
 
1429
stage_08:
1430
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1431
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1432
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,\
1433
                                    0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,\
1434
                                    0,0,0,0,0,0,0,2,0,2,0,0,2,0,0,2,0,0,0,0,0,2,0,2,0,0,0,0,\
1435
                                    0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,\
1436
                                    0,0,0,0,2,2,2,2,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,\
1437
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,\
1438
                                    0,0,0,0,0,2,2,2,0,0,2,0,0,0,0,0,2,0,0,0,0,0,2,0,2,0,0,0,\
1439
                                    0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,\
1440
                                    0,0,0,2,0,0,0,0,2,2,0,0,0,0,0,0,0,2,2,2,0,0,2,0,0,0,0,0,\
1441
                                    0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,\
1442
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1443
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1444
 
1445
.snake_dots                 db      0,0, 1,0, 2,0
1446
.snake_direction            dd      RIGHT
1447
.snake_direction_next       dd      RIGHT
1448
.number_of_stones           dd      40
1449
 
1450
stage_09:
1451
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1452
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1453
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1454
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1455
                                    0,0,1,1,1,1,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,0,0,\
1456
                                    0,0,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,\
1457
                                    0,0,1,1,1,1,0,1,0,1,1,0,0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,\
1458
                                    0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,\
1459
                                    0,0,1,1,1,1,0,1,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,1,0,0,\
1460
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1461
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1462
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1463
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1464
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1465
 
1466
.snake_dots                 db      12,6, 12,7, 12,8
1467
.snake_direction            dd      DOWN
1468
.snake_direction_next       dd      DOWN
1469
.number_of_stones           dd      59
1470
 
1471
stage_10:
1472
.field                      db      2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1473
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1474
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1475
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1476
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1477
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1478
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1479
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1480
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1481
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1482
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1483
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1484
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,\
1485
                                    2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0,2,2,2,0
1486
 
1487
.snake_dots                 db      3,2, 3,3, 4,3
1488
.snake_direction            dd      RIGHT
1489
.snake_direction_next       dd      RIGHT
1490
.number_of_stones           dd      231
1491
 
1492
stage_11:
1493
.field                      db      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1494
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1495
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1496
                                    0,0,0,0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0,0,\
1497
                                    0,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,\
1498
                                    0,0,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,0,\
1499
                                    0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,\
1500
                                    0,0,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,0,\
1501
                                    0,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,2,2,0,2,2,0,0,0,\
1502
                                    0,0,0,0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0,0,0,2,2,2,0,0,0,0,\
1503
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1504
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1505
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1506
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1507
 
1508
.snake_dots                 db      3,12, 4,12, 5,12
1509
.snake_direction            dd      RIGHT
1510
.snake_direction_next       dd      RIGHT
1511
.number_of_stones           dd      69
1512
 
1513
stage_12:
1514
.field                      db      0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,\
1515
                                    0,2,2,0,2,2,2,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,2,0,0,2,0,2,\
1516
                                    0,2,0,0,2,0,2,2,2,2,0,2,2,0,0,2,2,2,0,0,0,0,0,0,0,2,2,2,\
1517
                                    0,2,2,0,0,0,0,2,0,2,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,\
1518
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,\
1519
                                    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,\
1520
                                    0,2,0,2,0,0,2,2,0,0,0,0,2,2,0,0,2,0,2,0,0,2,2,0,0,0,2,2,\
1521
                                    0,2,2,2,0,0,2,0,0,0,0,0,2,0,0,0,2,2,2,0,0,2,0,0,0,0,0,2,\
1522
                                    0,0,0,0,0,0,2,2,0,0,0,0,2,2,0,0,0,0,0,0,0,2,2,0,0,0,2,2,\
1523
                                    0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1524
                                    0,0,0,2,0,2,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,\
1525
                                    2,2,0,2,2,2,0,0,0,0,0,0,0,2,2,0,2,0,2,0,0,2,0,0,0,0,0,0,\
1526
                                    0,2,0,0,0,0,2,2,2,0,0,0,0,0,2,0,2,2,2,0,0,2,2,0,2,0,2,0,\
1527
                                    2,2,0,0,0,0,2,0,2,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,2,2,2,0
1528
 
1529
.snake_dots                 db      27,0, 26,0, 25,0
1530
.snake_direction            dd      LEFT
1531
.snake_direction_next       dd      LEFT
1532
.number_of_stones           dd      110
1533
 
1518 dunkaist 1534
background_color            dd      0x000000
1535
decorations_color           dd      0x00000000
1536
snake_color                 dd      0x000000
1537
snake_head_color            dd      0x000000
1538
snake_picture_color         dd      0x000000
1539
version_picture_color       dd      0x000000
1540
pause_picture_color         dd      0x000000
1541
game_over_picture_color     dd      0x000000
1566 dunkaist 1542
you_win_picture_color       dd      0x000000
1518 dunkaist 1543
eat_color                   dd      0x000000
1544
navigation_strings_color    dd      0x80000000
1545
game_over_strings_color     dd      0x80000000
1546
score_string_color          dd      0x80000000
1547
hiscore_string_color        dd      0x80000000
1548
champion_string_color       dd      0x80000000
1549
game_over_hiscore_color     dd      0x80000000
1550
score_number_color          dd      0x40000000
1551
hiscore_number_color        dd      0x00000000
1552
champion_name_color         dd      0x80000000
1566 dunkaist 1553
button_color                dd      0x000000
1554
button_text_color           dd      0x80000000
1555
stone_color                 dd      0x000000
1556
splash_background_color     dd      0x000000
1557
splash_level_string_color   dd      0x000000
1558
splash_level_number_color   dd      0x000000
1559
level_string_color          dd      0x80000000
1560
level_number_color          dd      0x00000000
1518 dunkaist 1561
 
1566 dunkaist 1562
 
1518 dunkaist 1563
align 4
1564
@IMPORT:
1565
 
1566
library \
1567
        libini      ,   'libini.obj'        ,\
1568
        box_lib     ,   'box_lib.obj'
1569
 
1570
import  libini,\
1571
    ini.get_str     ,   'ini_get_str'       ,\
1572
    ini.get_int     ,   'ini_get_int'       ,\
1573
    ini.set_str     ,   'ini_set_str'       ,\
1574
    ini.set_int     ,   'ini_set_int'       ,\
1575
    ini.get_color   ,   'ini_get_color'
1576
 
1577
import  box_lib,\
1578
    edit_box.draw   ,   'edit_box'          ,\
1579
    edit_box.key    ,   'edit_box_key'      ,\
1580
    edit_box.mouse  ,   'edit_box_mouse'
1581
 
1582
bFirstDraw  db  0
1583
 
1584
aPreferences                db      'Preferences',0
1585
aSpeed                      db      'Speed',0
1522 dunkaist 1586
aTheme                      db      'Theme',0
1587
 
1588
aTheme_name                 db      32  dup (0)
1518 dunkaist 1589
aDecorations                db      'Decorations',0
1590
aBackground_color           db      'Background_color',0
1591
aDecorations_color          db      'Decorations_color',0
1592
aSnake_color                db      'Snake_color',0
1593
aSnake_head_color           db      'Snake_head_color',0
1594
aSnake_picture_color        db      'Snake_picture_color',0
1595
aVersion_picture_color      db      'Version_picture_color',0
1596
aPause_picture_color        db      'Pause_picture_color',0
1597
aGame_over_picture_color    db      'Game_over_picture_color',0
1566 dunkaist 1598
aYou_win_picture_color      db      'You_win_picture_color',0
1518 dunkaist 1599
aEat_color                  db      'Eat_color',0
1600
aNavigation_strings_color   db      'Navigation_string_color',0
1601
aGame_over_strings_color    db      'Game_over_string_color',0
1602
aScore_string_color         db      'Score_string_color',0
1603
aHiscore_string_color       db      'Hiscore_string_color',0
1604
aChampion_string_color      db      'Champion_string_color',0
1605
aGame_over_hiscore_color    db      'Game_over_hiscore_color',0
1606
aScore_number_color         db      'Score_number_color',0
1607
aHiscore_number_color       db      'Hiscore_number_color',0
1608
aChampion_name_color        db      'Champion_name_color',0
1520 dunkaist 1609
aEdit_box_selection_color   db      'Edit_box_selection_color',0
1566 dunkaist 1610
aButton_color               db      'Button_color',0
1611
aButton_text_color          db      'Button_text_color',0
1612
aStone_color                db      'Stone_color',0
1613
aSplash_background_color    db      'Splash_background_color',0
1614
aSplash_level_string_color  db      'Splash_level_string_color',0
1615
aSplash_level_number_color  db      'Splash_level_number_color',0
1616
aLevel_string_color         db      'Level_string_color',0
1617
aLevel_number_color         db      'Level_number_color',0
1518 dunkaist 1618
 
1566 dunkaist 1619
aReserved                   db      'Reserved',0
1620
aSquare_side_length         db      'Square_side_length',0
1621
aHiscore_classic            db      'Hiscore_classic',0
1622
aChampion_name_classic      db      'Champion_name_classic',0
1623
aHiscore_levels             db      'Hiscore_levels',0
1624
aChampion_name_levels       db      'Champion_name_levels',0
1518 dunkaist 1625
 
1522 dunkaist 1626
edit1 edit_box 65,397,0x0,0x000000,0x000000,0x000000,0x000000,0x80000000,15,hed,mouse_dd,ed_focus,hed_end-hed-1,hed_end-hed-1
1627
 
1518 dunkaist 1628
hed                         db      '',0
1522 dunkaist 1629
;;---Variables-------------------------------------------------------------------------------------------------------------
1630
i_end:
1518 dunkaist 1631
hed_end:
1632
rb  256
1633
mouse_dd                    rd      1
1634
 
1566 dunkaist 1635
cur_level                   rd      1
1636
cur_level_number            rd      1
1637
hi_level                    rd      1
1522 dunkaist 1638
 
1566 dunkaist 1639
score                       rd      1
1640
hi_score_classic            rd      1
1641
hi_score_levels             rd      1
1522 dunkaist 1642
 
1566 dunkaist 1643
champion_name_classic       rb      CHAMPION_NAME_LENGTH
1644
champion_name_levels        rb      CHAMPION_NAME_LENGTH
1645
 
1646
snake_dots                  rb      GRID_WIDTH*GRID_HEIGHT*2+3          ; +3 bytes for faster dword copying
1647
snake_direction             rd      1
1648
snake_direction_next        rd      1
1649
snake_length_x2             rd      1
1650
 
1651
decorations                 rd      1
1652
number_of_free_dots         rd      1
1653
 
1654
eat                         rw      1
1655
 
1522 dunkaist 1656
g_s                         rd      1
1566 dunkaist 1657
g_e                         rd      1
1522 dunkaist 1658
 
1659
window_width                rd      1
1660
window_height               rd      1
1661
wp_x                        rd      1
1662
wp_y                        rd      1
1663
 
1664
gw_mul_gs                   rd      1
1665
gh_mul_gs                   rd      1
1666
gbxm1_plus_gw_mul_gs        rd      1
1667
gbym1_plus_gh_mul_gs        rd      1
1668
gs_shl16_gs                 rd      1
1669
gbxm1_shl16_gbxm1           rd      1
1670
gbym1_shl16_gbym1           rd      1
1671
 
1672
bottom_top_strings          rd      1
1673
bottom_middle_strings       rd      1
1674
bottom_bottom_strings       rd      1
1675
top_strings                 rd      1
1676
 
1566 dunkaist 1677
button_x_left               rd      1
1678
button_x_right              rd      1
1679
button_y_top                rd      1
1680
button_y_middle             rd      1
1681
button_y_bottom             rd      1
1682
button_width_short          rd      1
1683
button_width_long           rd      1
1684
button_height               rd      1
1522 dunkaist 1685
 
1566 dunkaist 1686
cursor_data                 rb      32*32*4
1687
cursor_handle               rd      1
1688
 
1518 dunkaist 1689
cur_dir_path                rb      4096
1690
@PARAMS                     rb      4096
1691
 
1566 dunkaist 1692
field_map                   rb      GRID_WIDTH*GRID_HEIGHT*2
1693
 
1518 dunkaist 1694
rb 4096
1695
stacktop:
1696
d_end: