Rev 1815 | 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 | |||
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 | |||
1829 | clevermous | 17 | include '../../../macros.inc' |
1815 | yogev_ezra | 18 | |
19 | START: ; start of execution |
||
20 | |||
21 | call draw_window ; at first, draw the window |
||
22 | |||
23 | still: |
||
24 | |||
25 | mov eax,10 ; wait here for event |
||
26 | int 0x40 |
||
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,0xffffffff ; 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 | |||
96 | |||
97 | jmp still |
||
98 | |||
99 | |||
100 | ; ********************************************* |
||
101 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
102 | ; ********************************************* |
||
103 | |||
104 | |||
105 | draw_window: |
||
106 | |||
107 | mov eax,12 ; function 12:tell os about windowdraw |
||
108 | mov ebx,1 ; 1, start of draw |
||
109 | int 0x40 |
||
110 | |||
111 | ; DRAW WINDOW |
||
112 | mov eax,0 ; function 0 : define and draw window |
||
113 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
||
114 | mov ecx,100*65536+240 ; [y start] *65536 + [y size] |
||
115 | mov edx,0x02ffffff ; color of work area RRGGBB |
||
116 | mov esi,0x80597799 ; color of grab bar RRGGBB,8->color glide |
||
117 | mov edi,0x00597799 ; color of frames RRGGBB |
||
118 | int 0x40 |
||
119 | |||
120 | ; WINDOW LABEL |
||
121 | mov eax,4 ; function 4 : write text to window |
||
122 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
123 | mov ecx,0x00ffffff ; color of text RRGGBB |
||
124 | mov edx,tlabel ; pointer to text beginning |
||
125 | mov esi,labellen-tlabel ; text length |
||
126 | int 0x40 |
||
127 | |||
128 | ; CLOSE BUTTON |
||
129 | mov eax,8 ; function 8 : define and draw button |
||
130 | mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] |
||
131 | mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
||
132 | mov edx,1 ; button id |
||
133 | mov esi,0x5977bb ; button color RRGGBB |
||
134 | int 0x40 |
||
135 | |||
136 | |||
137 | mov eax,8 ; function 8 : define and draw button |
||
138 | mov ebx,25*65536+9 ; [x start] *65536 + [x size] |
||
139 | mov ecx,74*65536+9 ; [y start] *65536 + [y size] |
||
140 | mov edx,2 ; button id |
||
141 | mov esi,0x5977bb ; button color RRGGBB |
||
142 | newb: |
||
143 | int 0x40 |
||
144 | add ecx,20*65536 |
||
145 | inc edx |
||
146 | cmp edx,9 |
||
147 | jb newb |
||
148 | |||
149 | cld |
||
150 | mov ebx,25*65536+36 ; draw info text with function 4 |
||
151 | mov ecx,0x000000 |
||
152 | mov edx,text |
||
153 | mov esi,40 |
||
154 | newline: |
||
155 | mov eax,4 |
||
156 | int 0x40 |
||
157 | add ebx,10 |
||
158 | add edx,40 |
||
159 | cmp [edx],byte 'x' |
||
160 | jnz newline |
||
161 | |||
162 | |||
163 | mov eax,12 ; function 12:tell os about windowdraw |
||
164 | mov ebx,2 ; 2, end of draw |
||
165 | int 0x40 |
||
166 | |||
167 | ret |
||
168 | |||
169 | |||
170 | ; DATA AREA |
||
171 | |||
172 | |||
173 | text: |
||
174 | |||
175 | db 'APPLICATION USES 0x10000 BYTES OF MEMORY' |
||
176 | db ' ' |
||
177 | db 'OPEN DEBUG BOARD FOR PARAMETERS ' |
||
178 | db ' ' |
||
179 | db ' CLI ' |
||
180 | db ' ' |
||
181 | db ' STI ' |
||
182 | db ' ' |
||
183 | db ' MOV [0x10000],BYTE 1 ' |
||
184 | db ' ' |
||
185 | db ' JMP DWORD 0x10000 ' |
||
186 | db ' ' |
||
187 | db ' MOV ESP,0 & PUSH EAX ' |
||
188 | db ' ' |
||
189 | db ' IN Al,0x60 ' |
||
190 | db ' ' |
||
191 | db ' OUT 0x60,AL ' |
||
192 | db 'x ' |
||
193 | |||
194 | |||
195 | |||
196 | tlabel: |
||
197 | db 'MENUET PROTECTION TEST' |
||
198 | labellen: |
||
199 | |||
200 | I_END: |