Subversion Repositories Kolibri OS

Rev

Rev 3645 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3645 Rev 4618
-
 
1
;-------------------------------------------------------------------------------
1
;
2
;
2
;    PROTECTION TEST
3
;    PROTECTION TEST
3
;
4
;
-
 
5
;-------------------------------------------------------------------------------
-
 
6
; last update:  07/03/2014
-
 
7
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
8
; changes:      Optimisations and code refactoring.
-
 
9
;               Reducing the consumption of RAM, 4 KB instead of 64 KB.
-
 
10
;               Translation into Russian.
4
 
-
 
-
 
11
;---------------------------------------------------------------------
5
use32
12
use32
6
 
-
 
7
	       org    0x0
13
	org 0x0
8
 
14
 
9
	       db     'MENUET01'	      ; 8 byte id
15
	db 'MENUET01'	; 8 byte id
10
	       dd     0x01		      ; header version
16
	dd 0x01		; header version
11
	       dd     START		      ; start of code
17
	dd START	; start of code
12
	       dd     I_END		      ; size of image
18
	dd I_END	; size of image
13
	       dd     0x10000		      ; memory for app
19
	dd IM_END	; memory for app
14
	       dd     0xfff0		      ; esp
20
	dd stack_top	; esp
15
	       dd     0x0 , 0x0 	      ; I_Param , I_Icon
21
	dd 0x0		; I_Param
16
 
-
 
-
 
22
	dd 0x0		; I_Icon
-
 
23
;-------------------------------------------------------------------------------
17
include '../../../macros.inc'
24
include '../../../macros.inc'
18
include 'lang.inc'
25
include 'lang.inc'
19
 
-
 
-
 
26
;-------------------------------------------------------------------------------
20
START:				; start of execution
27
START:				; start of execution
21
 
-
 
-
 
28
red:				; redraw
22
    call draw_window		; at first, draw the window
29
	call	draw_window		; at first, draw the window
23
 
-
 
-
 
30
;-------------------------------------------------------------------------------
24
still:
31
still:
25
 
-
 
26
    mcall 10		     ; wait here for event
32
	mcall	10	; wait here for event
27
 
-
 
28
    cmp  eax,1			; redraw request ?
33
	cmp	eax,1	; redraw request ?
29
    jz	 red
34
	jz	red
30
    cmp  eax,2			; key in buffer ?
-
 
31
    jz	 key
35
 
32
    cmp  eax,3			; button in buffer ?
36
	cmp	eax,3	; button in buffer ?
33
    jz	 button
37
	jz	button
-
 
38
	
-
 
39
	cmp	eax,2	; key in buffer ?
-
 
40
	jnz	still
-
 
41
;-------------------------------------------------------------------------------
-
 
42
key:
34
 
43
	mcall	2	; just read it and ignore
35
    jmp  still
-
 
36
 
-
 
37
  red:				; redraw
-
 
38
    call draw_window
-
 
39
 
-
 
40
    jmp  still
-
 
41
 
-
 
42
  key:				; key
44
	jmp	still
43
    mov  eax,2			; just read it and ignore
-
 
44
    int  0x40
-
 
45
 
-
 
46
    jmp  still
-
 
47
 
45
;-------------------------------------------------------------------------------
48
  button:			; button
46
button:
49
    mov  eax,17
-
 
50
    int  0x40
-
 
51
 
47
	mcall	17
52
    cmp  ah,1			; button id=1 ?
48
	cmp	ah,1	; button id=1 ?
53
    jnz  noclose
-
 
54
    mov  eax,-1 	; close this program
-
 
55
    int  0x40
-
 
-
 
49
	jnz	noclose
-
 
50
 
-
 
51
	mcall	-1	; close this program
56
  noclose:
52
;-------------------------------------------------------------------------------
57
 
53
noclose:
58
    cmp  ah,2
54
	cmp	ah,2
59
    jnz  notest2
55
	jnz	notest2
60
    cli
56
	cli
-
 
57
;-------------------------------------------------------------------------------
61
  notest2:
58
notest2:
62
 
-
 
63
    cmp  ah,3
59
	cmp	ah,3
64
    jnz  notest3
60
	jnz	notest3
65
    sti
61
	sti
-
 
62
;-------------------------------------------------------------------------------
66
  notest3:
63
notest3:
67
 
-
 
68
    cmp  ah,4
64
	cmp	ah,4
69
    jnz  notest4
65
	jnz	notest4
70
     mov  [0x10000],byte 1
66
 	mov	[0x10000],byte 1
-
 
67
;-------------------------------------------------------------------------------	
71
   notest4:
