Subversion Repositories Kolibri OS

Rev

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

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