Subversion Repositories Kolibri OS

Rev

Rev 950 | Blame | Last modification | View Log | Download | RSS feed

  1.     use32
  2.     org    0x0
  3.     db     'MENUET01'                                             ; 8 byte id
  4.     dd     0x01                                                   ; header version
  5.     dd     START                                                  ; start of code
  6.     dd     IM_END                                                 ; size of image
  7.     dd     I_END+1000                                                  ; memory for app
  8.     dd     I_END+1000                                                  ; esp
  9.     dd     0x0 , 0x0                                              ; I_Param , I_Icon
  10.  
  11.  
  12. KEY_RIGHT equ 179
  13. KEY_LEFT equ 176
  14. KEY_UP equ 178
  15. KEY_P equ 'p'
  16. KEY_DOWN equ 177
  17. KEY_ENTER equ 13
  18. KEY_ESC equ 27
  19.  
  20. START:
  21.    mov  [drawroutine], draw_picture_kolibri
  22.    call draw_window
  23.    jmp  decodegif
  24.  
  25. draw_picture_kolibri:
  26.  
  27.     mov  eax,7                                                    ; Draw buffer to screen
  28.     mov  ebx,vscreen+8
  29.     mov  ecx,SCREEN_X*65536+SCREEN_Y
  30.     mov  edx,SCREEN_X_POS*65536+SCREEN_Y_POS
  31.     int  0x40
  32.  
  33. ret
  34.  
  35. waitandgetkey:
  36.  
  37.     mov  eax, 5
  38.     mov  ebx, 1
  39.     int  0x40
  40.  
  41.     mov  eax, 11                                                   ; check for event (no wait)
  42.     int  0x40
  43.  
  44.     cmp  eax,1                                                    ; redraw request ?
  45.     je   red
  46.     cmp  eax,2                                                    ; key in buffer ?
  47.     je   key
  48.     cmp  eax,3                                                    ; button in buffer ?
  49.     je   button
  50.  
  51.     xor  ax,ax
  52.  
  53.     ret
  54.  
  55.   red:                                                            ; redraw
  56.     call draw_window
  57.  
  58.     jmp  waitandgetkey
  59.  
  60.   key:                                                            ; key
  61.     mov  eax,2                                                    ; read it
  62.     int  0x40
  63.  
  64.     mov  al, ah
  65.  
  66.     ret
  67.  
  68.   button:                                                         ; button
  69.     mov  eax,17                                                   ; get id
  70.     int  0x40
  71.  
  72.     cmp  ah,1                                                     ; button id=1 ?
  73.     jne  noclose
  74.  
  75.   exit:
  76.     mov  eax,-1                                                   ; close this program
  77.     int  0x40
  78.   noclose:
  79.  
  80.     jmp  waitandgetkey
  81.  
  82.  
  83. draw_window:
  84.     mov  eax,12                                                   ; function 12:tell os about windowdraw
  85.     mov  ebx,1                                                    ; 1, start of draw
  86.     int  0x40
  87.                                                                   ; DRAW WINDOW
  88.     mov  eax,0                                                    ; function 0 : define and draw window
  89.     mov  ebx,WINDOW_X*65536+10+SCREEN_X                           ; [x start] *65536 + [x size]
  90.     mov  ecx,WINDOW_Y*65536+30+SCREEN_Y                           ; [y start] *65536 + [y size]
  91.     mov  edx,0x04000000                                           ; color of work area RRGGBB,8->color gl
  92.     mov  esi,0x805080d0                                           ; color of grab bar  RRGGBB,8->color gl
  93.     mov  edi,0x005080d0                                           ; color of frames    RRGGBB
  94.     int  0x40
  95.  
  96.     mov  eax,71
  97.     mov  ebx,1
  98.     mov  ecx,header
  99.     int  0x40
  100.  
  101.     call [drawroutine]
  102.  
  103.     mov  eax,12                                                   ; function 12:tell os about windowdraw
  104.     mov  ebx,2                                                    ; 2, end of draw
  105.     int  0x40
  106.  
  107. ret
  108.  
  109. load_highscores:
  110. ret
  111.  
  112. save_highscores:
  113. ret
  114.  
  115. header          db 'Invaders',0