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