Subversion Repositories Kolibri OS

Rev

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