Subversion Repositories Kolibri OS

Rev

Rev 1829 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1815 yogev_ezra 1
;
2
;    PROTECTION TEST
3
;
4
 
5
use32
6
 
2108 leency 7
	       org    0x0
1815 yogev_ezra 8
 
2108 leency 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
1815 yogev_ezra 16
 
1829 clevermous 17
include '../../../macros.inc'
1815 yogev_ezra 18
 
2108 leency 19
START:				; start of execution
1815 yogev_ezra 20
 
2108 leency 21
    call draw_window		; at first, draw the window
1815 yogev_ezra 22
 
23
still:
24
 
2108 leency 25
    mcall 10		     ; wait here for event
1815 yogev_ezra 26
 
2108 leency 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
1815 yogev_ezra 33
 
34
    jmp  still
35
 
2108 leency 36
  red:				; redraw
1815 yogev_ezra 37
    call draw_window
38
 
39
    jmp  still
40
 
2108 leency 41
  key:				; key
42
    mov  eax,2			; just read it and ignore
1815 yogev_ezra 43
    int  0x40
44
 
45
    jmp  still
46
 
2108 leency 47
  button:			; button
1815 yogev_ezra 48
    mov  eax,17
49
    int  0x40
50
 
2108 leency 51
    cmp  ah,1			; button id=1 ?
1815 yogev_ezra 52
    jnz  noclose
2108 leency 53
    mov  eax,-1 	; close this program
1815 yogev_ezra 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
2108 leency 85
    in	 al,0x60
1815 yogev_ezra 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
 
2108 leency 106
	;mcall  48, 3, sys_colors, 40
1815 yogev_ezra 107
 
2108 leency 108
    mcall 12, 1
1815 yogev_ezra 109
 
2108 leency 110
    mcall 0, <200,292>, <200,230>, 0x14FFFFFF,,tlabel
1815 yogev_ezra 111
 
2108 leency 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
1815 yogev_ezra 117
  newb:
118
    int  0x40
119
    add  ecx,20*65536
120
    inc  edx
121
    cmp  edx,9
2108 leency 122
    jb	 newb
1815 yogev_ezra 123
 
124
    cld
2108 leency 125
    mov  ebx,26*65536+37	   ; draw info text with function 4
1815 yogev_ezra 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
 
2108 leency 138
    mcall 12, 2 		   ; function 12:tell os about windowdraw
1815 yogev_ezra 139
 
2108 leency 140
 
1815 yogev_ezra 141
    ret
142
 
143
; DATA AREA
144
 
145
 
146
text:
147
 
2108 leency 148
    db 'Application uses 0x10000 bytes of memory'
1815 yogev_ezra 149
    db '                                        '
2108 leency 150
    db 'Open debug board for rezult information '
1815 yogev_ezra 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:
2108 leency 170
    db	 'Kolibri protection test',0
1815 yogev_ezra 171
 
2108 leency 172
 
1815 yogev_ezra 173
I_END: