Subversion Repositories Kolibri OS

Rev

Rev 1566 | 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. WINDOW_MODE_WINDOWED        equ     0
  20. WINDOW_MODE_FULLSCREEN      equ     1
  21.  
  22. GRID_WIDTH                  equ     28
  23. GRID_HEIGHT                 equ     14
  24.  
  25. MIN_SQUARE_SIDE_LENGTH      equ     9
  26.  
  27. SCORE_EAT                   equ     100
  28.  
  29. LEFT                        equ     0
  30. DOWN                        equ     1
  31. UP                          equ     2
  32. RIGHT                       equ     3
  33.  
  34. struct  LEVEL
  35.     field                   db      4*GRID_HEIGHT  dup (?)
  36.     snake_dots              db      6   dup (?)
  37.     snake_direction         dd      ?
  38.     snake_direction_next    dd      ?
  39.     number_of_stones        dd      ?
  40.     name                    dd      ?
  41. ends
  42.  
  43. CLASSIC_MODE                equ     0
  44. LEVELS_MODE                 equ     1
  45.  
  46. CLASSIC_MODE_FIRST_LEVEL    equ     0
  47. LEVELS_MODE_FIRST_LEVEL     equ     1
  48.  
  49. EAT_TO_END_LEVEL            equ     7
  50. PAUSE_BETWEEN_LEVELS        equ     200
  51. PAUSE_WHILE_DRAWING_SPLASH  equ     3
  52.  
  53. CHAMPION_NAME_LENGTH        equ     15
  54. LAST_LEVEL_NUMBER           equ     36
  55.  
  56. START_LIVES                 equ     3
  57.  
  58. ;;---Define_chapter------------------------------------------------------------------------------------------------------------
  59.  
  60. start:
  61.  
  62. stdcall dll.Load,@IMPORT
  63.     or   eax, eax
  64.     jnz  Exit
  65.    
  66. align 4
  67.  
  68.     mov  edi, cur_dir_path
  69.     mov  al,  0
  70.     mov  ecx, 4096
  71.     repne scasb
  72.     mov  dword[edi-1],    '.ini'
  73.  
  74.       invoke  ini.get_int, cur_dir_path, aPreferences, aSpeed, 80
  75.     neg  eax
  76.     add  [time_wait_limit],    eax
  77.     mov  ebx, [time_wait_limit]
  78.     mov  [time_wait_limit_const],  ebx
  79.     sub  ebx, 4
  80.     mov  eax, 200
  81.     div  bl
  82.     mov  byte[speed_up_counter],    al
  83.     mov  byte[speed_up_counter+1],  al
  84.       invoke  ini.get_str, cur_dir_path, aPreferences, aTheme, aTheme_name, 31, aTheme_name
  85.       invoke  ini.get_int, cur_dir_path, aPreferences, aSmart_reverse, 0
  86.     mov  [smart_reverse],   eax
  87.       invoke  ini.get_int, cur_dir_path, aPreferences, aShow_lives_style, 2
  88.     mov  [show_lives_style],    eax
  89.       invoke  ini.get_int, cur_dir_path, aPreferences, aDraw_level_name_in_window_title, 1
  90.     mov  [draw_level_name_in_window_title], eax
  91.       invoke  ini.get_str, cur_dir_path, aPreferences, aSeparating_symbol, separating_symbol, 3, default_separating_symbol
  92.  
  93.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_left, 0x23, 0
  94.     mov  [shortcut_move_left],  al
  95.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_down, 0x24, 0
  96.     mov  [shortcut_move_down],  al
  97.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_up, 0x25, 0
  98.     mov  [shortcut_move_up],    al
  99.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aMove_right, 0x26, 0
  100.     mov  [shortcut_move_right], al
  101.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aReverse, 0x0F, 0
  102.     mov  [shortcut_reverse], al
  103.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aIncrease, 0x16, 0
  104.     mov  [shortcut_increase],   al
  105.       invoke  ini.get_shortcut, cur_dir_path, aShortcuts, aDecrease, 0x17, 0
  106.     mov  [shortcut_decrease],   al
  107.  
  108.       invoke  ini.get_int, cur_dir_path, aTheme_name, aDecorations, 3
  109.     mov  [decorations], eax
  110.       invoke  ini.get_color, cur_dir_path, aTheme_name, aBackground_color, 0x000000
  111.     or   [background_color],    eax
  112.     or   [window_style_windowed],   eax
  113.       invoke  ini.get_color, cur_dir_path, aTheme_name, aDecorations_color, 0xAAAA00
  114.     or   [decorations_color],  eax
  115.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_color, 0x1111ff
  116.     or   [snake_color], eax
  117.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_head_color, 0x6B6Bff
  118.     or   [snake_head_color], eax
  119.       invoke  ini.get_color, cur_dir_path, aTheme_name, aLives_in_head_number_color, 0xff8800
  120.     or   [lives_in_head_number_color],  eax
  121.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSnake_picture_color, 0x4488ff
  122.     or   [snake_picture_color], eax
  123.       invoke  ini.get_color, cur_dir_path, aTheme_name, aVersion_picture_color, 0x55ff55
  124.     or   [version_picture_color],   eax
  125.       invoke  ini.get_color, cur_dir_path, aTheme_name, aPause_picture_color, 0x11ff11
  126.     or   [pause_picture_color], eax
  127.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_picture_color, 0xff1111
  128.     or   [game_over_picture_color], eax
  129.       invoke  ini.get_color, cur_dir_path, aTheme_name, aYou_win_picture_color, 0xffff11
  130.     or   [you_win_picture_color],   eax
  131.       invoke  ini.get_color, cur_dir_path, aTheme_name, aEat_color, 0xffff11
  132.     or   [eat_color],   eax
  133.       invoke  ini.get_color, cur_dir_path, aTheme_name, aNavigation_strings_color, 0x80ff7777
  134.     or   [navigation_strings_color], eax
  135.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_strings_color, 0x80ff9900
  136.     or   [game_over_strings_color],  eax
  137.       invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_string_color, 0x80ffffff
  138.     or   [score_string_color],   eax
  139.       invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_string_color, 0xffffff
  140.     or   [level_string_color],  eax
  141.       invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_string_color, 0x80ffffff
  142.     or   [hiscore_string_color],   eax
  143.       invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_string_color, 0x80ffffff
  144.     or   [champion_string_color],   eax
  145.       invoke  ini.get_color, cur_dir_path, aTheme_name, aGame_over_hiscore_color, 0x80ffdd44
  146.     or   [game_over_hiscore_color], eax
  147.       invoke  ini.get_color, cur_dir_path, aTheme_name, aScore_number_color, 0xffffff
  148.     or   [score_number_color],   eax
  149.       invoke  ini.get_color, cur_dir_path, aTheme_name, aLevel_number_color, 0xffffff
  150.     or   [level_number_color],  eax
  151.       invoke  ini.get_color, cur_dir_path, aTheme_name, aHiscore_number_color, 0x00ffffff
  152.     or   [hiscore_number_color],   eax
  153.       invoke  ini.get_color, cur_dir_path, aTheme_name, aChampion_name_color, 0x80ffffff
  154.     or   [champion_name_color],   eax
  155.       invoke  ini.get_color, cur_dir_path, aTheme_name, aEdit_box_selection_color, 0x00aa00
  156.     or   [edit1.shift_color],   eax
  157.       invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_color, 0xDDDDDD
  158.     or   [button_color],    eax
  159.       invoke  ini.get_color, cur_dir_path, aTheme_name, aButton_text_color, 0x000000
  160.     or   [button_text_color],   eax
  161.       invoke  ini.get_color, cur_dir_path, aTheme_name, aStone_color, 0x5f8700
  162.     or   [stone_color], eax
  163.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_background_color, 0xAAAA00
  164.     or   [splash_background_color],    eax
  165.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_number_color, 0x000000
  166.     or   [splash_level_number_color],   eax
  167.       invoke  ini.get_color, cur_dir_path, aTheme_name, aSplash_level_string_color, 0x000000
  168.     or   [splash_level_string_color],   eax
  169.  
  170.       invoke  ini.get_int, cur_dir_path, aReserved, aSquare_side_length, 19
  171.     mov  [square_side_length],  eax
  172.       invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, CHAMPION_NAME_LENGTH, champion_name_classic
  173.       invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_classic, 777
  174.     or   [hi_score_classic],    eax
  175.       invoke  ini.get_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, CHAMPION_NAME_LENGTH, champion_name_levels
  176.       invoke  ini.get_int, cur_dir_path, aReserved, aHiscore_levels, 777
  177.     or   [hi_score_levels], eax
  178.  
  179.     mov  eax, [background_color]
  180.     mov  [edit1.color], eax
  181.     mov  [edit1.focus_border_color],    eax
  182.     mov  [edit1.blur_border_color], eax
  183.     mov  eax, [game_over_hiscore_color]
  184.     mov  [edit1.text_color],    eax
  185.  
  186.       mcall     37,4,cursor_data,2                  ; load empty cursor (for "hiding" cursor while level_mode)
  187.     mov  [cursor_handle],   eax
  188.  
  189.     mov  eax, WINDOW_MODE_WINDOWED
  190.       call      Set_window_mode
  191.       mcall     0,0,0,0x51000000                    ; create empty window. Set_geometry will set all parameters
  192.       call      Set_geometry.by_hotkey
  193.       mcall     71,1,window_title
  194.  
  195. include 'first_menu.asm'            ; First menu body and functions
  196. include 'level.asm'                 ; Level body and functions (game process)
  197. include 'pause.asm'                 ; Pause body and functions
  198. include 'game_over.asm'             ; Game_over body and functions
  199.  
  200. ;;===Some_functions============================================================================================================
  201.  
  202.  
  203. Save_do_smth_else_and_exit:
  204.     ;;===Save_do_smth_else_and_exit============================================================================================
  205.  
  206.       mcall     37,6,[cursor_handle]                ; delete cursor
  207.  
  208.       invoke    ini.set_int, cur_dir_path, aReserved, aSquare_side_length, [square_side_length]
  209.  
  210.     mov  edi, champion_name_classic
  211.     xor  al,  al
  212.     mov  ecx, CHAMPION_NAME_LENGTH+1
  213.     cld
  214.     repne scasb
  215.     neg  ecx
  216.     add  ecx, CHAMPION_NAME_LENGTH
  217.       invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_classic, champion_name_classic, ecx
  218.       invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_classic, [hi_score_classic]
  219.  
  220.     mov  edi, champion_name_levels
  221.     xor  al,  al
  222.     mov  ecx, CHAMPION_NAME_LENGTH+1
  223.     cld
  224.     repne scasb
  225.     neg  ecx
  226.     add  ecx, CHAMPION_NAME_LENGTH
  227.       invoke    ini.set_str, cur_dir_path, aReserved, aChampion_name_levels, champion_name_levels, ecx
  228.       invoke    ini.set_int, cur_dir_path, aReserved, aHiscore_levels, [hi_score_levels]
  229.  
  230.     ;;---Save_do_smth_else_and_exit--------------------------------------------------------------------------------------------
  231.  
  232.  
  233. Exit:
  234.     ;;===Exit==================================================================================================================
  235.  
  236.     or  eax,    -1
  237.     int 0x40
  238.    
  239.     ;;---Exit------------------------------------------------------------------------------------------------------------------
  240.  
  241.  
  242. Set_geometry:
  243.     ;;===Set_geometry==========================================================================================================
  244.  
  245.     cmp  [resized_by_hotkey],   1
  246.      je  .by_hotkey
  247.  
  248.     test [proc_info.wnd_state], 0x01
  249.      jnz .by_hotkey
  250.  
  251.       mcall     9,proc_info,-1
  252.     mov  eax, [proc_info.box.width]
  253.     cmp  eax, [window_width]
  254.      jne @f
  255.     mov  eax, [proc_info.box.height]
  256.     cmp  eax, [window_height]
  257.      jne @f
  258.      jmp .quit
  259.   @@:
  260.     mov  eax, [proc_info.box.width]
  261.     mov  [window_width],    eax
  262.     mov  eax, [proc_info.box.height]
  263.     mov  [window_height],   eax
  264.  
  265.   .by_mouse:                                    ; or any other kind of resizing. for example, double click on window title
  266.  
  267.     test [proc_info.wnd_state], 0x01
  268.      jnz .by_hotkey
  269.    
  270.  
  271.     cmp  [window_width],    250
  272.      jnl @f
  273.     mov  [window_width],    250
  274.   @@:
  275.     cmp  [window_height],   150
  276.      jnl @f
  277.     mov  [window_height],   150
  278.   @@:
  279.  
  280.       mcall     48,4
  281.     mov  ecx, [window_height]
  282.     sub  ecx, eax
  283.     sub  ecx, 5
  284.     sub  ecx, [g_e]
  285.     sub  ecx, [g_e]
  286.     sub  ecx, 25+30
  287.     mov  esi, ecx
  288.  
  289.     mov  eax, [window_width]
  290.     sub  eax, 5+5
  291.     sub  eax, [g_e]
  292.     sub  eax, [g_e]
  293.     sub  eax, [g_s]
  294.     sub  eax, [g_s]
  295.     mov  edi, eax
  296.  
  297.     mov  dx,  0
  298.     div  cx
  299.     cmp  ax,  2
  300.      jl  .fit_to_width
  301.  
  302.   .fit_to_height:
  303.     mov  eax, esi
  304.     mov  ebx, GRID_HEIGHT
  305.     div  bl
  306.     cmp  al,  MIN_SQUARE_SIDE_LENGTH
  307.      jnl @f
  308.     mov  al,  MIN_SQUARE_SIDE_LENGTH
  309.   @@:
  310.     dec al
  311.     mov byte[square_side_length],   al
  312.      jmp .by_hotkey
  313.  
  314.   .fit_to_width:
  315.     mov  eax, edi
  316.     mov  ebx, GRID_WIDTH
  317.     div  bl
  318.     cmp  al,  MIN_SQUARE_SIDE_LENGTH
  319.      jnl @f
  320.     mov  al,  MIN_SQUARE_SIDE_LENGTH
  321.   @@:
  322.     dec al
  323.     mov byte[square_side_length],   al
  324.      jmp .by_hotkey
  325.  
  326. ;     jmp .done
  327.  
  328.   .by_hotkey:
  329.       mcall     9,proc_info,-1
  330.     mov  [resized_by_hotkey],   0
  331.  
  332.     mov  eax, [square_side_length]
  333.     inc  eax                                            ; space between squares
  334.     mov  [g_s],   eax
  335.  
  336.     mov  eax, [g_s]
  337.     shr  eax, 1
  338.     mov  ebx, eax
  339.     shr  ebx, 1
  340.     add  eax, ebx
  341.     mov  [g_e], eax
  342.  
  343.     mov  edx, GRID_WIDTH
  344.     mov  eax, [g_s]
  345.     mul  dx
  346.     mov  [gw_mul_gs],   eax
  347.  
  348.     mov  edx, GRID_HEIGHT
  349.     mov  eax, [g_s]
  350.     mul  dx
  351.     mov  [gh_mul_gs],   eax
  352.  
  353.     mov  eax, [gw_mul_gs]
  354.     add  eax, [g_s]
  355.     add  eax, [g_s]
  356.     add  eax, [g_e]
  357.     add  eax, [g_e]
  358.     add  eax, 5*2                                   ; skin width
  359.     mov  esi, eax
  360.     test [proc_info.wnd_state], 0x01
  361.     cmovnz  eax, [proc_info.box.width]
  362.     mov  [window_width],    eax
  363.  
  364.     sub  eax, [gw_mul_gs]
  365.     sub  eax, 5*2
  366.     shr  eax, 1
  367.     mov  [gbxm1],   eax
  368.  
  369.       mcall     48,4                                ; get skin header height
  370.     mov  ebx, eax
  371.     add  eax, [gh_mul_gs]
  372.     add  eax, [g_e]
  373.     add  eax, 25
  374.     add  eax, [g_e]
  375.     add  eax, 30
  376.     add  eax, 5                                      ; skin height (bottom part)
  377.     mov  edi, eax
  378.     test [proc_info.wnd_state], 0x01
  379.     cmovnz  eax, [proc_info.box.height]
  380.     mov  [window_height],   eax
  381.  
  382.     sub  eax, [gh_mul_gs]
  383.     sub  eax, ebx
  384.     sub  eax, 5
  385.     sub  eax, 5
  386.    
  387.     shr  eax, 1
  388.     mov  [gbym1],   eax
  389.  
  390.     mov  eax, [g_s]
  391.     shl  eax, 16
  392.     add  eax, [g_s]
  393.     mov  [gs_shl16_gs], eax
  394.  
  395.     mov  eax, [gbxm1]
  396.     shl  eax, 16
  397.     add  eax, [gbxm1]
  398.     mov  [gbxm1_shl16_gbxm1],   eax
  399.  
  400.     mov  eax, [gbym1]
  401.     shl  eax, 16
  402.     add  eax, [gbym1]
  403.     mov  [gbym1_shl16_gbym1],   eax
  404.  
  405.     mov  eax, [gbxm1]
  406.     add  eax, [gw_mul_gs]
  407.     mov  [gbxm1_plus_gw_mul_gs],    eax
  408.  
  409.     mov  eax, [gbym1]
  410.     add  eax, [gh_mul_gs]
  411.     mov  [gbym1_plus_gh_mul_gs],    eax
  412.  
  413.       mcall     48, 5
  414.     mov  dx,  ax
  415.     shr  eax, 16
  416.     sub  dx,  ax
  417.     cmp  dx,  si                                    ; does window fit to work area width?
  418.      jnl @f
  419.     dec  [square_side_length]
  420.      jmp Set_geometry.by_hotkey
  421.   @@:
  422.  
  423.     mov  cx,  bx
  424.     shr  ebx, 16
  425.     sub  cx,  bx
  426.     cmp  cx,  di                                    ; does window fit to work area height?
  427.      jnl @f
  428.     dec  [square_side_length]
  429.      jmp Set_geometry.by_hotkey
  430.   @@:
  431.  
  432.     sub  dx,  si
  433.     shr  dx,  1
  434.     mov  word[wp_x],    dx
  435.     sub  cx,  word[window_height]
  436.     shr  cx,  1
  437.     mov  dx,  cx
  438.     shr  cx,  1
  439.     add  cx,  dx
  440.     mov  word[wp_y],    cx
  441.  
  442.     mov  [top_strings], 8
  443.     mov  eax, [window_height]
  444.     sub  eax, 50
  445.     mov  [bottom_top_strings],  eax
  446.     add  eax, 6
  447.     mov  [bottom_middle_strings],  eax
  448.     add  eax, 6
  449.     mov  [bottom_bottom_strings],  eax
  450.  
  451.     sub  eax, 4
  452.     mov  [edit1.top],   eax
  453.  
  454.  
  455.     mov  eax, [g_s]
  456.     shl  eax, 2
  457.     sub  eax, 2
  458.     mov  [button_width_short],  eax
  459.     mov  eax, [g_s]
  460.     shl  eax, 3
  461.     add  eax, [g_s]
  462.     sub  eax, 2
  463.     mov  [button_width_long],   eax
  464.     mov  eax, [g_s]
  465.     sub  eax, 2
  466.     mov  [button_height],   eax
  467.  
  468.     mov  bl,  0x10
  469.     mov  cl,  0x08
  470.  
  471.     mov  al,  byte[g_s]
  472.     mul  bl
  473.     mov  bx,  ax
  474.     add  bx,  word[gbxm1]
  475.     inc  bx
  476.  
  477.     mov  al,  byte[g_s]
  478.     mul  cl
  479.     mov  cx,  ax
  480.     add  cx,  word[gbym1]
  481.     inc  cx
  482.    
  483.     mov  [button_x_left],   ebx
  484.     mov  [button_y_top],    ecx
  485.    
  486.     add  ebx, [g_s]
  487.     add  ebx, [g_s]
  488.     add  ebx, [g_s]
  489.     add  ebx, [g_s]
  490.     add  ebx, [g_s]
  491.    
  492.     mov  [button_x_right],  ebx
  493.    
  494.     add  ecx,  [g_s]
  495.     add  ecx,  [g_s]
  496.    
  497.     mov  [button_y_middle], ecx
  498.    
  499.     add  ecx,  [g_s]
  500.     add  ecx,  [g_s]
  501.    
  502.     mov  [button_y_bottom], ecx
  503.  
  504.   .done:
  505.       mcall     67,[wp_x],[wp_y],[window_width],[window_height]
  506.  
  507.   .quit:
  508.     ret
  509.  
  510.     ;;---Set_geometry------------------------------------------------------------------------------------------------------
  511.  
  512.  
  513. Increase_geometry:
  514.     ;;===Increase_geometry=================================================================================================
  515.  
  516.     inc  [square_side_length]
  517.     mov  [resized_by_hotkey],   1
  518.  
  519.     ret
  520.  
  521.     ;;---Increase_geometry-------------------------------------------------------------------------------------------------
  522.  
  523.  
  524. Decrease_geometry:
  525.     ;;===Decrease_geometry=================================================================================================
  526.  
  527.     cmp  [square_side_length],  MIN_SQUARE_SIDE_LENGTH
  528.      je  @f
  529.     dec  [square_side_length]
  530.     mov  [resized_by_hotkey],   1
  531.  
  532.   @@:
  533.     ret
  534.  
  535.     ;;---Decrease_geometry-------------------------------------------------------------------------------------------------
  536.  
  537.  
  538. Draw_decorations:
  539.     ;;===Draw_decorations==================================================================================================
  540.  
  541.     mov  al, byte[decorations]
  542.     dec  al
  543.      jz  grid_lines
  544.     dec  al
  545.      jz  grid_lines_with_ends
  546.     dec  al
  547.      jz  grid_lines_with_corners
  548.     dec  al
  549.      jz  grid_dots
  550.     dec  al
  551.      jz  borders_lines
  552.     dec  al
  553.      jz  borders_lines_with_corners
  554.     dec  al
  555.      jz  borders_dots
  556.     dec  al
  557.      jz  corners_dots
  558.     dec  al
  559.      jz  corners_inner
  560.     dec  al
  561.      jz  corners_outer
  562.     dec  al
  563.      jz  corners_crosses
  564.     ret
  565.  
  566.  
  567.   grid_lines:
  568.  
  569.     mov  eax, 38
  570. ;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1)
  571.     mov  ebx, [gbxm1_shl16_gbxm1]
  572. ;mov  ecx, (GRID_BEGIN_Y-1)*65536+(GRID_BEGIN_Y-1+GRID_HEIGHT*GRID_STEP)
  573.     mov  ecx, [gbym1_shl16_gbym1]
  574.     add  ecx, [gh_mul_gs]
  575.     mov  edx, [decorations_color]
  576.     mov  esi, GRID_WIDTH
  577.     add  esi, 1
  578.  
  579.   @@:
  580.       mcall
  581.     add  ebx, [gs_shl16_gs]
  582.     dec  esi
  583.      jnz @b
  584.  
  585. ;mov  ebx, (GRID_BEGIN_X-1)*65536+(GRID_BEGIN_X-1+GRID_WIDTH*GRID_STEP)
  586.     mov  ebx, [gbxm1_shl16_gbxm1]
  587.     add  ebx, [gw_mul_gs]
  588.     mov  ecx, [gbym1_shl16_gbym1]
  589.     mov  esi, GRID_HEIGHT
  590.     add  esi, 1
  591.    
  592.   @@:
  593.       mcall
  594.     add  ecx, [gs_shl16_gs]
  595.     dec  esi
  596.      jnz @b
  597.  
  598.     ret
  599.  
  600.  
  601.   grid_lines_with_ends:
  602.  
  603.     mov  eax, 38
  604.     mov  ebx, [gbxm1_shl16_gbxm1]
  605.     mov  ecx, [gbym1]
  606.     sub  ecx, [g_e]
  607.     shl  ecx, 16
  608.     add  ecx, [gbym1_plus_gh_mul_gs]
  609.     add  ecx, [g_e]
  610.     mov  edx, [decorations_color]
  611.     mov  esi, GRID_WIDTH
  612.     add  esi, 1
  613.  
  614.   @@:
  615.       mcall
  616.     add  ebx, [gs_shl16_gs]
  617.     dec  esi
  618.      jnz @b
  619.  
  620.     mov  ebx, [gbxm1]
  621.     sub  ebx, [g_e]
  622.     shl  ebx, 16
  623.     add  ebx, [gbxm1_plus_gw_mul_gs]
  624.     add  ebx, [g_e]
  625.     mov  ecx, [gbym1_shl16_gbym1]
  626.     mov  esi, GRID_HEIGHT
  627.     add  esi, 1
  628.    
  629.   @@:
  630.       mcall
  631.     add  ecx, [gs_shl16_gs]
  632.     dec  esi
  633.      jnz @b
  634.  
  635.     ret
  636.  
  637.  
  638.   grid_lines_with_corners:
  639.  
  640.       call      grid_lines
  641.       call      corners_outer
  642.  
  643.     ret
  644.  
  645.  
  646.   grid_dots:
  647.  
  648.     mov  eax, 1
  649.     mov  ebx, [gbxm1]
  650.     mov  ecx, [gbym1]
  651.     mov  edx, [decorations_color]
  652.  
  653.   @@:
  654.       mcall
  655.     add  ebx, [g_s]
  656.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  657.      jng @b
  658.     add  ecx, [g_s]
  659.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  660.      jg  @f
  661.     mov  ebx, [gbxm1]
  662.      jmp @b
  663.  
  664.   @@:
  665.     ret
  666.  
  667.  
  668.   borders_lines:
  669.  
  670.     mov  eax, 38
  671.     mov  ebx, [gbxm1_shl16_gbxm1]
  672.     mov  ecx, [gbym1_shl16_gbym1]
  673.     add  ecx, [gh_mul_gs]
  674.     mov  edx, [decorations_color]
  675.       mcall
  676.  
  677.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  678.     shl  ebx, 16
  679.     add  ebx, [gbxm1_plus_gw_mul_gs]
  680.       mcall
  681.  
  682.     mov  ebx, [gbxm1_shl16_gbxm1]
  683.     add  ebx, [gw_mul_gs]
  684.     mov  ecx, [gbym1_shl16_gbym1]
  685.       mcall
  686.  
  687.     mov  ecx, [gbym1_plus_gh_mul_gs]
  688.     shl  ecx, 16
  689.     add  ecx, [gbym1_plus_gh_mul_gs]
  690.       mcall
  691.  
  692.     ret
  693.  
  694.  
  695.   borders_lines_with_corners:
  696.  
  697.       call      borders_lines
  698.       call      corners_outer
  699.  
  700.     ret
  701.  
  702.  
  703.   borders_dots:
  704.  
  705.     mov  eax, 1
  706.     mov  ebx, [gbxm1]
  707.     mov  ecx, [gbym1]
  708.     mov  edx, [decorations_color]
  709.   @@:
  710.       mcall
  711.     add  ebx, [g_s]
  712.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  713.      jng @b
  714.  
  715.     mov  ebx, [gbxm1]
  716.     mov  ecx, [gbym1_plus_gh_mul_gs]
  717.   @@:
  718.       mcall
  719.     add  ebx, [g_s]
  720.     cmp  ebx, [gbxm1_plus_gw_mul_gs]
  721.      jng @b
  722.  
  723.     mov  ebx, [gbxm1]
  724.     mov  ecx, [gbym1]
  725.   @@:
  726.       mcall
  727.     add  ecx, [g_s]
  728.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  729.      jng @b
  730.  
  731.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  732.     mov  ecx, [gbym1]
  733.   @@:
  734.       mcall
  735.     add  ecx, [g_s]
  736.     cmp  ecx, [gbym1_plus_gh_mul_gs]
  737.      jng @b
  738.  
  739.     ret
  740.  
  741.  
  742.   corners_dots:
  743.  
  744.     mov  eax, 13
  745.     mov  ebx, [gbxm1]
  746.     dec  ebx
  747.     shl  ebx, 16
  748.     add  ebx, 2
  749.     mov  ecx, [gbym1]
  750.     dec  ecx
  751.     shl  ecx, 16
  752.     add  ecx, 2
  753.     mov  edx, [decorations_color]
  754.       mcall
  755.  
  756.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  757.     shl  ebx, 16
  758.     add  ebx, 2
  759.       mcall
  760.  
  761.     mov  ebx, [gbxm1]
  762.     dec  ebx
  763.     shl  ebx, 16
  764.     add  ebx, 2
  765.     mov  ecx, [gbym1_plus_gh_mul_gs]
  766.     shl  ecx, 16
  767.     add  ecx, 2
  768.       mcall
  769.  
  770.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  771.     shl  ebx, 16
  772.     add  ebx, 2
  773.       mcall
  774.  
  775.     ret
  776.  
  777.  
  778.   corners_inner:
  779.  
  780.     mov  eax, 38
  781.     mov  ebx, [gbxm1_shl16_gbxm1]
  782.     add  ebx, [g_e]
  783.     mov  ecx, [gbym1_shl16_gbym1]
  784.     mov  edx, [decorations_color]
  785.       mcall
  786.  
  787.     mov  ecx, [gbym1_plus_gh_mul_gs]
  788.     shl  ecx, 16
  789.     add  ecx, [gbym1_plus_gh_mul_gs]
  790.       mcall
  791.  
  792.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  793.     sub  ebx, [g_e]
  794.     shl  ebx, 16
  795.     add  ebx, [gbxm1_plus_gw_mul_gs]
  796.       mcall
  797.  
  798.     mov  ecx, [gbym1_shl16_gbym1]
  799.       mcall
  800.  
  801.     mov  ebx, [gbxm1_shl16_gbxm1]
  802.     mov  ecx, [gbym1_shl16_gbym1]
  803.     add  ecx, [g_e]
  804.       mcall
  805.  
  806.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  807.     shl  ebx, 16
  808.     add  ebx, [gbxm1_plus_gw_mul_gs]
  809.       mcall
  810.  
  811.     mov  ecx, [gbym1_plus_gh_mul_gs]
  812.     sub  ecx, [g_e]
  813.     shl  ecx, 16
  814.     add  ecx, [gbym1_plus_gh_mul_gs]
  815.       mcall
  816.  
  817.     mov  ebx, [gbxm1_shl16_gbxm1]
  818.       mcall
  819.  
  820.     ret
  821.  
  822.  
  823.   corners_outer:
  824.  
  825.     mov  eax, 38
  826.     mov  ebx, [gbxm1_shl16_gbxm1]
  827.     sub  ebx, [g_e]
  828.     mov  ecx, [gbym1_shl16_gbym1]
  829.     mov  edx, [decorations_color]
  830.       mcall
  831.  
  832.     mov  ecx, [gbym1_plus_gh_mul_gs]
  833.     shl  ecx, 16
  834.     add  ecx, [gbym1_plus_gh_mul_gs]
  835.       mcall
  836.  
  837.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  838.     shl  ebx, 16
  839.     add  ebx, [gbxm1_plus_gw_mul_gs]
  840.     add  ebx, [g_e]
  841.       mcall
  842.  
  843.     mov  ecx, [gbym1_shl16_gbym1]
  844.       mcall
  845.  
  846.     mov  ebx, [gbxm1_shl16_gbxm1]
  847.     mov  ecx, [gbym1_shl16_gbym1]
  848.     sub  ecx, [g_e]
  849.       mcall
  850.  
  851.     mov  ebx, [gbxm1_plus_gw_mul_gs]
  852.     shl  ebx, 16
  853.     add  ebx, [gbxm1_plus_gw_mul_gs]
  854.       mcall
  855.  
  856.     mov  ecx, [gbym1_plus_gh_mul_gs]
  857.     shl  ecx, 16
  858.     add  ecx, [gbym1_plus_gh_mul_gs]
  859.     add  ecx, [g_e]
  860.       mcall
  861.  
  862.     mov  ebx, [gbxm1_shl16_gbxm1]
  863.       mcall
  864.  
  865.     ret
  866.  
  867.  
  868.   corners_crosses:
  869.  
  870.       call      corners_inner
  871.       call      corners_outer
  872.  
  873.     ret
  874.  
  875.  
  876.     ;;---Draw_decorations--------------------------------------------------------------------------------------------------
  877.  
  878.  
  879. Draw_square:
  880.     ;;===Draw_square=======================================================================================================
  881.     ;; bl   -   x_coord
  882.     ;; bh   -   y_coord
  883.     ;; edx  -   color
  884.  
  885.     push eax ebx ecx edx
  886.  
  887.     mov  cl,  bh
  888.  
  889.     mov  al,  byte[g_s]
  890.     mul  bl
  891.     mov  bx,  ax
  892.     add  bx,  word[gbxm1]
  893.     inc  bx
  894.     shl  ebx, 16
  895.     add  ebx, [g_s]
  896.     dec  ebx
  897.  
  898.     mov  al,  byte[g_s]
  899.     mul  cl
  900.     mov  cx,  ax
  901.     add  cx,  word[gbym1]
  902.     inc  cx
  903.     shl  ecx, 16
  904.     add  ecx, [g_s]
  905.     dec  ecx
  906.  
  907.       mcall     13
  908.  
  909.     pop  edx ecx ebx eax
  910.  
  911.     ret
  912.  
  913.     ;;---Draw_square-------------------------------------------------------------------------------------------------------
  914.    
  915.    
  916. Draw_menu_esc:
  917.     ;;===Draw_menu_esc=====================================================================================================
  918.  
  919.     mov  ebx, [window_width]
  920.     shr  ebx, 1
  921.     sub  ebx, string_menu_esc.size*3+6
  922.     shl  ebx, 16
  923.     add  ebx, dword[top_strings]
  924.       mcall     4, ,[navigation_strings_color],string_menu_esc
  925.    
  926.     ret
  927.    
  928.     ;;---Draw_menu_esc-----------------------------------------------------------------------------------------------------
  929.  
  930.  
  931. Draw_score_string:
  932.     ;;===Draw_score_string=================================================================================================
  933.  
  934.     mov  ebx, [window_width]
  935.     shr  ebx, 3
  936.     sub  ebx, 5
  937.     shl  ebx, 16
  938.     add  ebx, dword[bottom_top_strings]
  939.       mcall     4, ,[score_string_color],string_score
  940.  
  941.     ret
  942.  
  943.     ;;---Draw_score_string-------------------------------------------------------------------------------------------------
  944.    
  945.    
  946. Draw_score_number:
  947.     ;;===Draw_score_number=================================================================================================
  948.  
  949.     mov  edx, [window_width]
  950.     shr  edx, 3
  951.     sub  edx, 5+1
  952.     add  edx, string_score.size*6
  953.     shl  edx, 16
  954.     add  edx, dword[bottom_top_strings]
  955.       mcall     47,0x00070000,[score], ,[score_number_color],[background_color]
  956.  
  957.     ret
  958.  
  959.     ;;---Draw_score_number-------------------------------------------------------------------------------------------------
  960.  
  961.  
  962. Draw_hiscore_string:
  963.     ;;===Draw_hiscore_string===============================================================================================
  964.  
  965.     mov  ebx, [window_width]
  966.     shr  ebx, 3
  967.     neg  ebx
  968.     add  ebx, [window_width]
  969.     sub  ebx, string_hi_score.size*6+7*6+5
  970.     shl  ebx, 16
  971.     add  ebx, dword[bottom_top_strings]
  972.       mcall     4, ,[hiscore_string_color],string_hi_score
  973.    
  974.     ret
  975.    
  976.     ;;---Draw_hiscore_string-----------------------------------------------------------------------------------------------
  977.  
  978.  
  979. Draw_hiscore_number:
  980.     ;;===Draw_hiscore_number===================================================================================================
  981.  
  982.     mov  edx, [window_width]
  983.     shr  edx, 3
  984.     neg  edx
  985.     add  edx, [window_width]
  986.     sub  edx, 7*6+6
  987.     shl  edx, 16
  988.     add  edx, dword[bottom_top_strings]
  989.    
  990.     cmp  [play_mode],   CLASSIC_MODE
  991.      jne @f
  992.     mov  ecx, [hi_score_classic]
  993.      jmp .done
  994.   @@:
  995.     mov  ecx, [hi_score_levels]
  996.  
  997.   .done:
  998.       mcall     47,0x00070000, , ,[hiscore_number_color]
  999.    
  1000.     ret
  1001.    
  1002.     ;;---Draw_hiscore_number---------------------------------------------------------------------------------------------------
  1003.  
  1004.  
  1005. Draw_champion_string:
  1006.     ;;===Draw_champion_string==================================================================================================
  1007.  
  1008.     mov  ebx, [window_width]
  1009.     shr  ebx, 3
  1010.     neg  ebx
  1011.     add  ebx, [window_width]
  1012.     sub  ebx, string_champion.size*6+7*6+5
  1013.     shl  ebx, 16
  1014.     add  ebx, dword[bottom_bottom_strings]
  1015.       mcall     4, ,[champion_string_color],string_champion
  1016.  
  1017.     ret
  1018.  
  1019.     ;;---Draw_champion_string----------------------------------------------------------------------------------------------
  1020.  
  1021.  
  1022. Draw_champion_name:
  1023.     ;;===Draw_champion_name================================================================================================
  1024.  
  1025.     mov  ebx, [window_width]
  1026.     shr  ebx, 3
  1027.     neg  ebx
  1028.     add  ebx, [window_width]
  1029.     sub  ebx, CHAMPION_NAME_LENGTH/2*6+7*6+6                ; there is no difference between length of champion names for other play_modes
  1030.     add  ebx, CHAMPION_NAME_LENGTH/2*6
  1031.     shl  ebx, 16
  1032.     add  ebx, dword[bottom_bottom_strings]
  1033.  
  1034.     cmp  [play_mode],   CLASSIC_MODE
  1035.      jne @f
  1036.     mov  edx, champion_name_classic
  1037.      jmp .done
  1038.   @@:
  1039.     mov  edx, champion_name_levels
  1040.  
  1041.   .done:
  1042.       mcall     4, ,[champion_name_color],
  1043.  
  1044.     ret
  1045.  
  1046.     ;;---Draw_champion_name------------------------------------------------------------------------------------------------
  1047.  
  1048.  
  1049. Draw_picture:
  1050.     ;;===Draw_picture======================================================================================================
  1051.     ;;  in  :
  1052.     ;;           ax =   number of left square *0x100+ picture width (in squares)
  1053.     ;;           cx =   number of top square *0x100+ picture height (in squares)
  1054.     ;;          edx =   picture color
  1055.     ;;          esi =   pointer to picture data
  1056.     ;;
  1057.  
  1058.     add  al,  ah
  1059.     add  cl,  ch
  1060.     mov  bh,  ch
  1061.  
  1062.   .draw:
  1063.     mov  bl,  ah
  1064.     mov  di,  7
  1065.    
  1066.   .loop:
  1067.     bt  word[esi],  di
  1068.      jnc @f
  1069.     push eax ebx ecx esi edi
  1070.       call      Draw_square
  1071.     pop  edi esi ecx ebx eax
  1072.    
  1073.   @@:
  1074.     dec  di
  1075.      jns @f
  1076.     mov  di,  7
  1077.     inc  esi
  1078.   @@:
  1079.     inc  bl
  1080.     cmp  bl,  al
  1081.      jne .loop
  1082.    
  1083.     inc  bh
  1084.     cmp  di,  7
  1085.      jz  @f
  1086.     inc  esi
  1087.   @@:
  1088.     cmp  bh,  cl
  1089.      jne .draw
  1090.  
  1091.     ret
  1092.  
  1093.     ;;---Draw_picture------------------------------------------------------------------------------------------------------
  1094.  
  1095.  
  1096. Draw_on_map:
  1097.     ;;===Draw_on_map=======================================================================================================
  1098.     ;;  in  :
  1099.     ;;           al =   x coord
  1100.     ;;           ah =   y coord
  1101.     ;;           cl =   value to draw
  1102.     ;;
  1103.  
  1104.     and  eax, 0x0000ffff
  1105.     xor  bx,  bx
  1106.     mov  bl,  al
  1107.     shr  ax,  8
  1108.     mov  dx,  GRID_WIDTH
  1109.     mul  dx
  1110.     add  ax,  bx
  1111.     mov  edi, field_map
  1112.     add  edi, eax
  1113.     mov  [edi], cl
  1114.  
  1115.     ret
  1116.  
  1117.     ;;---Draw_on_map-------------------------------------------------------------------------------------------------------
  1118.  
  1119.  
  1120. Get_from_map:
  1121.     ;;===Get_from_map======================================================================================================
  1122.     ;;  in  :
  1123.     ;;           al =   x coord
  1124.     ;;           ah =   y coord
  1125.     ;;  out :
  1126.     ;;           bl =   value on map
  1127.     ;;
  1128.  
  1129.     push eax
  1130.    
  1131.     and  eax, 0x0000ffff
  1132.     xor  bx,  bx
  1133.     mov  bl,  al
  1134.     shr  ax,  8
  1135.     mov  dx,  GRID_WIDTH
  1136.     mul  dx
  1137.     add  ax,  bx
  1138.     mov  edi, field_map
  1139.     add  edi, eax
  1140.     mov  bl,  [edi]
  1141.  
  1142.     pop  eax
  1143.  
  1144.     ret
  1145.  
  1146.     ;;---Get_from_map-----------------------------------------------------------------------------------------------------------
  1147.  
  1148.  
  1149. Load_level:
  1150.     ;;===Load_level=============================================================================================================
  1151.     ;;  in  :
  1152.     ;;          cur_level_number    =   level number to load
  1153.     ;;
  1154.  
  1155.     mov  eax, [cur_level_number]
  1156.     mov  edx, stage_00
  1157.   @@:
  1158.     test al,  al
  1159.      jz  @f
  1160.     add  edx, stage_01-stage_00
  1161.     dec  al
  1162.      jmp @b
  1163.   @@:
  1164.  
  1165.     mov  esi, window_title_with_lives
  1166.     mov  edi, window_title+5
  1167.  
  1168.   .lives_in_title:
  1169.     cmp  [play_mode],   LEVELS_MODE
  1170.      jne .level_name_in_title
  1171.     test [show_lives_style],    1
  1172.      jz  .level_name_in_title
  1173.     mov  [edi], byte ' '
  1174.     mov  al,  byte[separating_symbol]
  1175.     mov  [edi+1], byte al
  1176.     mov  [edi+2], byte ' '
  1177.     add  edi, 3
  1178.     mov  eax, [lives]
  1179.     add  al,  0x30
  1180.     mov  [window_title_with_lives],   al
  1181.     mov  ecx, 10
  1182.     rep  movsb
  1183.     dec  edi
  1184.  
  1185.   .level_name_in_title:
  1186.     cmp  [draw_level_name_in_window_title], 1
  1187.      jne @f
  1188.     mov  [edi], byte ' '
  1189.     mov  al,  byte[separating_symbol]
  1190.     mov  [edi+1], byte al
  1191.     mov  [edi+2], byte ' '
  1192.     add  edi, 3
  1193.     mov  esi, edx
  1194.     add  esi, LEVEL.name
  1195.     mov  esi, [esi]
  1196.     mov  ecx, 16
  1197.     rep  movsd
  1198.  
  1199.   @@:
  1200.       mcall     71,1,window_title
  1201.  
  1202.     mov  [cur_level],   edx
  1203.  
  1204.     mov  esi, edx
  1205.     add  esi, LEVEL.field
  1206.     mov  edi, field_map
  1207.     mov  ecx, 2
  1208.     mov  ah,  GRID_HEIGHT
  1209.   .begin:
  1210.     mov  ebx, 7
  1211.     mov  al,  GRID_WIDTH
  1212.   .loop:
  1213.     bt   [esi], ebx
  1214.      jnc @f
  1215.     mov  byte[edi], cl
  1216.      jmp .skip
  1217.   @@:
  1218.     mov  byte[edi], 0
  1219.   .skip:
  1220.     dec  ebx
  1221.      jns @f
  1222.     mov  ebx, 7
  1223.     inc  esi
  1224.   @@:
  1225.     inc  edi
  1226.     dec  al
  1227.      jnz .loop
  1228.     inc  esi
  1229.     dec  ah
  1230.      jnz .begin
  1231.  
  1232.  
  1233.     mov  esi, edx
  1234.     add  esi, LEVEL.snake_dots
  1235.     mov  edi, snake_dots
  1236.     mov  ecx, 3
  1237.     rep  movsw
  1238.    
  1239.     mov  esi, edx
  1240.     add  esi, LEVEL.snake_direction
  1241.     mov  eax, [esi]
  1242.     mov  [snake_direction], eax
  1243.    
  1244.     mov  esi, edx
  1245.     add  esi, LEVEL.snake_direction_next
  1246.     mov  eax, [esi]
  1247.     mov  [snake_direction_next],    eax
  1248.  
  1249.     mov  esi, edx
  1250.     add  esi, LEVEL.number_of_stones
  1251.     mov  eax, [esi]
  1252.     mov  [number_of_free_dots], GRID_WIDTH*GRID_HEIGHT-3
  1253.     sub  [number_of_free_dots], eax
  1254.    
  1255.     mov  ax,  word[snake_dots]
  1256.     mov  cl,  1
  1257.       call      Draw_on_map
  1258.     mov  ax,  word[snake_dots+2]
  1259.     mov  cl,  1
  1260.       call      Draw_on_map
  1261.     mov  ax,  word[snake_dots+4]
  1262.     mov  cl,  1
  1263.       call      Draw_on_map
  1264.  
  1265.     mov  [action],  0
  1266.     mov  [snake_length_x2], 6
  1267.  
  1268.     ret
  1269.  
  1270.     ;;---Load_level-------------------------------------------------------------------------------------------------------------
  1271.  
  1272.  
  1273. Draw_stones:
  1274.     ;;===Draw_stones============================================================================================================
  1275.  
  1276.     mov  ax,  0*0x100+GRID_WIDTH
  1277.     mov  cx,  0*0x100+GRID_HEIGHT
  1278.     mov  edx, [stone_color]
  1279.     mov  esi, [cur_level]
  1280.     add  esi, LEVEL.field
  1281.       call      Draw_picture
  1282.  
  1283.     ret
  1284.  
  1285.     ;;---Draw_stones------------------------------------------------------------------------------------------------------------
  1286.  
  1287.  
  1288. Hide_cursor:
  1289.     ;;===Hide_cursor===========================================================================================================
  1290.  
  1291.       mcall     37,5,[cursor_handle]
  1292.  
  1293.     ret
  1294.  
  1295.     ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
  1296.  
  1297.  
  1298. Show_cursor:
  1299.     ;;===Hide_cursor===========================================================================================================
  1300.  
  1301.       mcall     37,5,0
  1302.  
  1303.     ret
  1304.  
  1305.     ;;---Show_cursor-----------------------------------------------------------------------------------------------------------
  1306.  
  1307.  
  1308. Set_window_mode:
  1309.     ;;===Set_window_mode=======================================================================================================
  1310.  
  1311.     test al,  al
  1312.      jnz .fullscreen
  1313.     mov  eax, [window_style_windowed]
  1314.      jmp .quit
  1315.  
  1316.   .fullscreen:
  1317.     mov  eax, [window_style_fullscreen]
  1318.  
  1319.   .quit:
  1320.     mov [window_style], eax
  1321.     ret
  1322.  
  1323. ;;---Some_functions------------------------------------------------------------------------------------------------------------
  1324.  
  1325.  
  1326. Reverse_snake:
  1327.     ;;===Reverse_snake=========================================================================================================
  1328.  
  1329.     cmp  [snake_direction], LEFT
  1330.      jne @f
  1331.     mov  [snake_direction_next],    RIGHT
  1332.      jmp .quit
  1333.   @@:
  1334.     cmp  [snake_direction], RIGHT
  1335.      jne @f
  1336.     mov  [snake_direction_next],    LEFT
  1337.      jmp .quit
  1338.   @@:
  1339.     cmp  [snake_direction], UP
  1340.      jne @f
  1341.     mov  [snake_direction_next],    DOWN
  1342.      jmp .quit
  1343.   @@:
  1344.    cmp  [snake_direction], DOWN
  1345.      jne @f
  1346.     mov  [snake_direction_next],    UP
  1347. ;     jmp .quit
  1348.   @@:
  1349.  
  1350.   .quit:
  1351.     ret
  1352.  
  1353.     ;;---Reverse_snake---------------------------------------------------------------------------------------------------------
  1354.  
  1355.  
  1356. ;;===Variables==================================================================================================================
  1357.  
  1358. window_title                db      'Snake',64+15 dup (0)
  1359. window_title_with_lives     db      '_ live(s)',0
  1360. default_separating_symbol   db      '|',0
  1361. window_style_windowed       dd      0x33000000              ; scalable skinned window
  1362. window_style_fullscreen     dd      0x00000000
  1363. time_before_waiting         dd      0x0
  1364. time_to_wait                dd      0x0
  1365. time_wait_limit             dd      101
  1366. time_wait_limit_const       dd      0x0
  1367.  
  1368. play_mode                   dd      0x0
  1369. lives                       dd      START_LIVES
  1370. acceleration_mask           dd      0x0
  1371.  
  1372. resized_by_hotkey           dd      0x0
  1373. fullscreen                  dd      0x0
  1374.  
  1375. szZ string_score            ,'SCORE : '
  1376. szZ string_hi_score         ,'HI-SCORE : '
  1377. szZ string_champion         ,'CHAMPION : '
  1378. szZ string_level            ,'LEVEL : '
  1379. szZ string_pause_space      ,'PAUSE - ',0x27,'SPACE',0x27
  1380. szZ string_resume_space     ,'RESUME - ',0x27,'SPACE',0x27
  1381. szZ string_menu_esc         ,'MENU - ',0x27,'ESC',0x27
  1382. szZ string_apply_name_enter ,'APPLY NAME - ',0x27,'ENTER',0x27
  1383. szZ press_to_start          ,'PRESS ',0x27,'ENTER',0x27,' TO START'
  1384. szZ press_esc_to_exit       ,'PRESS ',0x27,'ESC',0x27,' TO EXIT'
  1385. ;press_F2_to_options         db      'PRESS ',0x27,'F2',0x27,' TO OPTIONS',0
  1386.  
  1387. szZ string_congratulations  ,'   Congratulations!!! New hi-score is : '
  1388. szZ string_enter_your_name  ,'You are the champion! Enter your name : '
  1389.  
  1390. szZ string_button_play      ,'PLAY'
  1391. szZ string_button_exit      ,'EXIT'
  1392. szZ string_button_inc       ,'+INC+'
  1393. szZ string_button_dec       ,'-dec-'
  1394. szZ string_button_pm_classic,'CLASSIC mode'
  1395. szZ string_button_pm_levels ,'LEVELS mode'
  1396.  
  1397. is_new_record               dd      0
  1398.  
  1399. action                      dd      0
  1400.  
  1401. picture_first_menu_snake    db      0xf4,0x99,0x2f,\
  1402.                                     0x86,0xa5,0x49,\
  1403.                                     0xf5,0xa5,0x8f,\
  1404.                                     0x15,0xbd,0x48,\
  1405.                                     0xf4,0xa5,0x2f
  1406.  
  1407. picture_first_menu_version  db      0xf1,0xe0,\
  1408.                                     0x90,0x20,\
  1409.                                     0x90,0x20,\
  1410.                                     0x90,0x20,\
  1411.                                     0xf4,0x20
  1412.  
  1413. picture_pause               db      11100011b,00100101b,11101111b,\
  1414.                                     10010100b,10100101b,00001000b,\
  1415.                                     10010100b,10100101b,00001000b,\
  1416.                                     11100111b,10100101b,11101111b,\
  1417.                                     10000100b,10100100b,00101000b,\
  1418.                                     10000100b,10011001b,11101111b
  1419.  
  1420. picture_game_over           db      00110000b,00000000b,00000000b,00000000b,\
  1421.                                     01001001b,11001000b,10111100b,00000000b,\
  1422.                                     10000010b,00101101b,10100000b,00000000b,\
  1423.                                     10011010b,00101010b,10111000b,00000000b,\
  1424.                                     10001011b,11101000b,10100000b,00000000b,\
  1425.                                     01110010b,00101000b,10111100b,00000000b,\
  1426.                                     00000000b,00000000b,00000000b,00000000b,\
  1427.                                     00000111b,00000000b,00000000b,00000000b,\
  1428.                                     00001000b,10100010b,11110111b,10000000b,\
  1429.                                     00001000b,10100010b,10000100b,01000000b,\
  1430.                                     00001000b,10100010b,11100100b,01000000b,\
  1431.                                     00001000b,10010100b,10000111b,10000000b,\
  1432.                                     00000111b,00001000b,11110100b,01000000b
  1433.  
  1434. picture_you_win             db      10001001b,11001000b,10000000b,\
  1435.                                     10001010b,00101000b,10000000b,\
  1436.                                     01010010b,00101000b,10000000b,\
  1437.                                     00100010b,00101000b,10000000b,\
  1438.                                     00100001b,11000111b,00000000b,\
  1439.                                     00000000b,00000000b,00000000b,\
  1440.                                     00000000b,00000000b,00000000b,\
  1441.                                     01000100b,10010001b,00000000b,\
  1442.                                     01010100b,10011001b,00000000b,\
  1443.                                     01010100b,10010101b,00000000b,\
  1444.                                     01010100b,10010011b,00000000b,\
  1445.                                     00101000b,10010001b,00000000b
  1446.  
  1447. picture_level               db      10000111b,10100101b,11101000b,\
  1448.                                     10000100b,00100101b,00001000b,\
  1449.                                     10000111b,00100101b,11001000b,\
  1450.                                     10000100b,00101001b,00001000b,\
  1451.                                     11110111b,10110001b,11101111b
  1452.  
  1453. digits_font                 db      0xf0,0x90,0x90,0x90,0xf0,\
  1454.                                     0x20,0x60,0x20,0x20,0x20,\
  1455.                                     0xf0,0x10,0xf0,0x80,0xf0,\
  1456.                                     0xf0,0x10,0x70,0x10,0xf0,\
  1457.                                     0x90,0x90,0xf0,0x10,0x10,\
  1458.                                     0xf0,0x80,0xf0,0x10,0xf0,\
  1459.                                     0xf0,0x80,0xf0,0x90,0xf0,\
  1460.                                     0xf0,0x10,0x10,0x10,0x10,\
  1461.                                     0xf0,0x90,0xf0,0x90,0xf0,\
  1462.                                     0xf0,0x90,0xf0,0x10,0xf0
  1463.  
  1464. stage_00:
  1465. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1466.                                     00000000b,00000000b,00000000b,00000000b,\
  1467.                                     00000000b,00000000b,00000000b,00000000b,\
  1468.                                     00000000b,00000000b,00000000b,00000000b,\
  1469.                                     00000000b,00000000b,00000000b,00000000b,\
  1470.                                     00000000b,00000000b,00000000b,00000000b,\
  1471.                                     00000000b,00000000b,00000000b,00000000b,\
  1472.                                     00000000b,00000000b,00000000b,00000000b,\
  1473.                                     00000000b,00000000b,00000000b,00000000b,\
  1474.                                     00000000b,00000000b,00000000b,00000000b,\
  1475.                                     00000000b,00000000b,00000000b,00000000b,\
  1476.                                     00000000b,00000000b,00000000b,00000000b,\
  1477.                                     00000000b,00000000b,00000000b,00000000b,\
  1478.                                     00000000b,00000000b,00000000b,00000000b
  1479.  
  1480. .snake_dots                 db      3,3, 4,3, 5,3
  1481. .snake_direction            dd      RIGHT
  1482. .snake_direction_next       dd      RIGHT
  1483. .number_of_stones           dd      0
  1484. .name                       dd      stage_00_name
  1485.  
  1486. stage_01:
  1487. .field                      db      11111000b,00000000b,00000001b,11110000b,\
  1488.                                     10000000b,00000000b,00000000b,00010000b,\
  1489.                                     10000000b,00000000b,00000000b,00010000b,\
  1490.                                     10000000b,00000000b,00000000b,00010000b,\
  1491.                                     10000000b,00000000b,00000000b,00010000b,\
  1492.                                     00000000b,00000000b,00000000b,00000000b,\
  1493.                                     00000000b,00000000b,00000000b,00000000b,\
  1494.                                     00000000b,00000000b,00000000b,00000000b,\
  1495.                                     00000000b,00000000b,00000000b,00000000b,\
  1496.                                     10000000b,00000000b,00000000b,00010000b,\
  1497.                                     10000000b,00000000b,00000000b,00010000b,\
  1498.                                     10000000b,00000000b,00000000b,00010000b,\
  1499.                                     10000000b,00000000b,00000000b,00010000b,\
  1500.                                     11111000b,00000000b,00000001b,11110000b
  1501.  
  1502. .snake_dots                 db      3,3, 4,3, 5,3
  1503. .snake_direction            dd      RIGHT
  1504. .snake_direction_next       dd      RIGHT
  1505. .number_of_stones           dd      36
  1506. .name                       dd      stage_01_name
  1507.  
  1508. stage_02:
  1509. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1510.                                     00000000b,00000000b,00000000b,00000000b,\
  1511.                                     00011111b,11000000b,00111111b,10000000b,\
  1512.                                     00010000b,00000000b,00000000b,10000000b,\
  1513.                                     00010000b,00000000b,00000000b,10000000b,\
  1514.                                     00010000b,00000000b,00000000b,10000000b,\
  1515.                                     00000000b,00000000b,00000000b,00000000b,\
  1516.                                     00000000b,00000000b,00000000b,00000000b,\
  1517.                                     00010000b,00000000b,00000000b,10000000b,\
  1518.                                     00010000b,00000000b,00000000b,10000000b,\
  1519.                                     00010000b,00000000b,00000000b,10000000b,\
  1520.                                     00011111b,11000000b,00111111b,10000000b,\
  1521.                                     00000000b,00000000b,00000000b,00000000b,\
  1522.                                     00000000b,00000000b,00000000b,00000000b
  1523.  
  1524. .snake_dots                 db      7,5, 8,5, 9,5
  1525. .snake_direction            dd      RIGHT
  1526. .snake_direction_next       dd      RIGHT
  1527. .number_of_stones           dd      40
  1528. .name                       dd      stage_02_name
  1529.  
  1530. stage_03:
  1531. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1532.                                     00000000b,00000000b,00000000b,00000000b,\
  1533.                                     00000000b,00001001b,00000000b,00000000b,\
  1534.                                     00000000b,00001001b,00000000b,00000000b,\
  1535.                                     00000000b,00001001b,00000000b,00000000b,\
  1536.                                     00001111b,11111001b,11111111b,00000000b,\
  1537.                                     00000000b,00000000b,00000000b,00000000b,\
  1538.                                     00000000b,00000000b,00000000b,00000000b,\
  1539.                                     00001111b,11111001b,11111111b,00000000b,\
  1540.                                     00000000b,00001001b,00000000b,00000000b,\
  1541.                                     00000000b,00001001b,00000000b,00000000b,\
  1542.                                     00000000b,00001001b,00000000b,00000000b,\
  1543.                                     00000000b,00000000b,00000000b,00000000b,\
  1544.                                     00000000b,00000000b,00000000b,00000000b
  1545.  
  1546. .snake_dots                 db      23,0, 22,0, 21,0
  1547. .snake_direction            dd      LEFT
  1548. .snake_direction_next       dd      LEFT
  1549. .number_of_stones           dd      48
  1550. .name                       dd      stage_03_name
  1551.  
  1552. stage_04:
  1553. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1554.                                     00000000b,00100000b,01000000b,00000000b,\
  1555.                                     00000010b,00100000b,01000100b,00000000b,\
  1556.                                     00000010b,00000000b,00000100b,00000000b,\
  1557.                                     00010000b,00100000b,01000000b,10000000b,\
  1558.                                     00000010b,00100000b,01000100b,00000000b,\
  1559.                                     00010010b,00000000b,00000100b,10000000b,\
  1560.                                     00010010b,00000000b,00000100b,10000000b,\
  1561.                                     00000010b,00100000b,01000000b,00000000b,\
  1562.                                     00010000b,00100000b,01000000b,10000000b,\
  1563.                                     00000010b,00000000b,00000100b,00000000b,\
  1564.                                     00000010b,00100000b,01000100b,00000000b,\
  1565.                                     00000000b,00100000b,01000000b,00000000b,\
  1566.                                     00000000b,00000000b,00000000b,00000000b
  1567.  
  1568. .snake_dots                 db      19,6, 19,7, 19,8
  1569. .snake_napravlenie          dd      DOWN
  1570. .snake_napravlenie_next     dd      DOWN
  1571. .number_of_stones           dd      39
  1572. .name                       dd      stage_04_name
  1573.  
  1574. stage_05:
  1575. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1576.                                     00000000b,00000000b,00000000b,00000000b,\
  1577.                                     00000001b,11111111b,11111000b,00000000b,\
  1578.                                     00000001b,11111111b,11111000b,00000000b,\
  1579.                                     00000000b,00000000b,00000000b,00000000b,\
  1580.                                     00000000b,00000000b,00000000b,00000000b,\
  1581.                                     00000111b,11111111b,11111110b,00000000b,\
  1582.                                     00000111b,11111111b,11111110b,00000000b,\
  1583.                                     00000000b,00000000b,00000000b,00000000b,\
  1584.                                     00000000b,00000000b,00000000b,00000000b,\
  1585.                                     00111111b,11111111b,11111111b,11000000b,\
  1586.                                     00111111b,11111111b,11111111b,11000000b,\
  1587.                                     00000000b,00000000b,00000000b,00000000b,\
  1588.                                     00000000b,00000000b,00000000b,00000000b
  1589.  
  1590. .snake_dots                 db      0,0, 0,1, 1,1
  1591. .snake_direction            dd      RIGHT
  1592. .snake_direction_next       dd      RIGHT
  1593. .number_of_stones           dd      112
  1594. .name                       dd      stage_05_name
  1595.  
  1596. stage_06:
  1597. .field                      db      00000001b,10000000b,00000000b,00000000b,\
  1598.                                     00000001b,11111111b,11111000b,00000000b,\
  1599.                                     00000001b,11111111b,11111000b,00000000b,\
  1600.                                     00000000b,00000000b,00011000b,00000000b,\
  1601.                                     00000000b,00000000b,00011000b,00000000b,\
  1602.                                     00011111b,11111111b,11111000b,00000000b,\
  1603.                                     00011111b,11111111b,11111000b,00000000b,\
  1604.                                     00011000b,00000000b,00000000b,00000000b,\
  1605.                                     00011000b,00000000b,00000000b,00000000b,\
  1606.                                     00011111b,11111111b,11111111b,11100000b,\
  1607.                                     00011111b,11111111b,11111111b,11100000b,\
  1608.                                     00000000b,00000000b,00000000b,01100000b,\
  1609.                                     00000000b,00000000b,00000000b,01100000b,\
  1610.                                     00000000b,00000000b,00000000b,01100000b
  1611.  
  1612. .snake_dots                 db      0,0, 0,1, 1,1
  1613. .snake_direction            dd      RIGHT
  1614. .snake_direction_next       dd      RIGHT
  1615. .number_of_stones           dd      128
  1616. .name                       dd      stage_06_name
  1617.  
  1618. stage_07:
  1619. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1620.                                     00000000b,00000000b,00000000b,00000000b,\
  1621.                                     00000000b,00000000b,00000000b,00000000b,\
  1622.                                     00000011b,11111111b,11111100b,00000000b,\
  1623.                                     00000000b,00000000b,00000100b,00000000b,\
  1624.                                     00000011b,11111111b,11110100b,00000000b,\
  1625.                                     00000010b,00000000b,00010100b,00000000b,\
  1626.                                     00000010b,11111111b,11010100b,00000000b,\
  1627.                                     00000010b,00000000b,00010100b,00000000b,\
  1628.                                     00000010b,11111111b,11110100b,00000000b,\
  1629.                                     00000010b,00000000b,00000100b,00000000b,\
  1630.                                     00000011b,11111111b,11111100b,00000000b,\
  1631.                                     00000000b,00000000b,00000000b,00000000b,\
  1632.                                     00000000b,00000000b,00000000b,00000000b
  1633.  
  1634. .snake_dots                 db      8,1, 9,1, 10,1
  1635. .snake_direction            dd      RIGHT
  1636. .snake_direction_next       dd      RIGHT
  1637. .number_of_stones           dd      83
  1638. .name                       dd      stage_07_name
  1639.  
  1640. stage_08:
  1641. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1642.                                     00000000b,00000000b,00000000b,00000000b,\
  1643.                                     00000000b,00000000b,00010000b,00000000b,\
  1644.                                     00001001b,00000001b,00000000b,00000000b,\
  1645.                                     00000001b,01001001b,00000101b,00000000b,\
  1646.                                     00000000b,01000000b,00000100b,00000000b,\
  1647.                                     00001111b,00000000b,11100000b,00000000b,\
  1648.                                     00000000b,00000000b,00001000b,10000000b,\
  1649.                                     00000111b,00100000b,10000010b,10000000b,\
  1650.                                     00010000b,00000000b,00000010b,00000000b,\
  1651.                                     00010000b,11000000b,01110010b,00000000b,\
  1652.                                     00010010b,00000000b,00000010b,00000000b,\
  1653.                                     00000000b,00000000b,00000000b,00000000b,\
  1654.                                     00000000b,00000000b,00000000b,00000000b
  1655.  
  1656. .snake_dots                 db      0,0, 1,0, 2,0
  1657. .snake_direction            dd      RIGHT
  1658. .snake_direction_next       dd      RIGHT
  1659. .number_of_stones           dd      40
  1660. .name                       dd      stage_08_name
  1661.  
  1662. stage_09:
  1663. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1664.                                     00000000b,00000000b,00000000b,00000000b,\
  1665.                                     00000000b,00000000b,00000000b,00000000b,\
  1666.                                     00000000b,00000000b,00000000b,00000000b,\
  1667.                                     00111101b,00100110b,01001011b,11000000b,\
  1668.                                     00100001b,10101001b,01010010b,00000000b,\
  1669.                                     00111101b,01100001b,01100011b,10000000b,\
  1670.                                     00000101b,01100111b,01010010b,00000000b,\
  1671.                                     00111101b,00100001b,01001011b,11000000b,\
  1672.                                     00000000b,00000000b,00000000b,00000000b,\
  1673.                                     00000000b,00000000b,00000000b,00000000b,\
  1674.                                     00000000b,00000000b,00000000b,00000000b,\
  1675.                                     00000000b,00000000b,00000000b,00000000b,\
  1676.                                     00000000b,00000000b,00000000b,00000000b
  1677.  
  1678. .snake_dots                 db      12,6, 12,7, 12,8
  1679. .snake_direction            dd      DOWN
  1680. .snake_direction_next       dd      DOWN
  1681. .number_of_stones           dd      59
  1682. .name                       dd      stage_09_name
  1683.  
  1684. stage_10:
  1685. .field                      db      11101110b,11101110b,11101110b,11100000b,\
  1686.                                     11101110b,11101110b,11101110b,11100000b,\
  1687.                                     11101110b,11101110b,11101110b,11100000b,\
  1688.                                     00000000b,00000000b,00000000b,00000000b,\
  1689.                                     11101110b,11101110b,11101110b,11100000b,\
  1690.                                     11101110b,11101110b,11101110b,11100000b,\
  1691.                                     11101110b,11101110b,11101110b,11100000b,\
  1692.                                     00000000b,00000000b,00000000b,00000000b,\
  1693.                                     11101110b,11101110b,11101110b,11100000b,\
  1694.                                     11101110b,11101110b,11101110b,11100000b,\
  1695.                                     11101110b,11101110b,11101110b,11100000b,\
  1696.                                     00000000b,00000000b,00000000b,00000000b,\
  1697.                                     11101110b,11101110b,11101110b,11100000b,\
  1698.                                     11101110b,11101110b,11101110b,11100000b
  1699.  
  1700. .snake_dots                 db      3,2, 3,3, 4,3
  1701. .snake_direction            dd      RIGHT
  1702. .snake_direction_next       dd      RIGHT
  1703. .number_of_stones           dd      231
  1704. .name                       dd      stage_10_name
  1705.  
  1706. stage_11:
  1707. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1708.                                     00000000b,00000000b,00000000b,00000000b,\
  1709.                                     00000000b,00000000b,00000000b,00000000b,\
  1710.                                     00000111b,00000111b,00000111b,00000000b,\
  1711.                                     00001101b,10001101b,10001101b,10000000b,\
  1712.                                     00011000b,11011000b,11011000b,11000000b,\
  1713.                                     00000000b,01000000b,01000000b,01000000b,\
  1714.                                     00011000b,11011000b,11011000b,11000000b,\
  1715.                                     00001101b,10001101b,10001101b,10000000b,\
  1716.                                     00000111b,00000111b,00000111b,00000000b,\
  1717.                                     00000000b,00000000b,00000000b,00000000b,\
  1718.                                     00000000b,00000000b,00000000b,00000000b,\
  1719.                                     00000000b,00000000b,00000000b,00000000b,\
  1720.                                     00000000b,00000000b,00000000b,00000000b
  1721.  
  1722. .snake_dots                 db      3,12, 4,12, 5,12
  1723. .snake_direction            dd      RIGHT
  1724. .snake_direction_next       dd      RIGHT
  1725. .number_of_stones           dd      69
  1726. .name                       dd      stage_11_name
  1727.  
  1728. stage_12:
  1729. .field                      db      00000000b,00011000b,00001110b,00000000b,\
  1730.                                     01101110b,00010000b,00001010b,01010000b,\
  1731.                                     01001011b,11011001b,11000000b,01110000b,\
  1732.                                     01100001b,01000001b,01000000b,00000000b,\
  1733.                                     00000000b,00000000b,00000011b,10000000b,\
  1734.                                     00000000b,00000000b,00000010b,10000000b,\
  1735.                                     01010011b,00001100b,10100110b,00110000b,\
  1736.                                     01110010b,00001000b,11100100b,00010000b,\
  1737.                                     00000011b,00001100b,00000110b,00110000b,\
  1738.                                     00000000b,11100000b,00000000b,00000000b,\
  1739.                                     00010100b,10100000b,00000110b,00000000b,\
  1740.                                     11011100b,00000110b,10100100b,00000000b,\
  1741.                                     01000011b,10000010b,11100110b,10100000b,\
  1742.                                     11000010b,10000110b,00000000b,11100000b
  1743.  
  1744. .snake_dots                 db      27,0, 26,0, 25,0
  1745. .snake_direction            dd      LEFT
  1746. .snake_direction_next       dd      LEFT
  1747. .number_of_stones           dd      110
  1748. .name                       dd      stage_12_name
  1749.  
  1750. stage_13:
  1751. .field                      db      00111000b,00100000b,00000000b,00000000b,\
  1752.                                     01111100b,11110011b,11000011b,10000000b,\
  1753.                                     11111100b,01110011b,10000001b,11000000b,\
  1754.                                     11110000b,00000011b,11000000b,00000000b,\
  1755.                                     00000000b,00000010b,00000000b,00000000b,\
  1756.                                     00000000b,00000010b,00000001b,00000000b,\
  1757.                                     00011110b,00000111b,00000111b,00000000b,\
  1758.                                     00000111b,10001111b,11111110b,00000000b,\
  1759.                                     00000011b,11111111b,11111100b,00000000b,\
  1760.                                     00110001b,11111111b,11111001b,01100000b,\
  1761.                                     00001110b,11101011b,00100111b,10000000b,\
  1762.                                     01111000b,10000011b,10000010b,00000000b,\
  1763.                                     00000011b,11100110b,00011010b,11000000b,\
  1764.                                     00000000b,00000000b,00000000b,00000000b
  1765.  
  1766. .snake_dots                 db      0,5, 0,6, 0,7
  1767. .snake_direction            dd      DOWN
  1768. .snake_direction_next       dd      DOWN
  1769. .number_of_stones           dd      141
  1770. .name                       dd      stage_13_name
  1771.  
  1772. stage_14:
  1773. .field                      db      00000110b,00000000b,00000000b,00000000b,\
  1774.                                     00001000b,00000000b,00011000b,00000000b,\
  1775.                                     00010000b,00000000b,00000100b,00000000b,\
  1776.                                     00100001b,10000000b,11000010b,00000000b,\
  1777.                                     01000010b,01000001b,00100001b,00000000b,\
  1778.                                     10000100b,00000010b,00010000b,10000000b,\
  1779.                                     10001000b,00000100b,00001000b,01000000b,\
  1780.                                     10010000b,00001000b,00000100b,01000000b,\
  1781.                                     01001000b,00010000b,00001000b,10000000b,\
  1782.                                     00100100b,00100000b,00010001b,00000000b,\
  1783.                                     00010010b,01000001b,00100010b,00000000b,\
  1784.                                     00001001b,10000000b,11000100b,00000000b,\
  1785.                                     00000100b,00000000b,00001000b,00000000b,\
  1786.                                     00000000b,00000000b,00110000b,00000000b
  1787.  
  1788. .snake_dots                 db      8,0, 9,0, 10,0
  1789. .snake_direction            dd      RIGHT
  1790. .snake_direction_next       dd      RIGHT
  1791. .number_of_stones           dd      60
  1792. .name                       dd      stage_14_name
  1793.  
  1794. stage_15:
  1795. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1796.                                     00000000b,01110000b,00110000b,00000000b,\
  1797.                                     00000000b,10000000b,00001010b,00000000b,\
  1798.                                     00100001b,00000000b,00110010b,00000000b,\
  1799.                                     00010001b,00111111b,10011100b,00000000b,\
  1800.                                     00001001b,00100000b,11000000b,00000000b,\
  1801.                                     00010000b,00000010b,01000000b,00000000b,\
  1802.                                     00100000b,00000010b,00100001b,10000000b,\
  1803.                                     00010000b,00000010b,00110010b,01000000b,\
  1804.                                     00001000b,01000100b,00011100b,01000000b,\
  1805.                                     00010000b,00111000b,00010000b,01000000b,\
  1806.                                     00100000b,00000000b,00010000b,01000000b,\
  1807.                                     00000000b,00000000b,00000000b,00000000b,\
  1808.                                     00000000b,00000000b,00000000b,00000000b
  1809.  
  1810. .snake_dots                 db      13,3, 13,2, 14,2
  1811. .snake_direction            dd      RIGHT
  1812. .snake_direction_next       dd      RIGHT
  1813. .number_of_stones           dd      60
  1814. .name                       dd      stage_15_name
  1815.  
  1816. stage_16:
  1817. .field                      db      00000000b,10000010b,00000000b,00000000b,\
  1818.                                     00000000b,01001010b,10000010b,10100000b,\
  1819.                                     01111111b,11100111b,00000001b,11000000b,\
  1820.                                     00000000b,01000010b,00000000b,10000000b,\
  1821.                                     00000100b,10000000b,01000000b,00000001b,\
  1822.                                     00000100b,00100000b,10000000b,00000010b,\
  1823.                                     11000100b,00010001b,11111000b,00000111b,\
  1824.                                     00010101b,00001000b,10000000b,00000010b,\
  1825.                                     00001110b,00010000b,01000000b,00000001b,\
  1826.                                     00000100b,00100010b,00000000b,10000000b,\
  1827.                                     00000000b,00000010b,00000000b,01000000b,\
  1828.                                     00111111b,11111111b,11111111b,11100000b,\
  1829.                                     00000000b,00000010b,00000000b,01000000b,\
  1830.                                     00000000b,00000010b,00000000b,10000000b
  1831.  
  1832. .snake_dots                 db      11,7, 10,7, 9,7
  1833. .snake_direction            dd      LEFT
  1834. .snake_direction_next       dd      LEFT
  1835. .number_of_stones           dd      96
  1836. .name                       dd      stage_16_name
  1837.  
  1838. stage_17:
  1839. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1840.                                     00000000b,00000000b,00000000b,00000000b,\
  1841.                                     00000000b,00000000b,00000000b,00000000b,\
  1842.                                     00000111b,10000001b,11100000b,00000000b,\
  1843.                                     00001000b,01000010b,00010000b,00000000b,\
  1844.                                     00010001b,00100100b,01001000b,00000000b,\
  1845.                                     00010001b,00000000b,01001000b,00000000b,\
  1846.                                     00001000b,01000010b,00010000b,00000000b,\
  1847.                                     00000111b,10000001b,11100000b,00000000b,\
  1848.                                     00000000b,00000000b,00000000b,00000000b,\
  1849.                                     00000000b,01000000b,00000000b,00000000b,\
  1850.                                     00000000b,00111110b,00000000b,00000000b,\
  1851.                                     00000000b,00000000b,00000000b,00000000b,\
  1852.                                     00000000b,00000000b,00000000b,00000000b
  1853.  
  1854. .snake_dots                 db      11,7, 11,8, 12,8
  1855. .snake_direction            dd      RIGHT
  1856. .snake_direction_next       dd      RIGHT
  1857. .number_of_stones           dd      40
  1858. .name                       dd      stage_17_name
  1859.  
  1860. stage_18:
  1861. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1862.                                     01000100b,01000100b,01000100b,01000000b,\
  1863.                                     00101010b,10101010b,10101010b,10100000b,\
  1864.                                     00010001b,00010001b,00010001b,00000000b,\
  1865.                                     00000000b,00000000b,00000000b,00000000b,\
  1866.                                     00000000b,00000000b,00000000b,00000000b,\
  1867.                                     01000100b,01000100b,01000100b,01000000b,\
  1868.                                     00101010b,10101010b,10101010b,10100000b,\
  1869.                                     00010001b,00010001b,00010001b,00000000b,\
  1870.                                     00000000b,00000000b,00000000b,00000000b,\
  1871.                                     00000000b,00000000b,00000000b,00000000b,\
  1872.                                     01000100b,01000100b,01000100b,01000000b,\
  1873.                                     00101010b,10101010b,10101010b,10100000b,\
  1874.                                     00010001b,00010001b,00010001b,00000000b
  1875.  
  1876. .snake_dots                 db      2,5, 3,5, 4,5
  1877. .snake_direction            dd      RIGHT
  1878. .snake_direction_next       dd      RIGHT
  1879. .number_of_stones           dd      78
  1880. .name                       dd      stage_18_name
  1881.  
  1882. stage_19:
  1883. .field                      db      01000010b,00100100b,10000101b,00000000b,\
  1884.                                     00010000b,00010000b,00100000b,10000000b,\
  1885.                                     00111001b,00000010b,00010000b,00100000b,\
  1886.                                     01000100b,00001000b,00000010b,00000000b,\
  1887.                                     01010101b,01000000b,01000000b,01000000b,\
  1888.                                     01010100b,00010000b,00001000b,11100000b,\
  1889.                                     00000100b,10001001b,00100001b,00000000b,\
  1890.                                     01111100b,00100000b,00000001b,01010000b,\
  1891.                                     00111001b,00000100b,00010001b,01010000b,\
  1892.                                     00010000b,00000000b,10000001b,00010000b,\
  1893.                                     11010111b,11100000b,00011101b,11110000b,\
  1894.                                     00010000b,01000000b,00100000b,11100000b,\
  1895.                                     00010000b,10000000b,00100000b,01000000b,\
  1896.                                     00000001b,00000000b,00010000b,01000000b
  1897.  
  1898. .snake_dots                 db      27,6, 0,6, 1,6
  1899. .snake_direction            dd      RIGHT
  1900. .snake_direction_next       dd      RIGHT
  1901. .number_of_stones           dd      95
  1902. .name                       dd      stage_19_name
  1903.  
  1904. stage_20:
  1905. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1906.                                     00000000b,00000000b,10001000b,00000000b,\
  1907.                                     00000000b,00011100b,10000100b,00000000b,\
  1908.                                     00000000b,01100100b,10000010b,00000000b,\
  1909.                                     00000011b,10000100b,10000100b,00000000b,\
  1910.                                     00000010b,00000100b,10001000b,00000000b,\
  1911.                                     00000010b,00000100b,10000100b,00000000b,\
  1912.                                     00000010b,00000100b,10000010b,00000000b,\
  1913.                                     00000010b,00111100b,10010010b,00000000b,\
  1914.                                     00011110b,00111100b,10010100b,00000000b,\
  1915.                                     00011110b,00111100b,10001000b,00000000b,\
  1916.                                     00011110b,00000000b,10000000b,00000000b,\
  1917.                                     00000000b,00000000b,10000000b,00000000b,\
  1918.                                     00000000b,00000000b,00000000b,00000000b
  1919.  
  1920. .snake_dots                 db      17,2, 17,3, 17,4
  1921. .snake_direction            dd      DOWN
  1922. .snake_direction_next       dd      DOWN
  1923. .number_of_stones           dd      65
  1924. .name                       dd      stage_20_name
  1925.  
  1926. stage_21:
  1927. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1928.                                     00000000b,00000000b,00000000b,00000000b,\
  1929.                                     00000011b,11111111b,11111110b,00000000b,\
  1930.                                     00000001b,01000100b,01000100b,00000000b,\
  1931.                                     00000010b,01000100b,01000100b,00000000b,\
  1932.                                     00001100b,01000100b,01000100b,00000000b,\
  1933.                                     01110000b,01000100b,01000100b,00000000b,\
  1934.                                     01110000b,01000100b,01000100b,00000000b,\
  1935.                                     01110000b,11101110b,11101110b,00000000b,\
  1936.                                     00000000b,11101110b,11101110b,00000000b,\
  1937.                                     00000000b,11101110b,11101110b,00000000b,\
  1938.                                     00000000b,00000000b,00000000b,00000000b,\
  1939.                                     00000000b,00000000b,00000000b,00000000b,\
  1940.                                     00000000b,00000000b,00000000b,00000000b
  1941.  
  1942. .snake_dots                 db      10,1, 11,1, 12,1
  1943. .snake_direction            dd      RIGHT
  1944. .snake_direction_next       dd      RIGHT
  1945. .number_of_stones           dd      86
  1946. .name                       dd      stage_21_name
  1947.  
  1948. stage_22:
  1949. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1950.                                     00000011b,10000000b,00000000b,00000000b,\
  1951.                                     00000111b,11100000b,00000000b,00000000b,\
  1952.                                     00001111b,11110000b,00000000b,00000000b,\
  1953.                                     00011111b,11100000b,00000000b,00000000b,\
  1954.                                     00011111b,11000011b,00001100b,00110000b,\
  1955.                                     00011111b,10000111b,10011110b,01110000b,\
  1956.                                     00011111b,11000111b,10011110b,01110000b,\
  1957.                                     00011111b,11100011b,00001100b,00110000b,\
  1958.                                     00001111b,11110000b,00000000b,00000000b,\
  1959.                                     00000111b,11100000b,00000000b,00000000b,\
  1960.                                     00000011b,10000000b,00000000b,00000000b,\
  1961.                                     00000000b,00000000b,00000000b,00000000b,\
  1962.                                     00000000b,00000000b,00000000b,00000000b
  1963.  
  1964. .snake_dots                 db      1,7, 1,6, 1,5
  1965. .snake_direction            dd      UP
  1966. .snake_direction_next       dd      UP
  1967. .number_of_stones           dd      104
  1968. .name                       dd      stage_22_name
  1969.  
  1970. stage_23:
  1971. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1972.                                     00100000b,01000101b,00010000b,00100000b,\
  1973.                                     00011010b,00100101b,00100010b,11000000b,\
  1974.                                     00000100b,10101000b,10101001b,00000000b,\
  1975.                                     00000100b,10010010b,01001001b,00000000b,\
  1976.                                     00001011b,00110000b,01100110b,10000000b,\
  1977.                                     00000000b,11001010b,10011000b,00000000b,\
  1978.                                     00000001b,00000111b,00000100b,00000000b,\
  1979.                                     00001110b,01001010b,10010011b,10000000b,\
  1980.                                     00000010b,00110000b,01100010b,00000000b,\
  1981.                                     00000101b,00010010b,01000101b,00000000b,\
  1982.                                     00001001b,00001000b,10000100b,10000000b,\
  1983.                                     00000000b,00001000b,10000000b,00000000b,\
  1984.                                     00000000b,00000000b,00000000b,00000000b
  1985.  
  1986. .snake_dots                 db      15,0, 14,0, 13,0
  1987. .snake_direction            dd      LEFT
  1988. .snake_direction_next       dd      LEFT
  1989. .number_of_stones           dd      85
  1990. .name                       dd      stage_23_name
  1991.  
  1992. stage_24:
  1993. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  1994.                                     00111111b,11111111b,11111111b,10000000b,\
  1995.                                     00100000b,00000000b,00000000b,10000000b,\
  1996.                                     00100011b,11111111b,11111000b,10000000b,\
  1997.                                     00100010b,00000000b,00001000b,10000000b,\
  1998.                                     00100010b,00111111b,10001000b,10000000b,\
  1999.                                     00100010b,00100000b,10001000b,10000000b,\
  2000.                                     00101010b,10101010b,10101010b,10000000b,\
  2001.                                     00001000b,10001110b,00100010b,00000000b,\
  2002.                                     00001000b,10000000b,00100010b,00000000b,\
  2003.                                     00001000b,11111111b,11100010b,00000000b,\
  2004.                                     00001000b,00000000b,00000010b,00000000b,\
  2005.                                     00001111b,11111111b,11111110b,00000000b,\
  2006.                                     00000000b,00000000b,00000000b,00000000b
  2007.  
  2008. .snake_dots                 db      1,0, 0,0, 0,1
  2009. .snake_direction            dd      DOWN
  2010. .snake_direction_next       dd      DOWN
  2011. .number_of_stones           dd      120
  2012. .name                       dd      stage_24_name
  2013.  
  2014. stage_25:
  2015. .field                      db      00000100b,11000000b,00000000b,00000000b,\
  2016.                                     00000011b,10000000b,00110010b,00000000b,\
  2017.                                     10011010b,10000000b,00011100b,00000000b,\
  2018.                                     01110000b,00000000b,00010101b,10010000b,\
  2019.                                     01010000b,00000111b,00000000b,11100000b,\
  2020.                                     00000100b,00000101b,00000000b,10100000b,\
  2021.                                     00000100b,00000100b,00000000b,00000000b,\
  2022.                                     00000011b,11111100b,00011001b,00000000b,\
  2023.                                     00000010b,10010100b,00001110b,00000000b,\
  2024.                                     00000010b,10010100b,00001010b,00000000b,\
  2025.                                     00000000b,00000000b,00000000b,00000000b,\
  2026.                                     00000011b,00100001b,10010011b,00100000b,\
  2027.                                     00000001b,11000000b,11100001b,11000000b,\
  2028.                                     00000001b,01000000b,10100001b,01000000b
  2029.  
  2030. .snake_dots                 db      11,2, 12,2, 13,2
  2031. .snake_direction            dd      RIGHT
  2032. .snake_direction_next       dd      RIGHT
  2033. .number_of_stones           dd      88
  2034. .name                       dd      stage_25_name
  2035.  
  2036. stage_26:
  2037. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  2038.                                     00111100b,01001111b,01111010b,01000000b,\
  2039.                                     00100000b,01000001b,00001010b,01000000b,\
  2040.                                     00100100b,01001111b,01111011b,11000000b,\
  2041.                                     00000100b,01001000b,00001000b,01000000b,\
  2042.                                     00111100b,01001111b,01111000b,01000000b,\
  2043.                                     00000000b,00000000b,00000000b,00000000b,\
  2044.                                     00000000b,00000000b,00000000b,00000000b,\
  2045.                                     00111101b,11101111b,01111011b,11000000b,\
  2046.                                     00100001b,00000001b,00000000b,00000000b,\
  2047.                                     00111101b,11100001b,01111011b,11000000b,\
  2048.                                     00000100b,00000001b,00000000b,01000000b,\
  2049.                                     00111101b,11100001b,01111011b,11000000b,\
  2050.                                     00000000b,00000000b,00000000b,00000000b
  2051.  
  2052. .snake_dots                 db      1,5, 0,5, 0,6
  2053. .snake_direction            dd      DOWN
  2054. .snake_direction_next       dd      DOWN
  2055. .number_of_stones           dd      115
  2056. .name                       dd      stage_26_name
  2057.  
  2058. stage_27:
  2059. .field                      db      00000000b,10000000b,00000000b,01000000b,\
  2060.                                     00000000b,10000000b,01000000b,11100000b,\
  2061.                                     00100011b,11100000b,01000000b,01000000b,\
  2062.                                     01110000b,10000001b,11110000b,00000000b,\
  2063.                                     00100000b,10000000b,01000000b,00000000b,\
  2064.                                     00000000b,00000000b,01000010b,00000000b,\
  2065.                                     00000000b,00000000b,00000000b,00000000b,\
  2066.                                     00000010b,00000000b,00000000b,00000000b,\
  2067.                                     00000111b,00000000b,00000000b,10000000b,\
  2068.                                     00000010b,00001000b,00000001b,11000000b,\
  2069.                                     00000000b,00000000b,10000000b,10000000b,\
  2070.                                     00000000b,01000001b,11000000b,00000000b,\
  2071.                                     01000000b,11100000b,10000000b,00000000b,\
  2072.                                     00000000b,01000000b,00000000b,00000000b
  2073.  
  2074. .snake_dots                 db      12,8, 12,7, 12,6
  2075. .snake_direction            dd      UP
  2076. .snake_direction_next       dd      UP
  2077. .number_of_stones           dd      51
  2078. .name                       dd      stage_27_name
  2079.  
  2080. stage_28:
  2081. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  2082.                                     00000000b,00000000b,00000000b,00000000b,\
  2083.                                     00000000b,00000000b,00000000b,00000000b,\
  2084.                                     00000000b,00000000b,00000000b,00000000b,\
  2085.                                     00000100b,00000000b,00000010b,00000000b,\
  2086.                                     00010100b,00000000b,00000010b,10000000b,\
  2087.                                     01010100b,00000000b,00000010b,10100000b,\
  2088.                                     01010101b,11111111b,11111010b,10100000b,\
  2089.                                     01010100b,00000000b,00000010b,10100000b,\
  2090.                                     00010100b,00000000b,00000010b,10000000b,\
  2091.                                     00000100b,00000000b,00000010b,00000000b,\
  2092.                                     00000000b,00000000b,00000000b,00000000b,\
  2093.                                     00000000b,00000000b,00000000b,00000000b,\
  2094.                                     00000000b,00000000b,00000000b,00000000b
  2095.  
  2096. .snake_dots                 db      13,8, 12,8, 11,8
  2097. .snake_direction            dd      LEFT
  2098. .snake_direction_next       dd      LEFT
  2099. .number_of_stones           dd      44
  2100. .name                       dd      stage_28_name
  2101.  
  2102. stage_29:
  2103. .field                      db      00000000b,01110000b,00000000b,00000000b,\
  2104.                                     00000100b,01000110b,00000001b,10000000b,\
  2105.                                     01001110b,00001100b,01100000b,11000000b,\
  2106.                                     01000000b,00000000b,01100000b,00000000b,\
  2107.                                     01100000b,01111000b,00000001b,10010000b,\
  2108.                                     00000000b,00000010b,10000101b,10110000b,\
  2109.                                     00110000b,00110010b,10001100b,00100000b,\
  2110.                                     00011011b,00110110b,10000100b,00000000b,\
  2111.                                     00000001b,00000000b,10010000b,10000000b,\
  2112.                                     00100001b,00000000b,00111000b,10000000b,\
  2113.                                     00111001b,00110011b,00000011b,10000000b,\
  2114.                                     01111111b,11111111b,00011011b,11010000b,\
  2115.                                     11111111b,11111111b,00011111b,11110000b,\
  2116.                                     11111111b,11111111b,00111111b,11110000b
  2117.  
  2118. .snake_dots                 db      0,0, 1,0, 2,0
  2119. .snake_direction            dd      RIGHT
  2120. .snake_direction_next       dd      RIGHT
  2121. .number_of_stones           dd      151
  2122. .name                       dd      stage_29_name
  2123.  
  2124. stage_30:
  2125. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  2126.                                     00000000b,00000001b,01011100b,00000000b,\
  2127.                                     00000000b,00000001b,11001000b,00000000b,\
  2128.                                     00000100b,00000001b,01001000b,00000000b,\
  2129.                                     00000100b,00000100b,00000000b,00000000b,\
  2130.                                     00000100b,00000100b,00000100b,00000000b,\
  2131.                                     00000100b,00000100b,00000100b,00000000b,\
  2132.                                     00000100b,00000100b,00000100b,00000000b,\
  2133.                                     01111111b,11000100b,11111111b,11100000b,\
  2134.                                     00000100b,00000100b,00000100b,00000000b,\
  2135.                                     00011111b,00111111b,10001110b,00000000b,\
  2136.                                     00000100b,00000100b,00000100b,00000000b,\
  2137.                                     00011111b,00011111b,00011111b,00000000b,\
  2138.                                     11111111b,11111111b,11111111b,11110000b
  2139.  
  2140. .snake_dots                 db      8,2, 9,2, 10,2
  2141. .snake_direction            dd      RIGHT
  2142. .snake_direction_next       dd      RIGHT
  2143. .number_of_stones           dd      109
  2144. .name                       dd      stage_30_name
  2145.  
  2146. stage_31:
  2147. .field                      db      00000101b,00010000b,00000100b,01000000b,\
  2148.                                     01000100b,01010101b,00010100b,01000000b,\
  2149.                                     01000101b,01010101b,01000101b,00010000b,\
  2150.                                     01010000b,00010100b,01000000b,01010000b,\
  2151.                                     00010101b,01000101b,01010100b,01000000b,\
  2152.                                     01000001b,00010000b,01010101b,01000000b,\
  2153.                                     01010101b,00010100b,00000101b,00010000b,\
  2154.                                     00000101b,01010000b,01000101b,01010000b,\
  2155.                                     01010000b,01000100b,00000000b,01010000b,\
  2156.                                     00010101b,00000101b,00010100b,00010000b,\
  2157.                                     01010001b,00010001b,01000001b,01000000b,\
  2158.                                     01000100b,00000101b,01010100b,01010000b,\
  2159.                                     00010001b,01010100b,00010001b,00010000b,\
  2160.                                     00000100b,01000001b,00010001b,00000000b
  2161.  
  2162. .snake_dots                 db      18,8, 17,8, 16,8
  2163. .snake_direction            dd      LEFT
  2164. .snake_direction_next       dd      LEFT
  2165. .number_of_stones           dd      112
  2166. .name                       dd      stage_31_name
  2167.  
  2168. stage_32:
  2169. .field                      db      11111111b,11111111b,11111111b,11110000b,\
  2170.                                     10010010b,01001001b,00100100b,10010000b,\
  2171.                                     10010000b,01000001b,00000100b,00010000b,\
  2172.                                     10010010b,01001001b,00100100b,10010000b,\
  2173.                                     10010010b,01001001b,00100100b,10010000b,\
  2174.                                     10010010b,01001001b,00100100b,10010000b,\
  2175.                                     10010010b,01001001b,00100100b,10010000b,\
  2176.                                     10010010b,01001001b,00100100b,10010000b,\
  2177.                                     10010010b,01001001b,00100100b,10010000b,\
  2178.                                     10010010b,01001001b,00100100b,10010000b,\
  2179.                                     10010010b,01001001b,00100100b,10010000b,\
  2180.                                     10000010b,00001000b,00100000b,10010000b,\
  2181.                                     10010010b,01001001b,00100100b,10010000b,\
  2182.                                     11111111b,11111111b,11111111b,11110000b
  2183.  
  2184. .snake_dots                 db      1,1, 1,2, 1,3
  2185. .snake_direction            dd      DOWN
  2186. .snake_direction_next       dd      DOWN
  2187. .number_of_stones           dd      168
  2188. .name                       dd      stage_32_name
  2189.  
  2190. stage_33:
  2191. .field                      db      00000000b,00000000b,00000000b,00000000b,\
  2192.                                     00000000b,00000000b,00000000b,00000000b,\
  2193.                                     01111111b,11001111b,11111111b,11100000b,\
  2194.                                     01000100b,01001000b,01000000b,00100000b,\
  2195.                                     01000100b,01001000b,01000001b,10100000b,\
  2196.                                     01000100b,01001000b,01001101b,10100000b,\
  2197.                                     00000000b,00000000b,00000110b,00000000b,\
  2198.                                     01000100b,01001000b,01000010b,00100000b,\
  2199.                                     01000100b,01001000b,01001111b,00100000b,\
  2200.                                     01000100b,01001000b,01001111b,00100000b,\
  2201.                                     01000100b,01001000b,01000110b,00100000b,\
  2202.                                     01111111b,11001111b,11111111b,11100000b,\
  2203.                                     00000000b,00000000b,00000000b,00000000b,\
  2204.                                     00000000b,00000000b,00000000b,00000000b
  2205.  
  2206. .snake_dots                 db      6,6, 7,6, 8,6
  2207. .snake_direction            dd      RIGHT
  2208. .snake_direction_next       dd      RIGHT
  2209. .number_of_stones           dd      109
  2210. .name                       dd      stage_33_name
  2211.  
  2212. stage_34:
  2213. .field                      db      01110000b,00000000b,00000011b,10000000b,\
  2214.                                     00010010b,00010000b,01111100b,00000000b,\
  2215.                                     00011110b,00010000b,00100100b,00000000b,\
  2216.                                     00000100b,00011001b,00100111b,00000000b,\
  2217.                                     00001111b,10001001b,00100000b,00110000b,\
  2218.                                     00000001b,00001011b,00101000b,00100000b,\
  2219.                                     00000001b,00011110b,01111000b,00100000b,\
  2220.                                     00111000b,00000010b,00001100b,10100000b,\
  2221.                                     00001110b,00100010b,00000000b,10100000b,\
  2222.                                     01100011b,11111110b,01000011b,11100000b,\
  2223.                                     00111110b,00100010b,01000000b,10000000b,\
  2224.                                     00000000b,01100011b,11000010b,10000000b,\
  2225.                                     00000000b,01000000b,01100111b,10000000b,\
  2226.                                     00000000b,00000000b,00000010b,00000000b
  2227.  
  2228. .snake_dots                 db      7,0, 8,0, 9,0
  2229. .snake_direction            dd      RIGHT
  2230. .snake_direction_next       dd      RIGHT
  2231. .number_of_stones           dd      113
  2232. .name                       dd      stage_34_name
  2233.  
  2234. stage_35:
  2235. .field                      db      00000100b,00000000b,00001010b,00000000b,\
  2236.                                     00010100b,01000000b,00101010b,00000000b,\
  2237.                                     00010100b,10000010b,00010010b,10000000b,\
  2238.                                     00010001b,00000000b,00010010b,10000000b,\
  2239.                                     00010001b,00000010b,00001010b,10000000b,\
  2240.                                     01010010b,00000010b,00001000b,10100000b,\
  2241.                                     01000100b,00000000b,00001000b,10100000b,\
  2242.                                     01000100b,00000010b,00000100b,10100000b,\
  2243.                                     01001000b,00000010b,00000100b,00100000b,\
  2244.                                     01001000b,00000000b,00000010b,00100000b,\
  2245.                                     00010000b,00000010b,00000010b,00100000b,\
  2246.                                     00110000b,00000010b,00000010b,00100000b,\
  2247.                                     00100000b,00000010b,00000001b,00000000b,\
  2248.                                     00000000b,00000000b,00000000b,00000000b
  2249.  
  2250. .snake_dots                 db      13,11, 13,10, 13,9
  2251. .snake_direction            dd      UP
  2252. .snake_direction_next       dd      UP
  2253. .number_of_stones           dd      66
  2254. .name                       dd      stage_35_name
  2255.  
  2256. stage_36:
  2257. .field                      db      10101110b,10001110b,00110100b,11100000b,\
  2258.                                     11101000b,10001110b,00101010b,10000000b,\
  2259.                                     10101110b,11101000b,00101010b,11100000b,\
  2260.                                     00000000b,00000000b,00000000b,00000000b,\
  2261.                                     00000000b,00000000b,00000000b,00000000b,\
  2262.                                     00000000b,10110010b,01000100b,00000000b,\
  2263.                                     00000001b,10100101b,01010100b,00000000b,\
  2264.                                     00000001b,10100101b,00101000b,00000000b,\
  2265.                                     00000000b,00000000b,00000000b,00000000b,\
  2266.                                     00010001b,11010101b,11010001b,11000000b,\
  2267.                                     00010001b,11010101b,11010001b,00000000b,\
  2268.                                     00010001b,00010101b,00010000b,10000000b,\
  2269.                                     00011101b,11001001b,11011100b,01000000b,\
  2270.                                     00000000b,00000000b,00000001b,11010000b
  2271.  
  2272. .snake_dots                 db      27,11, 27,10, 27,9
  2273. .snake_direction            dd      UP
  2274. .snake_direction_next       dd      UP
  2275. .number_of_stones           dd      112
  2276. .name                       dd      stage_36_name
  2277.  
  2278.  
  2279. stage_00_name               db      'Classic mode',0
  2280. stage_01_name               db      'Begin',0
  2281. stage_02_name               db      'Frame',0
  2282. stage_03_name               db      'Sight',0
  2283. stage_04_name               db      'Dashed',0
  2284. stage_05_name               db      'Beams',0
  2285. stage_06_name               db      'Pipe',0
  2286. stage_07_name               db      'Labyrinth',0
  2287. stage_08_name               db      'Sea battle',0
  2288. stage_09_name               db      'Recursion',0
  2289. stage_10_name               db      'Narrow corridors',0
  2290. stage_11_name               db      'CCC',0
  2291. stage_12_name               db      'Deadlocks',0
  2292. stage_13_name               db      'Boat',0
  2293. stage_14_name               db      'Pattern',0
  2294. stage_15_name               db      'Guernica',0
  2295. stage_16_name               db      'Goto',0
  2296. stage_17_name               db      'Smiling face',0
  2297. stage_18_name               db      'Waves',0
  2298. stage_19_name               db      'First snow',0
  2299. stage_20_name               db      'Music and silence',0
  2300. stage_21_name               db      'Experiment',0
  2301. stage_22_name               db      'Pacman',0
  2302. stage_23_name               db      'Intricate pattern',0
  2303. stage_24_name               db      'Square arcs',0
  2304. stage_25_name               db      'In the animal world',0
  2305. stage_26_name               db      'Digits',0
  2306. stage_27_name               db      'Pluses',0
  2307. stage_28_name               db      'Rod',0
  2308. stage_29_name               db      'Tetris',0
  2309. stage_30_name               db      'Towers of Hanoi',0
  2310. stage_31_name               db      'Ruins',0
  2311. stage_32_name               db      'Walls of Akendora',0
  2312. stage_33_name               db      'Geranium in the window',0
  2313. stage_34_name               db      'Algae',0
  2314. stage_35_name               db      'The road ahead',0
  2315. stage_36_name               db      'Help me draw levels!',0
  2316.  
  2317.  
  2318. background_color            dd      0x000000
  2319. decorations_color           dd      0x00000000
  2320. snake_color                 dd      0x000000
  2321. snake_head_color            dd      0x000000
  2322. lives_in_head_number_color  dd      0x000000
  2323. snake_picture_color         dd      0x000000
  2324. version_picture_color       dd      0x000000
  2325. pause_picture_color         dd      0x000000
  2326. game_over_picture_color     dd      0x000000
  2327. you_win_picture_color       dd      0x000000
  2328. eat_color                   dd      0x000000
  2329. navigation_strings_color    dd      0x80000000
  2330. game_over_strings_color     dd      0x80000000
  2331. score_string_color          dd      0x80000000
  2332. hiscore_string_color        dd      0x80000000
  2333. champion_string_color       dd      0x80000000
  2334. game_over_hiscore_color     dd      0x80000000
  2335. score_number_color          dd      0x40000000
  2336. hiscore_number_color        dd      0x00000000
  2337. champion_name_color         dd      0x80000000
  2338. button_color                dd      0x000000
  2339. button_text_color           dd      0x80000000
  2340. stone_color                 dd      0x000000
  2341. splash_background_color     dd      0x000000
  2342. splash_level_string_color   dd      0x000000
  2343. splash_level_number_color   dd      0x000000
  2344. level_string_color          dd      0x80000000
  2345. level_number_color          dd      0x00000000
  2346.  
  2347.  
  2348. align 4
  2349. @IMPORT:
  2350.  
  2351. library \
  2352.         libini      ,   'libini.obj'        ,\
  2353.         box_lib     ,   'box_lib.obj'
  2354.  
  2355. import  libini,\
  2356.     ini.get_str     ,   'ini_get_str'       ,\
  2357.     ini.get_int     ,   'ini_get_int'       ,\
  2358.     ini.set_str     ,   'ini_set_str'       ,\
  2359.     ini.set_int     ,   'ini_set_int'       ,\
  2360.     ini.get_color   ,   'ini_get_color'     ,\
  2361.     ini.get_shortcut,   'ini_get_shortcut'
  2362.  
  2363. import  box_lib,\
  2364.     edit_box.draw   ,   'edit_box'          ,\
  2365.     edit_box.key    ,   'edit_box_key'      ,\
  2366.     edit_box.mouse  ,   'edit_box_mouse'
  2367.  
  2368. bFirstDraw  db  0
  2369.  
  2370. aPreferences                db      'Preferences',0
  2371. aSpeed                      db      'Speed',0
  2372. aTheme                      db      'Theme',0
  2373. aSmart_reverse              db      'Smart_reverse',0
  2374. aShow_lives_style           db      'Show_lives_style',0
  2375. aDraw_level_name_in_window_title db 'Draw_level_name_in_window_title',0
  2376. aSeparating_symbol          db      'Separating_symbol',0
  2377.  
  2378. aShortcuts                  db      'Shortcuts',0
  2379. aMove_left                  db      'Move_left',0
  2380. aMove_down                  db      'Move_down',0
  2381. aMove_up                    db      'Move_up',0
  2382. aMove_right                 db      'Move_right',0
  2383. aReverse                    db      'Reverse',0
  2384. aIncrease                   db      'Increase',0
  2385. aDecrease                   db      'Decrease',0
  2386.  
  2387. aTheme_name                 db      32  dup (0)
  2388. aDecorations                db      'Decorations',0
  2389. aBackground_color           db      'Background_color',0
  2390. aDecorations_color          db      'Decorations_color',0
  2391. aSnake_color                db      'Snake_color',0
  2392. aSnake_head_color           db      'Snake_head_color',0
  2393. aLives_in_head_number_color db      'Lives_in_head_number_color',0
  2394. aSnake_picture_color        db      'Snake_picture_color',0
  2395. aVersion_picture_color      db      'Version_picture_color',0
  2396. aPause_picture_color        db      'Pause_picture_color',0
  2397. aGame_over_picture_color    db      'Game_over_picture_color',0
  2398. aYou_win_picture_color      db      'You_win_picture_color',0
  2399. aEat_color                  db      'Eat_color',0
  2400. aNavigation_strings_color   db      'Navigation_string_color',0
  2401. aGame_over_strings_color    db      'Game_over_string_color',0
  2402. aScore_string_color         db      'Score_string_color',0
  2403. aHiscore_string_color       db      'Hiscore_string_color',0
  2404. aChampion_string_color      db      'Champion_string_color',0
  2405. aGame_over_hiscore_color    db      'Game_over_hiscore_color',0
  2406. aScore_number_color         db      'Score_number_color',0
  2407. aHiscore_number_color       db      'Hiscore_number_color',0
  2408. aChampion_name_color        db      'Champion_name_color',0
  2409. aEdit_box_selection_color   db      'Edit_box_selection_color',0
  2410. aButton_color               db      'Button_color',0
  2411. aButton_text_color          db      'Button_text_color',0
  2412. aStone_color                db      'Stone_color',0
  2413. aSplash_background_color    db      'Splash_background_color',0
  2414. aSplash_level_string_color  db      'Splash_level_string_color',0
  2415. aSplash_level_number_color  db      'Splash_level_number_color',0
  2416. aLevel_string_color         db      'Level_string_color',0
  2417. aLevel_number_color         db      'Level_number_color',0
  2418.  
  2419. aReserved                   db      'Reserved',0
  2420. aSquare_side_length         db      'Square_side_length',0
  2421. aHiscore_classic            db      'Hiscore_classic',0
  2422. aChampion_name_classic      db      'Champion_name_classic',0
  2423. aHiscore_levels             db      'Hiscore_levels',0
  2424. aChampion_name_levels       db      'Champion_name_levels',0
  2425.  
  2426. 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
  2427.  
  2428. hed                         db      '',0
  2429. ;;---Variables-------------------------------------------------------------------------------------------------------------
  2430. i_end:
  2431. hed_end:
  2432. rb  256
  2433. mouse_dd                    rd      1
  2434.  
  2435. window_style                rd      1
  2436.  
  2437. cur_level                   rd      1
  2438. cur_level_number            rd      1
  2439. hi_level                    rd      1
  2440.  
  2441. score                       rd      1
  2442. hi_score_classic            rd      1
  2443. hi_score_levels             rd      1
  2444.  
  2445. champion_name_classic       rb      CHAMPION_NAME_LENGTH
  2446. champion_name_levels        rb      CHAMPION_NAME_LENGTH
  2447.  
  2448. snake_dots                  rb      GRID_WIDTH*GRID_HEIGHT*2+3          ; +3 bytes for faster dword copying
  2449. snake_direction             rd      1
  2450. snake_direction_next        rd      1
  2451. snake_length_x2             rd      1
  2452.  
  2453. decorations                 rd      1
  2454. number_of_free_dots         rd      1
  2455.  
  2456. eat                         rw      1
  2457.  
  2458. g_s                         rd      1
  2459. g_e                         rd      1
  2460.  
  2461. window_width                rd      1
  2462. window_height               rd      1
  2463. wp_x                        rd      1
  2464. wp_y                        rd      1
  2465.  
  2466. gw_mul_gs                   rd      1
  2467. gh_mul_gs                   rd      1
  2468. gbxm1_plus_gw_mul_gs        rd      1
  2469. gbym1_plus_gh_mul_gs        rd      1
  2470. gs_shl16_gs                 rd      1
  2471. gbxm1_shl16_gbxm1           rd      1
  2472. gbym1_shl16_gbym1           rd      1
  2473.  
  2474. bottom_top_strings          rd      1
  2475. bottom_middle_strings       rd      1
  2476. bottom_bottom_strings       rd      1
  2477. top_strings                 rd      1
  2478.  
  2479. button_x_left               rd      1
  2480. button_x_right              rd      1
  2481. button_y_top                rd      1
  2482. button_y_middle             rd      1
  2483. button_y_bottom             rd      1
  2484. button_width_short          rd      1
  2485. button_width_long           rd      1
  2486. button_height               rd      1
  2487.  
  2488. cursor_data                 rb      32*32*4
  2489. cursor_handle               rd      1
  2490.  
  2491. cur_dir_path                rb      4096
  2492. @PARAMS                     rb      4096
  2493.  
  2494. field_map                   rb      GRID_WIDTH*GRID_HEIGHT*2
  2495.  
  2496. proc_info                   process_information
  2497.  
  2498. smart_reverse               rd      1
  2499. show_lives_style            rd      1
  2500. draw_level_name_in_window_title rd  1
  2501. separating_symbol           rd      1
  2502.  
  2503. shortcut_move_left          rb      1
  2504. shortcut_move_down          rb      1
  2505. shortcut_move_up            rb      1
  2506. shortcut_move_right         rb      1
  2507. shortcut_reverse            rb      1
  2508. shortcut_increase           rb      1
  2509. shortcut_decrease           rb      1
  2510.  
  2511. square_side_length          rd      1
  2512.  
  2513. gbxm1                       rd      1
  2514. gbym1                       rd      1
  2515. speed_up_counter            rw      1
  2516.  
  2517. rb 4096
  2518. stacktop:
  2519. d_end:
  2520.