Subversion Repositories Kolibri OS

Rev

Rev 3645 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3645 Rev 4618
Line -... Line 1...
-
 
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
Line 8... Line 14...
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
-
 
22
	dd 0x0		; I_Icon
16
 
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:
-
 
25
 
31
still:
26
    mcall 10		     ; wait here for event
-
 
27
 
32
	mcall	10	; wait here for event
28
    cmp  eax,1			; redraw request ?
33
	cmp	eax,1	; redraw request ?
29
    jz	 red
-
 
30
    cmp  eax,2			; key in buffer ?
34
	jz	red
31
    jz	 key
35
 
32
    cmp  eax,3			; button in buffer ?
36
	cmp	eax,3	; button in buffer ?
Line -... Line 37...
-
 
37
	jz	button
-
 
38
	
-
 
39
	cmp	eax,2	; key in buffer ?
-
 
40
	jnz	still
-
 
41
;-------------------------------------------------------------------------------
33
    jz	 button
42
key:
34
 
-
 
35
    jmp  still
-
 
36
 
-
 
37
  red:				; redraw
-
 
38
    call draw_window
-
 
39
 
-
 
40
    jmp  still
-
 
41
 
43
	mcall	2	; just read it and ignore
42
  key:				; key
-
 
43
    mov  eax,2			; just read it and ignore
-
 
44
    int  0x40
-
 
45
 
-
 
46
    jmp  still
44
	jmp	still
47
 
45
;-------------------------------------------------------------------------------
48
  button:			; button
-
 
49
    mov  eax,17
-
 
50
    int  0x40
46
button:
51
 
47
	mcall	17
52
    cmp  ah,1			; button id=1 ?
-
 
53
    jnz  noclose
-
 
54
    mov  eax,-1 	; close this program
-
 
Line -... Line 48...
-
 
48
	cmp	ah,1	; button id=1 ?
-
 
49
	jnz	noclose
-
 
50
 
55
    int  0x40
51
	mcall	-1	; close this program
56
  noclose:
52
;-------------------------------------------------------------------------------
57
 
53
noclose:
-
 
54
	cmp	ah,2
58
    cmp  ah,2
55
	jnz	notest2
59
    jnz  notest2
-
 
60
    cli
56
	cli
61
  notest2:
57
;-------------------------------------------------------------------------------
62
 
58
notest2:
-
 
59
	cmp	ah,3
63
    cmp  ah,3
60
	jnz	notest3
64
    jnz  notest3
-
 
65
    sti
61
	sti
66
  notest3:
62
;-------------------------------------------------------------------------------
67
 
63
notest3:
-
 
64
	cmp	ah,4
68
    cmp  ah,4
65
	jnz	notest4
69
    jnz  notest4
-
 
70
     mov  [0x10000],byte 1
66
 	mov	[0x10000],byte 1
71
   notest4:
67
;-------------------------------------------------------------------------------	
72
 
68
notest4:
-
 
69
	cmp	ah,5
73
    cmp  ah,5
70
	jnz	notest5
74
    jnz  notest5
-
 
75
    jmp  dword 0x10000
71
	jmp	dword 0x10000
76
  notest5:
72
;-------------------------------------------------------------------------------
77
 
73
notest5:
78
    cmp  ah,6
74
	cmp	ah,6
-
 
75
	jnz	notest6
79
    jnz  notest6
76
	mov	esp,0
80
    mov  esp,0
-
 
81
    push eax
77
	push	eax
82
  notest6:
78
;-------------------------------------------------------------------------------
83
 
79
notest6:
-
 
80
	cmp	ah,7
84
    cmp  ah,7
81
	jnz	notest7
85
    jnz  notest7
-
 
86
    in	 al,0x60
82
	in	al,0x60
87
  notest7:
83
;-------------------------------------------------------------------------------
88
 
84
notest7:
89
    cmp  ah,8
-
 
90
    jnz  notest8
-
 
91
    out  0x60,al
-
 
92
  notest8:
85
	cmp	ah,8
93
 
-
 
-
 
86
	jnz	still
94
 
87
	out	0x60,al
95
    jmp  still
88
	jmp	still
96
 
89
;-------------------------------------------------------------------------------
97
;   *********************************************
-
 
98
;   *******  WINDOW DEFINITIONS AND DRAW ********
-
 
-
 
90
;   *********************************************
99
;   *********************************************
91
;   *******  WINDOW DEFINITIONS AND DRAW ********
100
 
-
 
101
 
92
;   *********************************************
102
draw_window:
-
 
103
 
93
;-------------------------------------------------------------------------------
104
	;mcall  48, 3, sys_colors, 40
-
 
105
 
94
draw_window:
106
    mcall 12, 1
-
 
107
 
95
	;mcall  48,3,sys_colors,40
108
    mcall 0, <200,292>, <200,230>, 0x14FFFFFF,,tlabel
96
	mcall	12,1
109
 
97
	mcall	0,<200,292>,<200,230>,0x14FFFFFF,,tlabel
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
Line 118... Line 106...
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
-
 
114
	mov	esi,40
126
    mov  esi,40
115
	
127
  newline:
116
	mov	eax,4
128
    mov  eax,4
117
.newline:
129
    int  0x40
118
	mcall
130
    add  ebx,10
-
 
Line 131... Line 119...
131
    add  edx,40
119
	add	ebx,10
132
    cmp  [edx],byte 'x'
-
 
133
    jnz  newline
-
 
134
 
120
	add	edx,40
135
 
-
 
-
 
121
	cmp	[edx],byte 'x'
136
    mcall 12, 2 		   ; function 12:tell os about windowdraw
122
	jnz	.newline
137
 
-
 
-
 
123
 
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 '
Line 158... Line 144...
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 '                                        '
Line 179... Line 185...
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