68
notest4:
72
 
-
 
73
    cmp  ah,5
69
	cmp	ah,5
74
    jnz  notest5
70
	jnz	notest5
75
    jmp  dword 0x10000
71
	jmp	dword 0x10000
-
 
72
;-------------------------------------------------------------------------------
76
  notest5:
73
notest5:
77
 
-
 
78
    cmp  ah,6
74
	cmp	ah,6
79
    jnz  notest6
75
	jnz	notest6
80
    mov  esp,0
76
	mov	esp,0
81
    push eax
77
	push	eax
-
 
78
;-------------------------------------------------------------------------------
82
  notest6:
79
notest6:
83
 
-
 
84
    cmp  ah,7
80
	cmp	ah,7
85
    jnz  notest7
81
	jnz	notest7
86
    in	 al,0x60
82
	in	al,0x60
-
 
83
;-------------------------------------------------------------------------------
87
  notest7:
84
notest7:
88
 
-
 
89
    cmp  ah,8
85
	cmp	ah,8
90
    jnz  notest8
86
	jnz	still
91
    out  0x60,al
87
	out	0x60,al
92
  notest8:
-
 
93
 
-
 
94
 
-
 
95
    jmp  still
88
	jmp	still
96
 
-
 
-
 
89
;-------------------------------------------------------------------------------
97
;   *********************************************
90
;   *********************************************
98
;   *******  WINDOW DEFINITIONS AND DRAW ********
91
;   *******  WINDOW DEFINITIONS AND DRAW ********
99
;   *********************************************
92
;   *********************************************
100
 
-
 
101
 
-
 
-
 
93
;-------------------------------------------------------------------------------
102
draw_window:
94
draw_window:
103
 
-
 
104
	;mcall  48, 3, sys_colors, 40
95
	;mcall  48,3,sys_colors,40
105
 
-
 
106
    mcall 12, 1
96
	mcall	12,1
107
 
-
 
108
    mcall 0, <200,292>, <200,230>, 0x14FFFFFF,,tlabel
97
	mcall	0,<200,292>,<200,230>,0x14FFFFFF,,tlabel
109
 
-
 
110
    mov  eax,8			   ; function 8 : define and draw button
98
	mov	eax,8			   ; function 8 : define and draw button
111
    mov  ebx,32*65536+10	    ; [x start] *65536 + [x size]
99
	mov	ebx,32*65536+10	    ; [x start] *65536 + [x size]
112
    mov  ecx,75*65536+10	    ; [y start] *65536 + [y size]
100
	mov	ecx,75*65536+10	    ; [y start] *65536 + [y size]
113
    mov  edx,2			   ; button id
101
	mov	edx,2			   ; button id
114
    mov  esi,0x6888B8		   ; button color RRGGBB
102
	mov	esi,0x6888B8		   ; button color RRGGBB
115
  newb:
103
.newb:
116
    int  0x40
104
	mcall
117
    add  ecx,20*65536
105
	add	ecx,20*65536
118
    inc  edx
106
	inc	edx
119
    cmp  edx,9
107
	cmp	edx,9
120
    jb	 newb
108
	jb	.newb
121
 
109
 
122
    cld
110
	cld
123
    mov  ebx,26*65536+37	   ; draw info text with function 4
111
	mov	ebx,26*65536+37	   ; draw info text with function 4
124
    mov  ecx,0x000000
112
	mov	ecx,0x000000
125
    mov  edx,text
113
	mov	edx,text
126
    mov  esi,40
114
	mov	esi,40
127
  newline:
115
	
128
    mov  eax,4
116
	mov	eax,4
129
    int  0x40
117
.newline:
-
 
118
	mcall
130
    add  ebx,10
119
	add	ebx,10
131
    add  edx,40
120
	add	edx,40
132
    cmp  [edx],byte 'x'
121
	cmp	[edx],byte 'x'
133
    jnz  newline
122
	jnz	.newline
134
 
-
 
135
 
123
 
136
    mcall 12, 2 		   ; function 12:tell os about windowdraw
-
 
137
 
-
 
138
 
124
	mcall	12,2 		   ; function 12:tell os about windowdraw
139
    ret
-
 
-
 
125
	ret
140
 
126
;-------------------------------------------------------------------------------
141
; DATA AREA
-
 
-
 
127
; DATA AREA
142
 
128
;-------------------------------------------------------------------------------
143
if lang eq it
129
if lang eq it
144
	text:
130
text:
145
		db 'Il programma usa 0x10000 byte di memoria'
131
	db 'Il programma usa 0x1000 byte di memoria '
146
		db '                                        '
132
	db '                                        '
