Subversion Repositories Kolibri OS

Rev

Rev 2066 | Rev 7458 | 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.     label 100,240,'press SPACE to start a new game',0x10FF0800
  420.     label 15,240,'F1 + delay',0xFFA8FF
  421.     label 15,260,'F2 + delay',0xFFA8FF
  422.     delay 10
  423. ret
  424.  
  425. ;___________________
  426. level_info:
  427.     cmp  [is_rolled_up], 1
  428.     jne  @f
  429.     ret
  430.   @@:
  431.     label 170,230,'L E V E L',0x100000FF
  432.     outcount [level],195,250,0x100000FF,2*65536
  433.     label 100,270,'press SPACE to start the level',0x10FF0800
  434.     delay 10
  435. ret
  436.  
  437. ;_________________________
  438. game_over:  ; GAME OVER  ;
  439.     mov  eax,0x00FF00
  440.     mov  ebx,0xFF01
  441.     .g_ok:
  442.     call grad_fill_screen
  443.     call show_screen  ; flips the screen
  444.     label 120,150,'G  A  M  E    O  V  E  R',0x10050505
  445.     label 140,200,'Thanks for playing',0x0FFF800
  446.     delay 20
  447. ret
  448.  
  449.  
  450. ;-----------------------------;
  451. ; THE MAIN THE GAME'S ENGINE ;
  452. ;-----------------------------;
  453. fast_gfx:
  454.     ; the background gradient
  455.     if_e  dword [level],0,.no_0
  456.       mov  eax,0xFF
  457.       mov  ebx,0xFEFF
  458.       jmp .g_ok
  459.     .no_0:
  460.     if_e  dword [level],1,.no_1
  461.       mov  eax,BACK_CL
  462.       mov  ebx,0xFFFF
  463.       jmp .g_ok
  464.     .no_1:
  465.     if_e  dword [level],2,.no_2
  466.       mov  eax,0xFF0000
  467.       mov  ebx,0xFF00FF
  468.       jmp .g_ok
  469.     .no_2:
  470.  
  471.     mov  eax,BACK_CL
  472.     mov  ebx,0xFFFF
  473.     .g_ok:
  474.     call grad_fill_screen
  475.  
  476.     mov  eax,37  ; get mouse position
  477.     mov  ebx,1
  478.     mcall
  479.     shr  eax,16
  480.     mov  [x],eax
  481.     add  eax,[s_x]
  482.     cmp  eax,X_SIZE  ; controls if the pad is in the screen
  483.     jb   .ok
  484.       cmp eax,0x7FFF ; if < 0
  485.       jb  .upper
  486.         mov [x],0
  487.         jmp .ok
  488.       .upper:        ; if > X_SIZE - pad size
  489.       mov dword [x],X_SIZE-1
  490.       mov eax,[s_x]
  491.       sub dword [x],eax
  492.     .ok:
  493.     mov  ebx,[x]
  494.     mov  eax,[y]
  495.     mov  ecx,[s_x]
  496.     mov  edx,15
  497.     mov  esi,0xFF0000
  498.     mov  edi,0xF0000F
  499.     call grad_rect_screen
  500.  
  501.     call draw_level
  502.  
  503.     cmp dword [mode],1
  504.     jne .no_go ; is the game started ?
  505.       mov eax,[v_x]
  506.       add dword [b_x],eax
  507.       mov eax,[v_y]
  508.       add dword [b_y],eax
  509.       jmp .go
  510.     .no_go:
  511.       mov eax,[x] ; b_x = x + x_s/2
  512.       mov ebx,[s_x]
  513.       shr ebx,1
  514.       add eax,ebx
  515.       mov dword [b_x],eax
  516.       mov eax,[y] ; b_y = y - 10
  517.       sub eax,10
  518.       mov dword [b_y],eax
  519.  
  520.       mov dword [v_x],1
  521.       mov dword [v_y],-1
  522.     .go:
  523.     ;TEST WHERE IS THE BALL:
  524.     cmp dword [b_x],0x7FFFFFFF
  525.     jb .b_ok2 ; if out of the screen (left)
  526.       mov dword [b_x],0
  527.       mov eax,0
  528.       sub eax,[v_x]
  529.       mov [v_x],eax
  530.     .b_ok2:
  531.     cmp dword [b_x],X_SIZE-10
  532.     jb .b_ok1 ; if out of the screen (right)
  533.       mov dword [b_x],X_SIZE-11
  534.       mov eax,0
  535.       sub eax,[v_x]
  536.       mov [v_x],eax
  537.     .b_ok1:
  538.     cmp dword [b_y],0x7FFFFFFF
  539.     jb .b_ok3 ; if out of the screen (up)
  540.       mov dword [b_y],0
  541.       mov eax,0
  542.       sub eax,[v_y]
  543.       mov [v_y],eax
  544.     .b_ok3:
  545.     cmp dword [b_y],Y_SIZE-10
  546.     jb .b_ok4 ; if out of the screen (down)
  547.       mov dword [mode],0
  548.       if_e dword [lives],0,.end_if5
  549.          mov dword [mode],4 ; GAME OVER
  550.          jmp still
  551.       .end_if5:
  552.          dec dword [lives]
  553.       .end_else4:
  554.       call draw_window
  555.     .b_ok4:
  556.  
  557.     imgtoimg img_ball,dword [b_x],dword [b_y],screen_img
  558.  
  559.     call show_screen  ; flips the screen
  560.     delay dword [del]
  561.  
  562.     call do_tests ; does all needed tests
  563. ret
  564. ;----------------------;
  565. ; BALL & BRICKS EVENTS ;
  566. ;----------------------;
  567. MAX_SPEED equ 3
  568. do_tests:
  569.     ; BALL <-> PAD
  570.     mov eax,[b_x]
  571.     add eax,10
  572.     cmp eax,[x] ; if (b_x+10)>[pad x]
  573.     jb .skip        ; &&
  574.     mov eax,[b_x]
  575.     mov ebx,[s_x]
  576.     add ebx,[x]
  577.     cmp eax,ebx ; if b_x < x + s_x
  578.     ja .skip     ; &&
  579.     mov eax,[b_y]
  580.     add eax,10
  581.     cmp eax,[y] ; if (b_y+10) > y
  582.     jb .skip
  583.     sub eax,15
  584.     cmp eax,[y] ; if b_y < y+15
  585.     ja .skip
  586.       cmp dword [v_y],0x7FFFFF ; if v_y > 0
  587.       ja .skip
  588.       cmp dword [v_y],MAX_SPEED; speedup:
  589.       ja .skip_s
  590.         inc dword [speed_t]
  591.         cmp dword [speed_t],5
  592.         jb .skip_s
  593.         inc dword [v_y]
  594.         mov dword [speed_t],0
  595.       .skip_s:
  596.       inc dword [speed_t]
  597.       mov eax,0
  598.       sub eax,[v_y]
  599.       mov [v_y],eax
  600.       ;counting v_x:--------
  601.       mov eax,[b_x]
  602.       sub eax,[x]
  603.       sub eax,5
  604.       mov ecx,eax
  605.       if_a eax,100,.end_if3
  606.         mov eax,0
  607.         sub eax,[v_x]
  608.         mov [v_x],eax
  609.         jmp .skip
  610.       .end_if3:
  611.       if_a eax,20,.end_if2
  612.         sub eax,20
  613.         shr eax,2
  614.         mov [v_x],eax
  615.         jmp .skip
  616.       .end_if2:
  617.         mov ebx,20
  618.         sub ebx,ecx
  619.         shr ebx,2
  620.         mov dword [v_x],0
  621.         sub dword [v_x],ebx
  622.     .skip:
  623.  
  624.     ; BALL <-> BRICK
  625.     mov dword [coliz],0
  626.     call colision
  627.     if_e dword [coliz],1,.end_if6
  628.        ;abs dword [v_y]
  629.        ;abs dword [v_x]
  630.        ret
  631.     .end_if6:
  632.     add dword [b_x],10
  633.     call colision
  634.     sub dword [b_x],10
  635.     if_e dword [coliz],1,.end_if7
  636.        ;abs dword [v_y]
  637.        ;abs dword [v_x]
  638.        ch_sign dword [v_x]
  639.        ret
  640.     .end_if7:
  641.     add dword [b_y],10
  642.     call colision
  643.     sub dword [b_y],10
  644.     if_e dword [coliz],1,.end_if8
  645.        ;abs dword [v_y]
  646.        ;abs dword [v_x]
  647.        ;ch_sign dword [v_y]
  648.        ret
  649.     .end_if8:
  650.     add dword [b_x],10
  651.     add dword [b_y],10
  652.     call colision
  653.     sub dword [b_x],10
  654.     sub dword [b_y],10
  655.     if_e dword [coliz],1,.end_if9
  656.        ;abs dword [v_y]
  657.        ;abs dword [v_x]
  658.        ;ch_sign dword [v_x]
  659.        ;ch_sign dword [v_y]
  660.  
  661.        ret
  662.     .end_if9:
  663.  
  664.  
  665. ret
  666.  
  667. colision:
  668.  
  669.     mov  esi,levels
  670.     mov  eax,[level] ; eax = levels*100
  671.     mov  bx,100
  672.     mul  bx
  673.     add  esi,eax
  674.     ;--------------
  675.     xor  edx,edx
  676.     mov  eax,[b_x]
  677.     mov  ebx,40
  678.     div  ebx
  679.     mov  ecx,eax
  680.     push edx ;#>1
  681.  
  682.     xor edx,edx
  683.     mov  eax,[b_y]
  684.     mov  ebx,20
  685.     div  ebx
  686.     push edx ;#>2
  687.     cmp  eax,9 ; out of the bricks board
  688.     ja .ok2
  689.     mov  ebx,10
  690.     mul  ebx
  691.     add  eax,ecx
  692.     add  esi,eax
  693.  
  694.     cmp byte [esi],0 ; 0 - no brick
  695.     je .ok2
  696.       if_ne byte [esi],4,.end_if1
  697.         dec byte [esi]
  698.       .end_if1:
  699.       mov dword [coliz],1
  700.       pop ebx ;#<2
  701.       pop eax ;#<1
  702.       cmp ecx,8 ; x < 5 || x >35 - x inv
  703.       jb  .inv
  704.       cmp ecx,33
  705.       ja  .inv
  706.       jmp .no_inv
  707.       .inv:
  708.         mov eax,0
  709.         sub eax,[v_x]
  710.         mov [v_x],eax
  711.         ;jmp .no_ok
  712.       .no_inv:
  713.       cmp ebx,6 ; if y < 5 || y>15 - y inv
  714.       jb .inv_y
  715.       cmp ebx,14
  716.       ja .inv_y
  717.       jmp .no_ok
  718.         .inv_y:
  719.         mov eax,0
  720.         sub eax,[v_y]
  721.         mov [v_y],eax
  722.       .no_ok:
  723.       jmp .ok
  724.     .ok2:
  725.       pop eax ;#<1
  726.       pop eax ;#<2
  727.     .ok:
  728.  
  729.  
  730. ret
  731.  
  732. ;-----------------------------------;
  733. ; DRAWS CURRENT LEVEL ON THE SCREEN ;
  734. ;-----------------------------------;
  735. draw_level:
  736.     mov  esi,levels
  737.     mov  eax,[level] ; eax = levels*100
  738.     mov  bx,100
  739.     mul  bx
  740.     add  esi,eax
  741.     mov  ecx,10
  742.     mov  eax,0
  743.     mov dword [l_end],1
  744.     .l_y:
  745.       push ecx ;#>1
  746.       mov ebx,0
  747.       mov ecx,10
  748.       .l_x:
  749.         cmp byte [esi],1 ; if 1 ?
  750.         push esi;#>2
  751.         jne .no_1
  752.           mov  esi,img_brick1
  753.           call put_bmp_screen
  754.           mov dword [l_end],0
  755.         .no_1:
  756.         cmp byte [esi],2 ; if 2 ?
  757.         jne .no_2
  758.           mov  esi,img_brick2
  759.           call put_bmp_screen
  760.           mov dword [l_end],0
  761.         .no_2:
  762.         cmp byte [esi],3 ; if 3 ?
  763.         jne .no_3
  764.           mov  esi,img_brick3
  765.           call put_bmp_screen
  766.           mov dword [l_end],0
  767.         .no_3:
  768.         cmp byte [esi],4 ; if 4 ?
  769.         jne .no_4
  770.           mov  esi,img_brick4
  771.           call put_bmp_screen
  772.         .no_4:
  773.  
  774.         add ebx,40
  775.         pop esi ;#<2
  776.         inc esi
  777.       loop .l_x
  778.       add eax,20 ;#<1
  779.       pop  ecx
  780.     loop .l_y
  781. ;----------------
  782. ; NEXT LEVEL
  783.     if_e dword [l_end],1,.end_if ; all bricks are taken
  784.     if_e dword [mode],1,.end_if
  785.         add dword [level],1
  786.         if_a dword [level],MAX_LEVEL,.end_if2
  787.            mov dword [mode],4 ; game over
  788.            jmp still
  789.         .end_if2:
  790.         call fast_gfx
  791.         mov dword [mode],2
  792.     .end_if:
  793. ret
  794.  
  795. ;   *********************************************
  796. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  797. ;   *********************************************
  798.  
  799.  
  800. draw_window:
  801.  
  802.     mcall 12,1
  803.     mcall 0,<100,X_SIZE+8>,<100,Y_SIZE+21>,0x14ffffff, , VERSION
  804.  
  805.        
  806.         label 200,8,'LIVES:',0x10ffffff
  807.     outcount dword [lives],250,8,0x10ffffff,65536
  808.  
  809.     cmp [is_rolled_up], 1
  810.     je  @f
  811.     call fast_gfx
  812.   @@:
  813.  
  814.     mcall 12,2
  815.  
  816.     ret
  817.  
  818. ;-----------;####################
  819. ; DATA AREA ;####################
  820. ;-----------;####################
  821.  
  822. VERSION db 'ARCANOID II', 0
  823.  
  824. is_rolled_up dd 0
  825.  
  826.  lives dd 5
  827.  mode dd 0
  828.  l_end dd 0 ; if 1 the level is over
  829. ; PAD x:
  830.  x   dd 20
  831.  y   dd Y_SIZE-20
  832. ; PAD length:
  833.  s_x dd 40
  834.  
  835. ; the ball stuff ;-)
  836.  b_x dd 100
  837.  b_y dd 250
  838.  v_y dd 0
  839.  v_x dd 3
  840.  
  841.  speed_t dd 0 ; 1/10 times speedup
  842.  del dd 1 ; delay
  843.  
  844.  coliz dd 0 ; if 1 then colizion with a brick
  845.  
  846. ; LEVELS:
  847. level dd 0
  848. levels:
  849. ;LEVEL 0:
  850. db 0,0,0,0,0,0,0,0,0,0
  851. db 0,4,0,0,4,4,0,0,0,4
  852. db 4,0,4,0,4,0,4,0,4,0
  853. db 4,0,4,0,4,0,4,0,4,0
  854. db 4,4,4,0,4,4,0,0,4,0
  855. db 4,0,4,0,4,0,4,0,4,0
  856. db 4,0,4,0,4,0,4,0,0,4
  857. db 0,0,0,0,0,0,0,0,0,0
  858. db 0,0,0,0,0,0,0,0,0,0
  859. db 0,0,0,0,0,0,0,0,0,0
  860.  
  861. ;LEVEL 1:
  862. db 1,1,1,1,1,1,1,1,1,1
  863. db 0,3,0,0,3,3,0,0,0,3
  864. db 3,0,3,0,3,0,3,0,3,0
  865. db 3,0,3,0,3,0,3,0,3,0
  866. db 3,3,3,0,3,3,0,0,3,0
  867. db 3,0,3,0,3,0,3,0,3,0
  868. db 3,0,3,0,3,0,3,0,0,3
  869. db 2,2,2,2,2,2,2,2,2,2
  870. db 1,1,1,1,1,1,1,1,1,1
  871. db 1,1,1,1,1,1,1,1,1,1
  872. ;LEVEL 2:
  873. db 3,3,3,3,0,0,3,3,3,3
  874. db 3,1,1,1,0,0,1,1,1,3
  875. db 3,1,2,1,3,3,1,2,1,3
  876. db 0,1,0,1,3,3,1,0,1,0
  877. db 2,1,2,1,1,1,1,2,1,2
  878. db 0,1,0,1,2,2,1,0,1,0
  879. db 2,1,2,1,1,1,1,2,1,2
  880. db 0,1,0,1,1,1,1,0,1,0
  881. db 0,0,0,1,0,0,1,0,0,0
  882. db 0,0,0,1,0,0,1,0,0,0
  883. ;LEVEL 3:
  884. db 1,2,3,1,2,3,1,3,2,1
  885. db 2,3,1,2,3,1,3,3,1,2
  886. db 3,1,2,3,1,2,3,1,2,3
  887. db 1,2,3,1,2,3,1,3,2,1
  888. db 2,3,1,2,3,1,3,3,1,2
  889. db 3,1,2,3,1,2,3,1,2,3
  890. db 1,2,1,2,1,2,1,2,1,2
  891. db 1,0,1,0,1,0,1,0,1,0
  892. db 0,0,3,0,0,0,0,3,0,0
  893. db 0,0,3,0,0,0,0,3,0,0
  894. ;LEVEL 4:
  895. db 0,0,0,1,1,1,1,0,0,0
  896. db 0,0,1,2,2,2,2,1,0,0
  897. db 1,1,1,2,2,2,2,1,1,1
  898. db 1,0,1,0,2,2,0,1,0,1
  899. db 0,1,1,2,2,2,2,1,1,0
  900. db 0,0,1,2,2,2,2,1,0,0
  901. db 0,0,1,2,2,2,2,1,0,0
  902. db 0,0,1,2,3,3,2,1,0,0
  903. db 0,0,1,2,2,2,2,1,0,0
  904. db 0,0,0,1,1,1,1,0,0,0
  905. ;LEVEL 5:
  906. db 1,1,1,1,1,1,1,1,1,1
  907. db 1,2,0,0,3,2,0,0,2,1
  908. db 1,2,0,0,2,3,0,0,2,1
  909. db 2,2,0,0,3,2,0,0,2,2
  910. db 0,0,0,0,2,3,0,0,0,0
  911. db 0,0,0,1,1,1,1,0,0,0
  912. db 0,0,1,1,0,0,1,1,0,0
  913. db 0,0,1,1,0,0,1,1,0,0
  914. db 2,1,2,1,2,1,2,1,2,1
  915. db 1,2,1,2,1,2,1,2,1,2
  916.  
  917.  
  918. ; BITMAPs and IMAGEs
  919. bmp_file:
  920.     file 'arcanii.bmp'
  921.  
  922. img_bmp:
  923.     rb 40*90*3+8
  924. img_brick1:
  925.     rb 40*20*3+8
  926. img_brick2:
  927.     rb 40*20*3+8
  928. img_brick3:
  929.     rb 40*20*3+8
  930. img_brick4:
  931.     rb 40*20*3+8
  932. img_ball:
  933.     rb 10*10*3+8
  934. img_bonus:
  935.     rb 20*10*3+8
  936.  
  937.  
  938. screen_img:
  939.     dd X_SIZE
  940.     dd Y_SIZE
  941. screen:
  942.     rb X_SIZE*Y_SIZE*3
  943. proc_info:
  944.     rb 1024
  945. I_END:
  946.  
  947.