Subversion Repositories Kolibri OS

Rev

Rev 1829 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;    PROTECTION TEST
  3. ;
  4.  
  5. use32
  6.  
  7.                org    0x0
  8.  
  9.                db     'MENUET01'              ; 8 byte id
  10.                dd     0x01                    ; header version
  11.                dd     START                   ; start of code
  12.                dd     I_END                   ; size of image
  13.                dd     0x10000                 ; memory for app
  14.                dd     0xfff0                  ; esp
  15.                dd     0x0 , 0x0               ; I_Param , I_Icon
  16.  
  17. include '../../../macros.inc'
  18.  
  19. START:                          ; start of execution
  20.  
  21.     call draw_window            ; at first, draw the window
  22.  
  23. still:
  24.  
  25.     mcall 10                 ; wait here for event
  26.  
  27.     cmp  eax,1                  ; redraw request ?
  28.     jz   red
  29.     cmp  eax,2                  ; key in buffer ?
  30.     jz   key
  31.     cmp  eax,3                  ; button in buffer ?
  32.     jz   button
  33.  
  34.     jmp  still
  35.  
  36.   red:                          ; redraw
  37.     call draw_window
  38.  
  39.     jmp  still
  40.  
  41.   key:                          ; key
  42.     mov  eax,2                  ; just read it and ignore
  43.     int  0x40
  44.  
  45.     jmp  still
  46.  
  47.   button:                       ; button
  48.     mov  eax,17
  49.     int  0x40
  50.  
  51.     cmp  ah,1                   ; button id=1 ?
  52.     jnz  noclose
  53.     mov  eax,-1         ; close this program
  54.     int  0x40
  55.   noclose:
  56.  
  57.     cmp  ah,2
  58.     jnz  notest2
  59.     cli
  60.   notest2:
  61.  
  62.     cmp  ah,3
  63.     jnz  notest3
  64.     sti
  65.   notest3:
  66.  
  67.     cmp  ah,4
  68.     jnz  notest4
  69.      mov  [0x10000],byte 1
  70.    notest4:
  71.  
  72.     cmp  ah,5
  73.     jnz  notest5
  74.     jmp  dword 0x10000
  75.   notest5:
  76.  
  77.     cmp  ah,6
  78.     jnz  notest6
  79.     mov  esp,0
  80.     push eax
  81.   notest6:
  82.  
  83.     cmp  ah,7
  84.     jnz  notest7
  85.     in   al,0x60
  86.   notest7:
  87.  
  88.     cmp  ah,8
  89.     jnz  notest8
  90.     out  0x60,al
  91.   notest8:
  92.  
  93.  
  94.  
  95.  
  96.     jmp  still
  97.  
  98.  
  99. ;   *********************************************
  100. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  101. ;   *********************************************
  102.  
  103.  
  104. draw_window:
  105.  
  106.         ;mcall  48, 3, sys_colors, 40
  107.  
  108.     mcall 12, 1
  109.  
  110.     mcall 0, <200,292>, <200,230>, 0x14FFFFFF,,tlabel
  111.  
  112.     mov  eax,8                     ; function 8 : define and draw button
  113.     mov  ebx,32*65536+10            ; [x start] *65536 + [x size]
  114.     mov  ecx,75*65536+10            ; [y start] *65536 + [y size]
  115.     mov  edx,2                     ; button id
  116.     mov  esi,0x6888B8              ; button color RRGGBB
  117.   newb:
  118.     int  0x40
  119.     add  ecx,20*65536
  120.     inc  edx
  121.     cmp  edx,9
  122.     jb   newb
  123.  
  124.     cld
  125.     mov  ebx,26*65536+37           ; draw info text with function 4
  126.     mov  ecx,0x000000
  127.     mov  edx,text
  128.     mov  esi,40
  129.   newline:
  130.     mov  eax,4
  131.     int  0x40
  132.     add  ebx,10
  133.     add  edx,40
  134.     cmp  [edx],byte 'x'
  135.     jnz  newline
  136.  
  137.  
  138.     mcall 12, 2                    ; function 12:tell os about windowdraw
  139.  
  140.  
  141.     ret
  142.  
  143. ; DATA AREA
  144.  
  145.  
  146. text:
  147.  
  148.     db 'Application uses 0x10000 bytes of memory'
  149.     db '                                        '
  150.     db 'Open debug board for rezult information '
  151.     db '                                        '
  152.     db '     CLI                                '
  153.     db '                                        '
  154.     db '     STI                                '
  155.     db '                                        '
  156.     db '     MOV [0x10000],BYTE 1               '
  157.     db '                                        '
  158.     db '     JMP DWORD 0x10000                  '
  159.     db '                                        '
  160.     db '     MOV ESP,0 & PUSH EAX               '
  161.     db '                                        '
  162.     db '     IN  Al,0x60                        '
  163.     db '                                        '
  164.     db '     OUT 0x60,AL                        '
  165.     db 'x                                       '
  166.  
  167.  
  168.  
  169. tlabel:
  170.     db   'Kolibri protection test',0
  171.  
  172.  
  173. I_END:
  174.