147
		db 'Open debug board for rezult information '
133
	db 'Open debug board for rezult information '
148
		db '                                        '
134
	db '                                        '
149
		db '     CLI                                '
135
	db '     CLI                                '
150
		db '                                        '
136
	db '                                        '
151
		db '     STI                                '
137
	db '     STI                                '
152
		db '                                        '
138
	db '                                        '
153
		db '     MOV [0x10000],BYTE 1               '
139
	db '     MOV [0x10000],BYTE 1               '
154
		db '                                        '
140
	db '                                        '
155
		db '     JMP DWORD 0x10000                  '
141
	db '     JMP DWORD 0x10000                  '
156
		db '                                        '
142
	db '                                        '
157
		db '     MOV ESP,0 & PUSH EAX               '
143
	db '     MOV ESP,0 & PUSH EAX               '
158
		db '                                        '
144
	db '                                        '
159
		db '     IN  Al,0x60                        '
145
	db '     IN  Al,0x60                        '
160
		db '                                        '
146
	db '                                        '
161
		db '     OUT 0x60,AL                        '
147
	db '     OUT 0x60,AL                        '
162
		db 'x                                       '
148
	db 'x'
-
 
149
else if lang eq ru
-
 
150
text:
-
 
151
	db 'à¨«®¦¥­¨¥ ¨á¯®«ì§ã¥â 0x1000 ¡ ©â ¯ ¬ïâ¨'
-
 
152
	db '                                        '
-
 
153
	db 'Žâªàëâì BOARD ¤«ï ¯à®á¬®âà  à¥§ã«ìâ â   '
-
 
154
	db '                                        '
-
 
155
	db '     CLI                                '
-
 
156
	db '                                        '
-
 
157
	db '     STI                                '
-
 
158
	db '                                        '
-
 
159
	db '     MOV [0x10000],BYTE 1               '
-
 
160
	db '                                        '
-
 
161
	db '     JMP DWORD 0x10000                  '
-
 
162
	db '                                        '
-
 
163
	db '     MOV ESP,0 & PUSH EAX               '
-
 
164
	db '                                        '
-
 
165
	db '     IN  Al,0x60                        '
-
 
166
	db '                                        '
-
 
167
	db '     OUT 0x60,AL                        '
-
 
168
	db 'x'
163
else
169
else
164
	text:
170
text:
165
		db 'Application uses 0x10000 bytes of memory'
171
	db 'Application uses 0x1000 bytes of memory '
166
		db '                                        '
172
	db '                                        '
167
		db 'Open debug board for rezult information '
173
	db 'Open debug board for result information '
168
		db '                                        '
174
	db '                                        '
169
		db '     CLI                                '
175
	db '     CLI                                '
170
		db '                                        '
176
	db '                                        '
171
		db '     STI                                '
177
	db '     STI                                '
172
		db '                                        '
178
	db '                                        '
173
		db '     MOV [0x10000],BYTE 1               '
179
	db '     MOV [0x10000],BYTE 1               '
174
		db '                                        '
180
	db '                                        '
175
		db '     JMP DWORD 0x10000                  '
181
	db '     JMP DWORD 0x10000                  '
176
		db '                                        '
182
	db '                                        '
177
		db '     MOV ESP,0 & PUSH EAX               '
183
	db '     MOV ESP,0 & PUSH EAX               '
178
		db '                                        '
184
	db '                                        '
179
		db '     IN  Al,0x60                        '
185
	db '     IN  Al,0x60                        '
180
		db '                                        '
186
	db '                                        '
181
		db '     OUT 0x60,AL                        '
187
	db '     OUT 0x60,AL                        '
182
		db 'x                                       '
188
	db 'x'
183
end if
189
end if
-
 
190
;-------------------------------------------------------------------------------
-
 
191
if lang eq it
-
 
192
tlabel:
-
 
193
	db 'Kolibri prova di protezione',0
-
 
194
else if lang eq ru	
-
 
195
tlabel:
-
 
196
	db 'Kolibri ¯à®¢¥àª  § é¨âë ï¤à ',0
184
 
197
else
185
tlabel:
198
tlabel:
186
    db	 'Kolibri protection test',0
199
	db 'Kolibri protection test',0
187
 
200
end if
-
 
201
;-------------------------------------------------------------------------------
188
I_END:
202
I_END:
-
 
203
;-------------------------------------------------------------------------------
-
 
204
align 4
-
 
205
	rb 256
-
 
206
stack_top:
-
 
207
;-------------------------------------------------------------------------------
-
 
208
IM_END:
-
 
209
;-------------------------------------------------------------------------------
189
210