Subversion Repositories Kolibri OS

Rev

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