Subversion Repositories Kolibri OS

Rev

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