Subversion Repositories Kolibri OS

Rev

Rev 2108 | 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'
3645 fedesco 18
include 'lang.inc'
1815 yogev_ezra 19
 
2108 leency 20
START:				; start of execution
1815 yogev_ezra 21
 
2108 leency 22
    call draw_window		; at first, draw the window
1815 yogev_ezra 23
 
24
still:
25
 
2108 leency 26
    mcall 10		     ; wait here for event
1815 yogev_ezra 27
 
2108 leency 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
1815 yogev_ezra 34
 
35
    jmp  still
36
 
2108 leency 37
  red:				; redraw
1815 yogev_ezra 38
    call draw_window
39
 
40
    jmp  still
41
 
2108 leency 42
  key:				; key
43
    mov  eax,2			; just read it and ignore
1815 yogev_ezra 44
    int  0x40
45
 
46
    jmp  still
47
 
2108 leency 48
  button:			; button
1815 yogev_ezra 49
    mov  eax,17
50
    int  0x40
51
 
2108 leency 52
    cmp  ah,1			; button id=1 ?
1815 yogev_ezra 53
    jnz  noclose
2108 leency 54
    mov  eax,-1 	; close this program
1815 yogev_ezra 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
2108 leency 86
    in	 al,0x60
1815 yogev_ezra 87
  notest7:
88
 
89
    cmp  ah,8
90
    jnz  notest8
91
    out  0x60,al
92
  notest8:
93
 
94
 
95
    jmp  still
96
 
97
;   *********************************************
98
;   *******  WINDOW DEFINITIONS AND DRAW ********
99
;   *********************************************
100
 
101
 
102
draw_window:
103
 
2108 leency 104
	;mcall  48, 3, sys_colors, 40
1815 yogev_ezra 105
 
2108 leency 106
    mcall 12, 1
1815 yogev_ezra 107
 
2108 leency 108
    mcall 0, <200,292>, <200,230>, 0x14FFFFFF,,tlabel
1815 yogev_ezra 109
 
2108 leency 110
    mov  eax,8			   ; function 8 : define and draw button
111
    mov  ebx,32*65536+10	    ; [x start] *65536 + [x size]
112
    mov  ecx,75*65536+10	    ; [y start] *65536 + [y size]
113
    mov  edx,2			   ; button id
114
    mov  esi,0x6888B8		   ; button color RRGGBB
1815 yogev_ezra 115
  newb:
116
    int  0x40
117
    add  ecx,20*65536
118
    inc  edx
119
    cmp  edx,9
2108 leency 120
    jb	 newb
1815 yogev_ezra 121
 
122
    cld
2108 leency 123
    mov  ebx,26*65536+37	   ; draw info text with function 4
1815 yogev_ezra 124
    mov  ecx,0x000000
125
    mov  edx,text
126
    mov  esi,40
127
  newline:
128
    mov  eax,4
129
    int  0x40
130
    add  ebx,10
131
    add  edx,40
132
    cmp  [edx],byte 'x'
133
    jnz  newline
134
 
135
 
2108 leency 136
    mcall 12, 2 		   ; function 12:tell os about windowdraw
1815 yogev_ezra 137
 
2108 leency 138
 
1815 yogev_ezra 139
    ret
140
 
141
; DATA AREA
142
 
3645 fedesco 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                        '
162
		db 'x                                       '
163
else
164
	text:
165
		db 'Application uses 0x10000 bytes of memory'
166
		db '                                        '
167
		db 'Open debug board for rezult information '
168
		db '                                        '
169
		db '     CLI                                '
170
		db '                                        '
171
		db '     STI                                '
172
		db '                                        '
173
		db '     MOV [0x10000],BYTE 1               '
174
		db '                                        '
175
		db '     JMP DWORD 0x10000                  '
176
		db '                                        '
177
		db '     MOV ESP,0 & PUSH EAX               '
178
		db '                                        '
179
		db '     IN  Al,0x60                        '
180
		db '                                        '
181
		db '     OUT 0x60,AL                        '
182
		db 'x                                       '
183
end if
1815 yogev_ezra 184
 
185
tlabel:
2108 leency 186
    db	 'Kolibri protection test',0
1815 yogev_ezra 187
 
188
I_END: