Subversion Repositories Kolibri OS

Rev

Rev 7458 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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