Subversion Repositories Kolibri OS

Rev

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