Subversion Repositories Kolibri OS

Rev

Rev 1522 | Rev 1760 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;===HEADER====================================================================================================================
  2.  
  3. use32
  4.     org 0x0
  5.     db  'MENUET01'
  6.     dd  0x01,start,i_end,d_end,stacktop,0x0,cur_dir_path
  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'
  15. ;include '../../../system/board/trunk/debug.inc'
  16.  
  17. ;;===Define_chapter============================================================================================================
  18.  
  19. GRID_WIDTH                  equ     28
  20. GRID_HEIGHT                 equ     14
  21.  
  22. MIN_SQUARE_SIDE_LENGTH      equ     9
  23.  
  24. SCORE_EAT                   equ     100
  25.  
  26. LEFT                        equ     0
  27. DOWN                        equ     1
  28. UP                          equ     2
  29. RIGHT                       equ     3
  30.  
  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.  
  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.  
  71.       invoke  ini.get_int, cur_dir_path, aPreferences, aSpeed, 80
  72.     neg  eax
  73.     add  [time_wait_limit],    eax
  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
  77.     mov  [decorations], eax
  78.       invoke  ini.get_color, cur_dir_path, aTheme_name, aBackground_color, 0x000000
  79.     or   [background_color],    eax
  80.     or   [window_style],    eax
  81.       invoke  ini.get_color, cur_dir_path, aTheme_name, aDecorations_color, 0xAAAA00
  82.     or   [decorations_color],  eax
  83.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_color, 0x1111ff
  84.     or   [snake_color], eax
  85.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_head_color, 0x6B6Bff
  86.     or   [snake_head_color], eax
  87.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_picture_color, 0x4488ff
  88.     or   [snake_picture_color], eax
  89.       invoke  ini.get_color, cur_dir_path, aTheme_name, aVersion_picture_color, 0x55ff55
  90.     or   [version_picture_color],   eax
  91.       invoke  ini.get_color, cur_dir_path, aTheme_name, aPause_picture_color, 0x11ff11
  92.     or   [pause_picture_color], eax
  93.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_picture_color, 0xff1111
  94.     or   [game_over_picture_color], eax
  95.       invoke  ini.get_color, cur_dir_path, aTheme_name, aYou_win_picture_color, 0xffff11
  96.     or   [you_win_picture_color],   eax
  97.       invoke  ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11
  98.     or   [eat_color],   eax
  99.       invoke  ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777
  100.     or   [navigation_strings_color], eax
  101.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900
  102.     or   [game_over_strings_color],  eax
  103.       invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff
  104.     or   [score_string_color],   eax
  105.       invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_string_color, 0xffffff
  106.     or   [level_string_color],  eax
  107.       invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff
  108.     or   [hiscore_string_color],   eax
  109.       invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff
  110.     or   [champion_string_color],   eax
  111.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44
  112.     or   [game_over_hiscore_color], eax
  113.       invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff
  114.     or   [score_number_color],   eax
  115.       invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_number_color, 0xffffff
  116.     or   [level_number_color],  eax
  117.       invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff
  118.     or   [hiscore_number_color],   eax
  119.       invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff
  120.     or   [champion_name_color],   eax
  121.       invoke  ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00
  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
  135.  
  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.  
  145.     mov  eax, [background_color]
  146.     mov  [edit1.color], eax
  147.     mov  [edit1.focus_border_color],    eax
  148.     mov  [edit1.blur_border_color], eax
  149.     mov  eax, [game_over_hiscore_color]
  150.     mov  [edit1.text_color],    eax
  151.  
  152.       mcall     37,4,cursor_data,2                  ; load empty cursor (for "hiding" cursor while level_mode)
  153.     mov  [cursor_handle],   eax
  154.  
  155.       call      Set_geometry
  156.  
  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.  
  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.  
  195. Exit:
  196.     ;;===Exit==================================================================================================================
  197.  
  198.     or  eax,    -1
  199.     int 0x40
  200.    
  201.     ;;---Exit------------------------------------------------------------------------------------------------------------------
  202.  
  203.  
  204. Set_geometry:
  205.     ;;===Set_geometry==========================================================================================================
  206.  
  207.     mov  eax, [square_side_length]
  208.     inc  eax                                            ; space between squares
  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.  
  226.     mov  edx, GRID_WIDTH
  227.     mov  eax, [g_s]
  228.     mul  dx
  229.     mov  [gw_mul_gs],   eax
  230.  
  231.     mov  edx, GRID_HEIGHT
  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.  
  266.       mcall     48,4                                ; get skin header height
  267.     add  eax, [gh_mul_gs]
  268.     add  eax, [gbym1]
  269.     add  eax, [g_e]
  270.     add  eax, 30
  271.     add  eax, 5                                      ; skin height (bottom part)
  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
  313.     mov  [edit1.top],   eax
  314.  
  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.  
  366.     ret
  367.  
  368.     ;;---Set_geometry------------------------------------------------------------------------------------------------------
  369.  
  370.  
  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.  
  398. Draw_decorations:
  399.     ;;===Draw_decorations==================================================================================================
  400.  
  401.     mov  al, byte[decorations]
  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
  424.     ret
  425.  
  426.  
  427.   grid_lines:
  428.  
  429.     mov  eax, 38
  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]
  435.     mov  edx, [decorations_color]
  436.     mov  esi, GRID_WIDTH
  437.     add  esi, 1
  438.  
  439.   @@:
  440.       mcall
  441.     add  ebx, [gs_shl16_gs]
  442.     dec  esi
  443.      jnz @b
  444.  
  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]
  449.     mov  esi, GRID_HEIGHT
  450.     add  esi, 1
  451.    
  452.   @@:
  453.       mcall
  454.     add  ecx, [gs_shl16_gs]
  455.     dec  esi
  456.      jnz @b
  457.  
  458.     ret
  459.  
  460.  
  461.   grid_lines_with_ends:
  462.  
  463.     mov  eax, 38
  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]
  470.     mov  edx, [decorations_color]
  471.     mov  esi, GRID_WIDTH
  472.     add  esi, 1
  473.  
  474.   @@:
  475.       mcall
  476.     add  ebx, [gs_shl16_gs]
  477.     dec  esi
  478.      jnz @b
  479.  
  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]
  486.     mov  esi, GRID_HEIGHT
  487.     add  esi, 1
  488.    
  489.   @@:
  490.       mcall
  491.     add  ecx, [gs_shl16_gs]
  492.     dec  esi
  493.      jnz @b
  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
  509.     mov  ebx, [gbxm1]
  510.     mov  ecx, [gbym1]
  511.     mov  edx, [decorations_color]
  512.  
  513.   @@:
  514.       mcall
  515.     add  ebx, [g_s]
  516.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  517.      jng @b
  518.     add  ecx, [g_s]
  519.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  520.      jg  @f
  521.     mov  ebx, [gbxm1]
  522.      jmp @b
  523.  
  524.   @@:
  525.     ret
  526.  
  527.  
  528.   borders_lines:
  529.  
  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
  536.  
  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.  
  552.     ret
  553.  
  554.  
  555.   borders_lines_with_corners:
  556.  
  557.       call      borders_lines
  558.       call      corners_outer
  559.  
  560.     ret
  561.  
  562.  
  563.   borders_dots:
  564.  
  565.     mov  eax, 1
  566.     mov  ebx, [gbxm1]
  567.     mov  ecx, [gbym1]
  568.     mov  edx, [decorations_color]
  569.   @@:
  570.       mcall
  571.     add  ebx, [g_s]
  572.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  573.      jng @b
  574.  
  575.     mov  ebx, [gbxm1]
  576.     mov  ecx, [gbym1_plus_gh_mul_gs]
  577.   @@:
  578.       mcall
  579.     add  ebx, [g_s]
  580.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  581.      jng @b
  582.  
  583.     mov  ebx, [gbxm1]
  584.     mov  ecx, [gbym1]
  585.   @@:
  586.       mcall
  587.     add  ecx, [g_s]
  588.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  589.      jng @b
  590.  
  591.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  592.     mov  ecx, [gbym1]
  593.   @@:
  594.       mcall
  595.     add  ecx, [g_s]
  596.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  597.      jng @b
  598.  
  599.     ret
  600.  
  601.  
  602.   corners_dots:
  603.  
  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
  615.  
  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.  
  635.     ret
  636.  
  637.  
  638.   corners_inner:
  639.  
  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
  646.  
  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.  
  680.     ret
  681.  
  682.  
  683.   corners_outer:
  684.  
  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
  691.  
  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.  
  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.  
  745.     push eax ebx ecx edx
  746.  
  747.     mov  cl,  bh
  748.  
  749.     mov  al,  byte[g_s]
  750.     mul  bl
  751.     mov  bx,  ax
  752.     add  bx,  word[gbxm1]
  753.     inc  bx
  754.     shl  ebx, 16
  755.     add  ebx, [g_s]
  756.     dec  ebx
  757.  
  758.     mov  al,  byte[g_s]
  759.     mul  cl
  760.     mov  cx,  ax
  761.     add  cx,  word[gbym1]
  762.     inc  cx
  763.     shl  ecx, 16
  764.     add  ecx, [g_s]
  765.     dec  ecx
  766.  
  767.       mcall     13
  768.  
  769.     pop  edx ecx ebx eax
  770.  
  771.     ret
  772.  
  773.     ;;---Draw_square-------------------------------------------------------------------------------------------------------
  774.    
  775.    
  776. Draw_menu_esc:
  777.     ;;===Draw_menu_esc=====================================================================================================
  778.  
  779.     mov  ebx, [window_width]
  780.     shr  ebx, 1
  781.     sub  ebx, string_menu_esc.size*3+6
  782.     shl  ebx, 16
  783.     add  ebx, dword[top_strings]
  784.       mcall     4, ,[navigation_strings_color],string_menu_esc
  785.    
  786.     ret
  787.    
  788.     ;;---Draw_menu_esc-----------------------------------------------------------------------------------------------------
  789.  
  790.  
  791. Draw_score_string:
  792.     ;;===Draw_score_string=================================================================================================
  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
  800.  
  801.     ret
  802.  
  803.     ;;---Draw_score_string-------------------------------------------------------------------------------------------------
  804.    
  805.    
  806. Draw_score_number:
  807.     ;;===Draw_score_number=================================================================================================
  808.  
  809.     mov  edx, [window_width]
  810.     shr  edx, 3
  811.     sub  edx, 5+1
  812.     add  edx, string_score.size*6
  813.     shl  edx, 16
  814.     add  edx, dword[bottom_top_strings]
  815.       mcall     47,0x00070000,[score], ,[score_number_color],[background_color]
  816.  
  817.     ret
  818.  
  819.     ;;---Draw_score_number-------------------------------------------------------------------------------------------------
  820.  
  821.  
  822. Draw_hiscore_string:
  823.     ;;===Draw_hiscore_string===============================================================================================
  824.  
  825.     mov  ebx, [window_width]
  826.     shr  ebx, 3
  827.     neg  ebx
  828.     add  ebx, [window_width]
  829.     sub  ebx, string_hi_score.size*6+7*6+5
  830.     shl  ebx, 16
  831.     add  ebx, dword[bottom_top_strings]
  832.       mcall     4, ,[hiscore_string_color],string_hi_score
  833.    
  834.     ret
  835.    
  836.     ;;---Draw_hiscore_string-----------------------------------------------------------------------------------------------
  837.  
  838.  
  839. Draw_hiscore_number:
  840.     ;;===Draw_hiscore_number===================================================================================================
  841.  
  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]
  849.    
  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.    
  860.     ret
  861.    
  862.     ;;---Draw_hiscore_number---------------------------------------------------------------------------------------------------
  863.  
  864.  
  865. Draw_champion_string:
  866.     ;;===Draw_champion_string==================================================================================================
  867.  
  868.     mov  ebx, [window_width]
  869.     shr  ebx, 3
  870.     neg  ebx
  871.     add  ebx, [window_width]
  872.     sub  ebx, string_champion.size*6+7*6+5
  873.     shl  ebx, 16
  874.     add  ebx, dword[bottom_bottom_strings]
  875.       mcall     4, ,[champion_string_color],string_champion
  876.  
  877.     ret
  878.  
  879.     ;;---Draw_champion_string----------------------------------------------------------------------------------------------
  880.  
  881.  
  882. Draw_champion_name:
  883.     ;;===Draw_champion_name================================================================================================
  884.  
  885.     mov  ebx, [window_width]
  886.     shr  ebx, 3
  887.     neg  ebx
  888.     add  ebx, [window_width]
  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
  891.     shl  ebx, 16
  892.     add  ebx, dword[bottom_bottom_strings]
  893.  
  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.  
  904.     ret
  905.  
  906.     ;;---Draw_champion_name------------------------------------------------------------------------------------------------
  907.  
  908.  
  909. Draw_picture:
  910.     ;;===Draw_picture======================================================================================================
  911.     ;;  in  :
  912.     ;;           ax =   number of left square *0x100+ picture width (in squares)
  913.     ;;           cx =   number of top square *0x100+ picture height (in squares)
  914.     ;;          edx =   picture color
  915.     ;;          esi =   pointer to picture data
  916.     ;;
  917.  
  918.     add  al,  ah
  919.     add  cl,  ch
  920.     mov  bh,  ch
  921.  
  922.   .draw:
  923.     mov  bl,  ah
  924.    
  925.   .loop:
  926.     cmp  byte[esi], 0
  927.      jz  @f
  928.     push eax ebx ecx esi
  929.       call      Draw_square
  930.     pop  esi ecx ebx eax
  931.    
  932.   @@:
  933.     inc  esi
  934.     inc  bl
  935.     cmp  bl,  al
  936.      jne .loop
  937.    
  938.     inc  bh
  939.     cmp  bh,  cl
  940.      jne .draw
  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.  
  954.     push eax ebx edx
  955.  
  956.     and  eax, 0x0000ffff
  957.     xor  bx,  bx
  958.     mov  bl,  al
  959.     shr  ax,  8
  960.     mov  dx,  GRID_WIDTH
  961.     mul  dx
  962.     add  ax,  bx
  963.     mov  edx, field_map
  964.     add  edx, eax
  965.     mov  [edx], cl
  966.    
  967.     pop edx ebx eax
  968.  
  969.     ret
  970.  
  971.     ;;---Draw_on_map-----------------------------------------------------------------------------------------------------------
  972.  
  973.  
  974. Get_from_map:
  975.     ;;===Get_from_map==========================================================================================================
  976.     ;;  in  :
  977.     ;;           al =   x coord
  978.     ;;           ah =   y coord
  979.     ;;  out :
  980.     ;;           bl =   value on map
  981.     ;;
  982.  
  983.     push eax
  984.    
  985.     and  eax, 0x0000ffff
  986.     xor  bx,  bx
  987.     mov  bl,  al
  988.     shr  ax,  8
  989.     mov  dx,  GRID_WIDTH
  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.  
  1000.     ;;---Get_from_map-----------------------------------------------------------------------------------------------------------
  1001.  
  1002.  
  1003. Load_level:
  1004.     ;;===Load_level=============================================================================================================
  1005.     ;;  in  :
  1006.     ;;          cur_level_number    =   level number to load
  1007.     ;;
  1008.  
  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
  1020.  
  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
  1026.  
  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.  
  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.  
  1113. play_mode                   dd      0x0
  1114.  
  1115. square_side_length          dd      19
  1116.  
  1117. gbxm1                       dd      30
  1118. gbym1                       dd      30
  1119.  
  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'
  1132. ;press_F2_to_options         db      'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0
  1133.  
  1134. szZ string_congratulations  ,'   Congratulations!!! New hi-score is : '
  1135. szZ string_enter_your_name  ,'You are the champion! Enter your name : '
  1136.  
  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'
  1143.  
  1144. is_new_record               dd      0
  1145.  
  1146. action                      dd      0
  1147.  
  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.                                    
  1154.  
  1155. picture_first_menu_version  db      1,1,1,1,0,0,0,1,1,1,1,\
  1156.                                     1,0,0,1,0,0,0,1,0,0,0,\
  1157.                                     1,0,0,1,0,0,0,1,1,1,1,\
  1158.                                     1,0,0,1,0,0,0,0,0,0,1,\
  1159.                                     1,1,1,1,0,1,0,1,1,1,1
  1160.  
  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
  1167.  
  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
  1181.  
  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
  1194.  
  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.  
  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
  1542. you_win_picture_color       dd      0x000000
  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
  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
  1561.  
  1562.  
  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
  1586. aTheme                      db      'Theme',0
  1587.  
  1588. aTheme_name                 db      32  dup (0)
  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
  1598. aYou_win_picture_color      db      'You_win_picture_color',0
  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
  1609. aEdit_box_selection_color   db      'Edit_box_selection_color',0
  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
  1618.  
  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
  1625.  
  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.  
  1628. hed                         db      '',0
  1629. ;;---Variables-------------------------------------------------------------------------------------------------------------
  1630. i_end:
  1631. hed_end:
  1632. rb  256
  1633. mouse_dd                    rd      1
  1634.  
  1635. cur_level                   rd      1
  1636. cur_level_number            rd      1
  1637. hi_level                    rd      1
  1638.  
  1639. score                       rd      1
  1640. hi_score_classic            rd      1
  1641. hi_score_levels             rd      1
  1642.  
  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.  
  1656. g_s                         rd      1
  1657. g_e                         rd      1
  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.  
  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
  1685.  
  1686. cursor_data                 rb      32*32*4
  1687. cursor_handle               rd      1
  1688.  
  1689. cur_dir_path                rb      4096
  1690. @PARAMS                     rb      4096
  1691.  
  1692. field_map                   rb      GRID_WIDTH*GRID_HEIGHT*2
  1693.  
  1694. rb 4096
  1695. stacktop:
  1696. d_end: