Subversion Repositories Kolibri OS

Rev

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

Rev 131 Rev 180
1
;
1
;
2
;   Vertical Refresh Rate programm
2
;   Vertical Refresh Rate programm
3
;
3
;
4
;   Author:  Trans <<< 13 >>>
4
;   Author:  Trans <<< 13 >>>
5
;   Date:    February-May 2003 (09.05.2003)
5
;   Date:    February-May 2003 (09.05.2003)
6
;   Version: 2.0
6
;   Version: 2.0
7
;   Last Modification: 30.07.2003
7
;   Last Modification: 30.07.2003
8
;   Compile with FASM for Menuet
8
;   Compile with FASM for Menuet
9
;
9
;
10
use32
10
use32
11
   
11
   
12
        org    0x0
12
        org    0x0
13
   
13
   
14
        db     'MENUET01'       ; 8 byte id
14
        db     'MENUET01'   ; 8 byte id
15
        dd     0x01        ; header version
15
        dd     0x01         ; header version
16
        dd     START        ; start of code
16
        dd     START        ; start of code
17
        dd     I_END        ; size of image
17
        dd     I_END        ; size of image
18
        dd     0x5000      ; memory for app
18
        dd     0x5000       ; memory for app
19
        dd     0x4ff0       ; esp
19
        dd     0x4ff0       ; esp
20
        dd     0x0 , 0x0        ; I_Param , I_Icon
20
        dd     0x0 , 0x0    ; I_Param , I_Icon
21
   
21
   
22
include 'macros.inc'
22
include 'macros.inc'
23
START:    ; start of execution
23
START:    ; start of execution
24
   
24
   
25
    mov eax,14
25
    mov eax,14
26
    int 40h
26
    int 40h
27
    mov ebx,eax
27
    mov ebx,eax
28
    shr ebx,16
28
    shr ebx,16
29
    mov [oldX],ebx
29
    mov [oldX],ebx
30
    shl eax,16
30
    shl eax,16
31
    shr eax,16
31
    shr eax,16
32
    mov [oldY],eax
32
    mov [oldY],eax
33
   
33
   
34
; Test on installed video driver
34
; Test on installed video driver
35
    mov eax,21
35
    mov eax,21
36
    mov ebx,13
36
    mov ebx,13
37
    mov ecx,1
37
    mov ecx,1
38
    mov edx,drvinfo
38
    mov edx,drvinfo
39
    int 40h
39
    int 40h
40
    cmp eax,0FFFFFFFFh ; = -1 - error or not installed
40
    cmp eax,0FFFFFFFFh ; = -1 - error or not installed
41
    jne vrr_00
41
    jne vrr_00
42
    call warning_info
42
    call warning_info
43
    retn
43
    retn
44
;
44
;
45
   
45
   
46
vrr_00:
46
vrr_00:
47
    call get_vert_rate
47
    call get_vert_rate
48
    mov eax,[currvm]
48
    mov eax,[currvm]
49
    mov [oldvm],eax
49
    mov [oldvm],eax
50
    call get_pid
50
    call get_pid
-
 
51
red:
51
    call draw_window  ; at first, draw the window
52
    call draw_window  ; at first, draw the window
52
   
53
   
53
still:
54
still:
54
   
55
   
55
    mov  eax,10   ; check here for event
56
    mov  eax,10   ; check here for event
56
    int  0x40
57
    int  0x40
57
   
58
   
58
    cmp  eax,1   ; redraw request ?
59
    cmp  eax,1   ; redraw request ?
59
    je  red
60
    je  red
60
    cmp  eax,2   ; key in buffer ?
61
    cmp  eax,2   ; key in buffer ?
61
    je  key
62
    je  key
62
    cmp  eax,3   ; button in buffer ?
63
    cmp  eax,3   ; button in buffer ?
63
    je  button
64
    je  button
64
    call get_pid
65
    call get_pid
65
    jmp  still
66
    jmp  still
66
   
-
 
67
  red:    ; redraw
-
 
68
    call draw_window
-
 
69
    jmp  still
-
 
70
   
67
      
71
  key:    ; key
68
  key:    ; key
72
    mov  eax,2   ; just read it
69
    mov  al,2   ; just read it
73
    int  0x40
70
    int  0x40
74
    cmp ah,'1'
71
    cmp ah,'1'
75
    jne key_loc_00
72
    jne key_loc_00
76
    call safekey
73
    call safekey
77
    jmp still
74
    jmp still
78
key_loc_00:
75
key_loc_00:
79
    cmp ah,'2'
76
    cmp ah,'2'
80
    jne key_loc_01
77
    jne key_loc_01
81
    call safekey
78
    call safekey
82
    jmp still
79
    jmp still
83
key_loc_01:
80
key_loc_01:
84
    cmp ah,'3'
81
    cmp ah,'3'
85
    jne key_loc_02
82
    jne key_loc_02
86
    call safekey
83
    call safekey
87
    jmp still
84
    jmp still
88
key_loc_02:
85
key_loc_02:
89
    cmp ah,'4'
86
    cmp ah,'4'
90
    jne key_loc_03
87
    jne key_loc_03
91
    call safekey
88
    call safekey
92
    jmp still
89
    jmp still
93
key_loc_03:
90
key_loc_03:
94
    cmp ah,'5'
91
    cmp ah,'5'
95
    jne key_loc_04
92
    jne key_loc_04
96
    call safekey
93
    call safekey
97
    jmp still
94
    jmp still
98
key_loc_04:
95
key_loc_04:
99
    cmp ah,'-'
96
    cmp ah,'-'
100
    jne key_loc_05
97
    jne key_loc_05
101
    xor eax,eax
98
    xor eax,eax
102
    call inc_dec_rate
99
    call inc_dec_rate
103
    jmp still
100
    jmp still
104
key_loc_05:
101
key_loc_05:
105
    cmp ah,'+'
102
    cmp ah,'+'
106
    jne key_loc_06
103
    jne key_loc_06
107
    xor eax,eax
104
    xor eax,eax
108
    inc eax
105
    inc eax
109
    call inc_dec_rate
106
    call inc_dec_rate
110
    jmp  still
107
    jmp  still
111
key_loc_06:
108
key_loc_06:
112
    cmp ah,'r'         ;Return in last stable mode
109
    cmp ah,'r'         ;Return in last stable mode
113
    jne key_loc_07
110
    jne key_loc_07
114
    call restore_mode
111
    call restore_mode
115
    jmp red
112
    jmp red
116
key_loc_07:
113
key_loc_07:
117
    cmp ah,13          ;Apply select mode
114
    cmp ah,13          ;Apply select mode
118
    jne still
115
    jne still
119
    xor eax,eax
116
    xor eax,eax
120
    mov ax,[vmselect]
117
    mov ax,[vmselect]
121
    cmp al,0
118
    cmp al,0
122
    je still
119
    je still
123
    xor ebx,ebx
120
    xor ebx,ebx
124
    mov bl,al
121
    mov bl,al
125
    dec bl
122
    dec bl
126
    shl bx,1      ; ebx=(ebx-1)*2
123
    shl bx,1      ; ebx=(ebx-1)*2
127
    xor edx,edx
124
    xor edx,edx
128
    mov dx,[vidmode+ebx]
125
    mov dx,[vidmode+ebx]
129
    mov ecx,ebx
126
    mov ecx,ebx
130
    shl ebx,2
127
    shl ebx,2
131
    add ebx,ecx   ; ebx=ebx*5
128
    add ebx,ecx   ; ebx=ebx*5
132
    shr ax,8
129
    shr ax,8
133
    dec ax
130
    dec ax
134
    shl ax,1
131
    shl ax,1
135
    add ebx,eax
132
    add ebx,eax
136
    ror edx,16
133
    ror edx,16
137
    mov dx,[_m1+ebx]
134
    mov dx,[_m1+ebx]
138
    rol edx,16
135
    rol edx,16
139
    call set_my_mode
136
    call set_my_mode
140
    call protect_and_return
137
    call protect_and_return
141
    xor ax,ax
138
    xor ax,ax
142
    mov [vmselect],ax
139
    mov [vmselect],ax
143
    jmp red
140
    jmp red
144
   
141
   
145
button:   ; button
142
button:   ; button
146
    mov  eax,17   ; get id
143
    mov  al,17   ; get id
147
    int  0x40
144
    int  0x40
148
   
145
   
149
    cmp  ah,1   ; button id=1 ?
146
    cmp  ah,1   ; button id=1 ?
150
    jne  noclose
147
    jne  noclose
151
    mov  eax,-1           ; close this program
148
    mov  eax,-1           ; close this program
152
    int  0x40
149
    int  0x40
153
  noclose:
150
  noclose:
154
    cmp ah,2              ;'+' screen width
151
    cmp ah,2              ;'+' screen width
155
    jne button_loc_01
152
    jne button_loc_01
156
    xor eax,eax
153
    xor eax,eax
157
    inc eax
154
    inc eax
158
    call inc_dec_rate
155
    call inc_dec_rate
159
    jmp still
156
    jmp still
160
button_loc_01:
157
button_loc_01:
161
    cmp ah,3              ;'-' screen width
158
    cmp ah,3              ;'-' screen width
162
    jne button_loc_02
159
    jne button_loc_02
163
    xor eax,eax
160
    xor eax,eax
164
    call inc_dec_rate
161
    call inc_dec_rate
165
    jmp still
162
    jmp still
166
button_loc_02:
163
button_loc_02:
167
    cmp ah,4              ; Ok
164
    cmp ah,4              ; Ok
168
    jne button_loc_03
165
    jne button_loc_03
169
    mov ah,13
166
    mov ah,13
170
    jmp key_loc_07
167
    jmp key_loc_07
171
button_loc_03:
168
button_loc_03:
172
    cmp ah,5              ; Cancel
169
    cmp ah,5              ; Cancel
173
    jne button_loc_04
170
    jne button_loc_04
174
    mov [vmselect],word 00h
171
    mov [vmselect],word 00h
175
    jmp red
172
    jmp red
176
button_loc_04:
173
button_loc_04:
177
    cmp ah,6              ; Return
174
    cmp ah,6              ; Return
178
    jne button_loc_05
175
    jne button_loc_05
179
    mov ah,'r'
176
    mov ah,'r'
180
    jmp key_loc_06
177
    jmp key_loc_06
181
button_loc_05:
178
button_loc_05:
182
    cmp ah,7              ; Default
179
    cmp ah,7              ; Default
183
    jne button_loc_06
180
    jne button_loc_06
184
    call restore_mode
181
    call restore_mode
185
button_loc_06:
182
button_loc_06:
186
    jmp  still
183
    jmp  still
187
   
184
   
188
   
185
   
189
;   *********************************************
186
;   *********************************************
190
;   *******  WINDOW DEFINITIONS AND DRAW ********
187
;   *******  WINDOW DEFINITIONS AND DRAW ********
191
;   *********************************************
188
;   *********************************************
192
   
189
   
193
   
190
   
194
draw_window:
191
draw_window:
195
   
192
   
196
dw_continue:
193
dw_continue:
197
   
194
   
198
    mov  eax,12      ; function 12:tell os about windowdraw
195
    mov  eax,12      ; function 12:tell os about windowdraw
199
    mov  ebx,1      ; 1, start of draw
196
    mov  ebx,1      ; 1, start of draw
200
    int  0x40
197
    int  0x40
201
   
198
   
202
       ; DRAW WINDOW
199
       ; DRAW WINDOW
203
    mov  eax,0      ; function 0 : define and draw window
200
    mov  eax,0      ; function 0 : define and draw window
204
    mov  ebx,100*65536+400    ; [x start] *65536 + [x size]
201
    mov  ebx,100*65536+400    ; [x start] *65536 + [x size]
205
    mov  ecx,100*65536+200    ; [y start] *65536 + [y size]
202
    mov  ecx,100*65536+200    ; [y start] *65536 + [y size]
206
    mov  edx,0x020020C0;0x00000040 ; color of work area RRGGBB,8->color glide
203
    mov  edx,0x130020C0;0x00000040 ; color of work area RRGGBB,8->color glide
207
    mov  esi,0x805080d0     ; color of grab bar RRGGBB,8->color glide
-
 
208
    mov  edi,0x00ffffff     ; color of frames RRGGBB
-
 
209
    int  0x40
-
 
210
   
-
 
211
       ; WINDOW LABEL
-
 
212
     call print_my_title
-
 
213
   
-
 
214
       ; CLOSE BUTTON
-
 
215
    mov  eax,8      ; function 8 : define and draw button
-
 
216
    mov  ebx,(400-19)*65536+12    ; [x start] *65536 + [x size]
-
 
217
    mov  ecx,5*65536+12     ; [y start] *65536 + [y size]
-
 
218
    mov  edx,1      ; button id
204
    mov  edi,header
219
    mov  esi,0x5599cc     ; button color RRGGBB
-
 
220
    int  0x40
205
    int  0x40
221
   
206
   
222
       ; BUTTONS
207
       ; BUTTONS
223
    xor eax,eax
208
    mov eax,8
224
    mov edx,eax
209
    mov edx,0
225
    mov al,8
-
 
226
    mov ebx,330*65536+20
210
    mov ebx,330*65536+20
227
    mov ecx,84*65536+48
211
    mov ecx,84*65536+48
228
    mov dl,2
212
    mov dl,2
-
 
213
    mov  esi,0x5599cc     ; button color RRGGBB
229
    int 40h               ; Button '+'Width
214
    int 40h               ; Button '+'Width
230
    add ebx,30*65536
215
    add ebx,30*65536
231
    mov dl,3
216
    mov dl,3
232
    int 40h               ; Button '-'Width
217
    int 40h               ; Button '-'Width
233
    mov ebx,22*65536+85
218
    mov ebx,22*65536+85
234
    mov ecx,170*65536+15
219
    mov ecx,170*65536+15
235
    inc dl ;dl=4
220
    inc dl ;dl=4
236
    int 40h               ; Button 'Ok'
221
    int 40h               ; Button 'Ok'
237
    add ebx,90*65536
222
    add ebx,90*65536
238
    inc dl ;dl=5
223
    inc dl ;dl=5
239
    int 40h               ; Button 'Cancel'
224
    int 40h               ; Button 'Cancel'
240
    add ebx,90*65536
225
    add ebx,90*65536
241
    inc dl ;dl=6
226
    inc dl ;dl=6
242
    int 40h               ; Button 'Return'
227
    int 40h               ; Button 'Return'
243
    add ebx,90*65536
228
    add ebx,90*65536
244
    inc dl ;dl=7
229
    inc dl ;dl=7
245
    int 40h               ; Button 'Default'
230
    int 40h               ; Button 'Default'
246
   
231
   
247
    call draw_face
232
    call draw_face
248
   
233
   
249
    mov  eax,12      ; function 12:tell os about windowdraw
234
    mov  eax,12      ; function 12:tell os about windowdraw
250
    mov  ebx,2      ; 2, end of draw
235
    mov  ebx,2      ; 2, end of draw
251
    int  0x40
236
    int  0x40
252
   
237
   
253
    ret
238
    ret
254
   
239
   
255
;------------Subfunctions-----------
240
;------------Subfunctions-----------
256
   
241
   
257
restore_mode:
242
restore_mode:
258
    push eax
243
    push eax
259
    push ebx
244
    push ebx
260
    push edx
245
    push edx
261
    mov eax,21
246
    mov eax,21
262
    mov ebx,13
247
    mov ebx,13
263
    mov ecx,4
248
    mov ecx,4
264
    int 40h
249
    int 40h
265
    pop edx
250
    pop edx
266
    pop ecx
251
    pop ecx
267
    pop eax
252
    pop eax
268
    retn
253
    retn
269
   
254
   
270
   
255
   
271
   
256
   
272
; IN: edx = RefRate*65536+No.VideoMode
257
; IN: edx = RefRate*65536+No.VideoMode
273
set_my_mode:
258
set_my_mode:
274
    push ecx
259
    push ecx
275
    push ebx
260
    push ebx
276
    push edx
261
    push edx
277
    mov eax,[currvm]
262
    mov eax,[currvm]
278
    mov [oldvm],eax
263
    mov [oldvm],eax
279
    mov [currvm],edx
264
    mov [currvm],edx
280
    pop edx
265
    pop edx
281
    push edx
266
    push edx
282
    mov eax,21
267
    mov eax,21
283
    mov ebx,13
268
    mov ebx,13
284
    mov ecx,3
269
    mov ecx,3
285
    int 40h
270
    int 40h
286
    mcall 5,50
271
    mcall 5,50
287
    mcall 15,3
272
    mcall 15,3
288
    pop edx
273
    pop edx
289
    pop ebx
274
    pop ebx
290
    pop ecx
275
    pop ecx
291
    retn
276
    retn
292
   
277
   
293
; IN: eax = 0/1  -  -/+ 1Hz
278
; IN: eax = 0/1  -  -/+ 1Hz
294
inc_dec_rate:
279
inc_dec_rate:
295
    push ebx
280
    push ebx
296
    push ecx
281
    push ecx
297
    push edx
282
    push edx
298
    mov edx,eax
283
    mov edx,eax
299
    mov eax,21
284
    mov eax,21
300
    mov ebx,13
285
    mov ebx,13
301
    mov ecx,5
286
    mov ecx,5
302
    int 40h
287
    int 40h
303
    pop edx
288
    pop edx
304
    pop ecx
289
    pop ecx
305
    pop ebx
290
    pop ebx
306
    retn
291
    retn
307
   
292
   
308
get_pid:
293
get_pid:
309
    mov eax,9
294
    mov eax,9
310
    mov ebx,buffer
295
    mov ebx,buffer
311
    xor ecx,ecx
296
    xor ecx,ecx
312
    dec ecx
297
    dec ecx
313
    int 40h
298
    int 40h
314
    mov [totp],eax
299
    mov [totp],eax
315
    mov eax,[ebx+30]
300
    mov eax,[ebx+30]
316
    mov [mypid],eax
301
    mov [mypid],eax
317
    mov ax,[ebx+4]
302
    mov ax,[ebx+4]
318
    mov [mypno],ax
303
    mov [mypno],ax
319
    retn
304
    retn
320
   
305
   
321
get_vert_rate:
306
get_vert_rate:
322
    xor eax,eax
307
    xor eax,eax
323
    mov ebx,eax
308
    mov ebx,eax
324
    mov ecx,eax
309
    mov ecx,eax
325
    mov al,21
310
    mov al,21
326
    mov bl,13
311
    mov bl,13
327
    mov cl,2
312
    mov cl,2
328
    int 40h
313
    int 40h
329
    mov [initrr],ebx
314
    mov [initrr],ebx
330
    mov [refrate],ebx
315
    mov [refrate],ebx
331
    ror ecx,16
316
    ror ecx,16
332
    mov cx,bx
317
    mov cx,bx
333
    rol ecx,16
318
    rol ecx,16
334
    mov [currvm],ecx
319
    mov [currvm],ecx
335
    retn
320
    retn
336
   
321
   
337
get_initial_videomode:
322
get_initial_videomode:
338
    retn
323
    retn
339
   
324
   
340
   
325
   
341
draw_table:
326
draw_table:
342
    mov eax,13
327
    mov eax,13
343
    mov ebx,9*65536+303
328
    mov ebx,9*65536+303
344
    mov ecx,59*65536+87
329
    mov ecx,59*65536+87
345
    xor edx,edx
330
    xor edx,edx
346
    int 40h
331
    int 40h
347
    mov ebx,10*65536+300
332
    mov ebx,10*65536+300
348
    mov ecx,60*65536+24
333
    mov ecx,60*65536+24
349
    mov edx,00FF00FFh
334
    mov edx,00FF00FFh
350
    int 40h
335
    int 40h
351
    mov ebx,10*65536+36
336
    mov ebx,10*65536+36
352
    mov ecx,72*65536+72
337
    mov ecx,72*65536+72
353
    mov edx,0000FFFFh
338
    mov edx,0000FFFFh
354
    int 40h
339
    int 40h
355
    mov eax,38
340
    mov eax,38
356
    mov edx,00FFFFFFh
341
    mov edx,00FFFFFFh
357
    mov ebx,10*65536+310
342
    mov ebx,10*65536+310
358
    mov edi,60*65536+60
343
    mov edi,60*65536+60
359
    mov esi,12*65536+12
344
    mov esi,12*65536+12
360
    xor ecx,ecx
345
    xor ecx,ecx
361
    mov cl,8
346
    mov cl,8
362
dt_loc_hor_line:
347
dt_loc_hor_line:
363
    push ecx
348
    push ecx
364
    mov ecx,edi
349
    mov ecx,edi
365
    int 40h
350
    int 40h
366
    add edi,esi
351
    add edi,esi
367
    pop ecx
352
    pop ecx
368
    loop dt_loc_hor_line
353
    loop dt_loc_hor_line
369
    mov ebx,10*65536+10
354
    mov ebx,10*65536+10
370
    mov edi,60*65536+144
355
    mov edi,60*65536+144
371
    mov esi,66*65536+66
356
    mov esi,66*65536+66
372
    mov ecx,edi
357
    mov ecx,edi
373
    int 40h
358
    int 40h
374
    add ebx,36*65536+36
359
    add ebx,36*65536+36
375
    xor ecx,ecx
360
    xor ecx,ecx
376
    mov cl,5
361
    mov cl,5
377
dt_loc_vert_line:
362
dt_loc_vert_line:
378
    push ecx
363
    push ecx
379
    mov ecx,edi
364
    mov ecx,edi
380
    int 40h
365
    int 40h
381
    add ebx,esi
366
    add ebx,esi
382
    pop ecx
367
    pop ecx
383
    loop dt_loc_vert_line
368
    loop dt_loc_vert_line
384
    mov eax,4
369
    mov eax,4
385
    mov ebx,52*65536+75
370
    mov ebx,52*65536+75
386
    mov ecx,000000FFh
371
    mov ecx,000000FFh
387
    mov edx,_m1280x1024
372
    mov edx,_m1280x1024
388
    mov esi,9
373
    mov esi,9
389
    int 40h
374
    int 40h
390
    add edx,9
375
    add edx,9
391
    add ebx,66*65536
376
    add ebx,66*65536
392
    int 40h
377
    int 40h
393
    add edx,9
378
    add edx,9
394
    add ebx,66*65536
379
    add ebx,66*65536
395
    int 40h
380
    int 40h
396
    add edx,9
381
    add edx,9
397
    add ebx,66*65536
382
    add ebx,66*65536
398
    int 40h
383
    int 40h
399
    xor eax,eax
384
    xor eax,eax
400
    mov ebx,eax
385
    mov ebx,eax
401
    mov ecx,eax
386
    mov ecx,eax
402
    mov al,47
387
    mov al,47
403
    inc ebx
388
    inc ebx
404
    shl ebx,16
389
    shl ebx,16
405
    inc ecx
390
    inc ecx
406
    mov edi,ecx
391
    mov edi,ecx
407
    mov edx,22*65536+86
392
    mov edx,22*65536+86
408
    mov esi,00FF0000h
393
    mov esi,00FF0000h
409
    mov ecx,5
394
    mov ecx,5
410
dt_loc_00:
395
dt_loc_00:
411
    push ecx
396
    push ecx
412
    mov ecx,edi
397
    mov ecx,edi
413
    int 40h
398
    int 40h
414
    inc edi
399
    inc edi
415
    add dx,12
400
    add dx,12
416
    pop ecx
401
    pop ecx
417
    loop dt_loc_00
402
    loop dt_loc_00
418
    xor ecx,ecx
403
    xor ecx,ecx
419
    inc ecx
404
    inc ecx
420
    mov edi,ecx
405
    mov edi,ecx
421
    mov edx,76*65536+63
406
    mov edx,76*65536+63
422
    mov esi,000000FFh
407
    mov esi,000000FFh
423
    mov ecx,4
408
    mov ecx,4
424
dt_loc_01:
409
dt_loc_01:
425
    push ecx
410
    push ecx
426
    mov ecx,edi
411
    mov ecx,edi
427
    int 40h
412
    int 40h
428
    inc edi
413
    inc edi
429
    add edx,66*65536
414
    add edx,66*65536
430
    pop ecx
415
    pop ecx
431
    loop dt_loc_01
416
    loop dt_loc_01
432
    mov eax,4
417
    mov eax,4
433
    mov ebx,16*65536+63
418
    mov ebx,16*65536+63
434
    mov ecx,000000FFh
419
    mov ecx,000000FFh
435
    mov edx,_mk
420
    mov edx,_mk
436
    mov esi,4
421
    mov esi,4
437
    int 40h
422
    int 40h
438
    shl ecx,16
423
    shl ecx,16
439
    add bx,12
424
    add bx,12
440
    add edx,4
425
    add edx,4
441
    int 40h
426
    int 40h
442
    retn
427
    retn
443
   
428
   
444
;IN: ah=keycode
429
;IN: ah=keycode
445
safekey:
430
safekey:
446
    sub ah,30h
431
    sub ah,30h
447
    push bx
432
    push bx
448
    mov bx,word [vmselect]
433
    mov bx,word [vmselect]
449
    cmp bx,0
434
    cmp bx,0
450
    jnz sk_loc_00
435
    jnz sk_loc_00
451
    cmp ah,5
436
    cmp ah,5
452
    je sk_loc_01
437
    je sk_loc_01
453
    mov bl,ah
438
    mov bl,ah
454
    mov [vmselect],bx
439
    mov [vmselect],bx
455
    jmp sk_loc_01
440
    jmp sk_loc_01
456
sk_loc_00:
441
sk_loc_00:
457
    push esi
442
    push esi
458
    push edx
443
    push edx
459
    push ecx
444
    push ecx
460
    push eax
445
    push eax
461
    mov bh,ah
446
    mov bh,ah
462
    xor edx,edx
447
    xor edx,edx
463
    mov esi,_m1
448
    mov esi,_m1
464
    mov al,bl
449
    mov al,bl
465
    dec al
450
    dec al
466
    xor ah,ah
451
    xor ah,ah
467
    mov cx,10
452
    mov cx,10
468
    mul cx
453
    mul cx
469
    xor ecx,ecx
454
    xor ecx,ecx
470
    mov cx,ax
455
    mov cx,ax
471
    xor ax,ax
456
    xor ax,ax
472
    mov al,bh
457
    mov al,bh
473
    dec al
458
    dec al
474
    shl ax,1
459
    shl ax,1
475
    add cx,ax
460
    add cx,ax
476
    add esi,ecx
461
    add esi,ecx
477
    lodsw
462
    lodsw
478
    cmp ax,0
463
    cmp ax,0
479
    jnz sk_loc_02
464
    jnz sk_loc_02
480
    xor eax,eax
465
    xor eax,eax
481
    mov bh,ah
466
    mov bh,ah
482
sk_loc_02:
467
sk_loc_02:
483
    mov [vmselect],bx
468
    mov [vmselect],bx
484
    pop eax
469
    pop eax
485
    pop ecx
470
    pop ecx
486
    pop edx
471
    pop edx
487
    pop esi
472
    pop esi
488
sk_loc_01:
473
sk_loc_01:
489
    call draw_window
474
    call draw_window
490
    pop bx
475
    pop bx
491
    retn
476
    retn
492
   
477
   
493
; IN: ebx=Xstart*65536+Xend
478
; IN: ebx=Xstart*65536+Xend
494
;     ecx=Ystart*65536+Yend
479
;     ecx=Ystart*65536+Yend
495
;     edx=color
480
;     edx=color
496
draw_rect:
481
draw_rect:
497
    push eax
482
    push eax
498
    push ebx
483
    push ebx
499
    push ecx
484
    push ecx
500
    push edx
485
    push edx
501
    push edi
486
    push edi
502
    xor eax,eax
487
    xor eax,eax
503
    mov al,38
488
    mov al,38
504
    push ecx
489
    push ecx
505
    mov edi,ecx
490
    mov edi,ecx
506
    shr edi,16
491
    shr edi,16
507
    mov cx,di
492
    mov cx,di
508
    int 40h
493
    int 40h
509
    pop ecx
494
    pop ecx
510
    push ecx
495
    push ecx
511
    mov edi,ecx
496
    mov edi,ecx
512
    ror ecx,16
497
    ror ecx,16
513
    mov cx,di
498
    mov cx,di
514
    int 40h
499
    int 40h
515
    pop ecx
500
    pop ecx
516
    push ebx
501
    push ebx
517
    mov edi,ebx
502
    mov edi,ebx
518
    shr edi,16
503
    shr edi,16
519
    mov bx,di
504
    mov bx,di
520
    int 40h
505
    int 40h
521
    pop ebx
506
    pop ebx
522
    mov edi,ebx
507
    mov edi,ebx
523
    ror ebx,16
508
    ror ebx,16
524
    mov bx,di
509
    mov bx,di
525
    int 40h
510
    int 40h
526
    pop edi
511
    pop edi
527
    pop edx
512
    pop edx
528
    pop ecx
513
    pop ecx
529
    pop ebx
514
    pop ebx
530
    pop eax
515
    pop eax
531
    retn
516
    retn
532
   
517
   
533
;
518
;
534
; OUT: eax = 0 - no event
519
; OUT: eax = 0 - no event
535
protect_and_return:
520
protect_and_return:
536
    push ebx
521
    push ebx
537
    push ecx
522
    push ecx
538
    xor eax,eax
523
    xor eax,eax
539
    mov al,5
524
    mov al,5
540
    xor ebx,ebx
525
    xor ebx,ebx
541
    mov bx,300
526
    mov bx,300
542
    int 40h
527
    int 40h
543
    call get_pid
528
    call get_pid
544
    xor eax,eax
529
    xor eax,eax
545
    mov ebx,eax
530
    mov ebx,eax
546
    mov ecx,eax
531
    mov ecx,eax
547
    mov al,18
532
    mov al,18
548
    mov ebx,3
533
    mov ebx,3
549
    mov cx,[mypno]
534
    mov cx,[mypno]
550
    int 40h
535
    int 40h
551
    pop ecx
536
    pop ecx
552
    pusha
537
    pusha
553
    call draw_window
538
    call draw_window
554
    popa
539
    popa
555
    xor eax,eax
540
    xor eax,eax
556
    mov al,5
541
    mov al,5
557
    xor ebx,ebx
542
    xor ebx,ebx
558
    mov bx,300
543
    mov bx,300
559
    int 40h
544
    int 40h
560
    xor eax,eax
545
    xor eax,eax
561
    mov al,11
546
    mov al,11
562
    int 40h
547
    int 40h
563
    cmp eax,1
548
    cmp eax,1
564
    jne par_loc_00
549
    jne par_loc_00
565
    pusha
550
    pusha
566
    call draw_window
551
    call draw_window
567
    popa
552
    popa
568
par_loc_00:
553
par_loc_00:
569
    xor eax,eax
554
    xor eax,eax
570
    mov ebx,eax
555
    mov ebx,eax
571
    mov al,23
556
    mov al,23
572
    mov bx,700
557
    mov bx,700
573
    int 40h
558
    int 40h
574
    cmp eax,0
559
    cmp eax,0
575
    jnz par_loc_02
560
    jnz par_loc_02
576
; mov [ftr_eax],eax
561
; mov [ftr_eax],eax
577
    mov edx,[oldvm]
562
    mov edx,[oldvm]
578
    call set_my_mode
563
    call set_my_mode
579
par_loc_02:
564
par_loc_02:
580
    pop ebx
565
    pop ebx
581
    retn
566
    retn
582
   
567
   
583
debug_ftr:
568
debug_ftr:
584
;    xor eax,eax
569
;    xor eax,eax
585
;    mov ebx,eax
570
;    mov ebx,eax
586
;    mov al,47
571
;    mov al,47
587
;    mov bl,8
572
;    mov bl,8
588
;    shl ebx,16
573
;    shl ebx,16
589
;    mov bh,1
574
;    mov bh,1
590
;    mov ecx,[ftr_eax]
575
;    mov ecx,[ftr_eax]
591
;    mov edx,20*65536+180
576
;    mov edx,20*65536+180
592
;    mov esi,00FFFFFFh
577
;    mov esi,00FFFFFFh
593
;    int 40h
578
;    int 40h
594
;    mov ecx,[ftr_ebx]
579
;    mov ecx,[ftr_ebx]
595
;    add edx,54*65536
580
;    add edx,54*65536
596
;    int 40h
581
;    int 40h
597
    retn
582
    retn
598
   
583
   
599
print_cur_vm:
584
print_cur_vm:
600
    mov eax,4
585
    mov eax,4
601
    mov ebx,20*65536+40
586
    mov ebx,20*65536+40
602
    mov ecx,0000FF00h
587
    mov ecx,0000FF00h
603
    mov edx,curmode
588
    mov edx,curmode
604
    mov esi,cmlen
589
    mov esi,cmlen
605
    int 40h
590
    int 40h
606
    mov al,14
591
    mov al,14
607
    int 40h
592
    int 40h
608
    mov esi,00FFFFFFh
593
    mov esi,00FFFFFFh
609
    mov edi,eax
594
    mov edi,eax
610
    shr eax,16
595
    shr eax,16
611
    xor ecx,ecx
596
    xor ecx,ecx
612
    mov cx,ax
597
    mov cx,ax
613
    inc ecx
598
    inc ecx
614
    xor ebx,ebx
599
    xor ebx,ebx
615
    mov bl,4
600
    mov bl,4
616
    shl ebx,16
601
    shl ebx,16
617
    mov edx,104*65536+40
602
    mov edx,104*65536+40
618
    mov eax,47
603
    mov eax,47
619
    int 40h
604
    int 40h
620
    add edx,30*65536
605
    add edx,30*65536
621
    mov cx,di
606
    mov cx,di
622
    inc ecx
607
    inc ecx
623
    int 40h
608
    int 40h
624
    add edx,30*65536
609
    add edx,30*65536
625
    mov ecx,[initrr]
610
    mov ecx,[initrr]
626
    sub ebx,1*65536
611
    sub ebx,1*65536
627
    int 40h
612
    int 40h
628
    mov al,4
613
    mov al,4
629
    mov ebx,200*65536+40
614
    mov ebx,200*65536+40
630
    mov ecx,0000FF00h
615
    mov ecx,0000FF00h
631
    mov edx,selmode
616
    mov edx,selmode
632
    mov esi,cmlen
617
    mov esi,cmlen
633
    int 40h
618
    int 40h
634
    mov ax,[vmselect]
619
    mov ax,[vmselect]
635
    cmp ax,0
620
    cmp ax,0
636
    jz pcv_loc_00
621
    jz pcv_loc_00
637
    push eax
622
    push eax
638
    xor eax,eax
623
    xor eax,eax
639
    mov al,13
624
    mov al,13
640
    mov ebx,284*65536+54
625
    mov ebx,284*65536+54
641
    mov ecx,40*65536+10
626
    mov ecx,40*65536+10
642
    mov edx,000020C0h
627
    mov edx,000020C0h
643
    int 40h
628
    int 40h
644
    pop eax
629
    pop eax
645
    push eax
630
    push eax
646
    xor ecx,ecx
631
    xor ecx,ecx
647
    dec al
632
    dec al
648
    mov cl,al
633
    mov cl,al
649
    shl cx,3
634
    shl cx,3
650
    add cl,al   ; cx=(al-1)*9
635
    add cl,al   ; cx=(al-1)*9
651
    mov edx,_m1280x1024
636
    mov edx,_m1280x1024
652
    add edx,ecx
637
    add edx,ecx
653
    xor eax,eax
638
    xor eax,eax
654
    mov al,4
639
    mov al,4
655
    mov esi,9
640
    mov esi,9
656
    mov ebx,284*65536+40
641
    mov ebx,284*65536+40
657
    mov ecx,00ff0000h
642
    mov ecx,00ff0000h
658
    int 40h
643
    int 40h
659
    pop eax
644
    pop eax
660
    cmp ah,0
645
    cmp ah,0
661
    jz pcv_loc_00
646
    jz pcv_loc_00
662
    push esi
647
    push esi
663
    push edx
648
    push edx
664
    push ecx
649
    push ecx
665
    push eax
650
    push eax
666
    xor eax,eax
651
    xor eax,eax
667
    mov al,13
652
    mov al,13
668
    mov ebx,344*65536+18
653
    mov ebx,344*65536+18
669
    mov ecx,40*65536+10
654
    mov ecx,40*65536+10
670
    mov edx,000020C0h
655
    mov edx,000020C0h
671
    int 40h
656
    int 40h
672
    pop eax
657
    pop eax
673
    push eax
658
    push eax
674
    mov bx,ax
659
    mov bx,ax
675
    xor edx,edx
660
    xor edx,edx
676
    mov esi,_m1
661
    mov esi,_m1
677
    mov al,bl
662
    mov al,bl
678
    dec al
663
    dec al
679
    xor ah,ah
664
    xor ah,ah
680
    mov cx,10
665
    mov cx,10
681
    mul cx
666
    mul cx
682
    xor ecx,ecx
667
    xor ecx,ecx
683
    mov cx,ax
668
    mov cx,ax
684
    xor ax,ax
669
    xor ax,ax
685
    mov al,bh
670
    mov al,bh
686
    dec al
671
    dec al
687
    shl ax,1
672
    shl ax,1
688
    add cx,ax
673
    add cx,ax
689
    add esi,ecx
674
    add esi,ecx
690
    lodsw
675
    lodsw
691
    xor ecx,ecx
676
    xor ecx,ecx
692
    mov cx,ax
677
    mov cx,ax
693
    xor ebx,ebx
678
    xor ebx,ebx
694
    mov bl,3
679
    mov bl,3
695
    shl ebx,16
680
    shl ebx,16
696
    mov edx,344*65536+40
681
    mov edx,344*65536+40
697
    xor eax,eax
682
    xor eax,eax
698
    mov al,47
683
    mov al,47
699
    mov esi,00ff0000h
684
    mov esi,00ff0000h
700
    int 40h
685
    int 40h
701
    pop eax
686
    pop eax
702
    pop ecx
687
    pop ecx
703
    pop edx
688
    pop edx
704
    pop esi
689
    pop esi
705
 pcv_loc_00:
690
 pcv_loc_00:
706
     retn
691
     retn
707
   
692
   
708
print_all_herz:
693
print_all_herz:
709
        push esi
694
        push esi
710
        push edi
695
        push edi
711
        push eax
696
        push eax
712
        push ebx
697
        push ebx
713
        push ecx
698
        push ecx
714
        push edx
699
        push edx
715
        cld
700
        cld
716
        mov esi,_m1
701
        mov esi,_m1
717
        mov ebx,(10+36+26)*65536+86
702
        mov ebx,(10+36+26)*65536+86
718
        mov edx,66*65536
703
        mov edx,66*65536
719
        xor ecx,ecx
704
        xor ecx,ecx
720
        mov cl,4
705
        mov cl,4
721
pah_loc_00:
706
pah_loc_00:
722
        push ecx
707
        push ecx
723
        push edx
708
        push edx
724
        push ebx
709
        push ebx
725
        mov cl,5
710
        mov cl,5
726
        xor edx,edx
711
        xor edx,edx
727
        mov dl,12
712
        mov dl,12
728
pah_loc_01:
713
pah_loc_01:
729
        lodsw
714
        lodsw
730
        cmp ax,00h
715
        cmp ax,00h
731
        jnz pah_loc_02
716
        jnz pah_loc_02
732
        call print_noherz
717
        call print_noherz
733
        jmp pah_loc_03
718
        jmp pah_loc_03
734
pah_loc_02:
719
pah_loc_02:
735
        call print_herz
720
        call print_herz
736
pah_loc_03:
721
pah_loc_03:
737
        add ebx,edx
722
        add ebx,edx
738
        loop pah_loc_01
723
        loop pah_loc_01
739
        pop ebx
724
        pop ebx
740
        pop edx
725
        pop edx
741
        add ebx,edx
726
        add ebx,edx
742
        pop ecx
727
        pop ecx
743
        loop pah_loc_00
728
        loop pah_loc_00
744
        pop edx
729
        pop edx
745
        pop ecx
730
        pop ecx
746
        pop ebx
731
        pop ebx
747
        pop eax
732
        pop eax
748
        pop edi
733
        pop edi
749
        pop esi
734
        pop esi
750
        retn
735
        retn
751
   
736
   
752
; IN: ebx=X*65536+Y - coordinate
737
; IN: ebx=X*65536+Y - coordinate
753
print_noherz:
738
print_noherz:
754
        push eax
739
        push eax
755
        push ebx
740
        push ebx
756
        push ecx
741
        push ecx
757
        push edx
742
        push edx
758
        push esi
743
        push esi
759
        xor eax,eax
744
        xor eax,eax
760
        mov al,4
745
        mov al,4
761
        mov ecx,00FFFFFFh
746
        mov ecx,00FFFFFFh
762
        mov edx,noherz
747
        mov edx,noherz
763
        xor esi,esi
748
        xor esi,esi
764
        mov si,3
749
        mov si,3
765
        int 40h
750
        int 40h
766
        pop esi
751
        pop esi
767
        pop edx
752
        pop edx
768
        pop ecx
753
        pop ecx
769
        pop ebx
754
        pop ebx
770
        pop eax
755
        pop eax
771
        retn
756
        retn
772
   
757
   
773
; IN: eax=numer_of_herz
758
; IN: eax=numer_of_herz
774
;     ebx=X*65536+Y
759
;     ebx=X*65536+Y
775
print_herz:
760
print_herz:
776
        push eax
761
        push eax
777
        push ebx
762
        push ebx
778
        push ecx
763
        push ecx
779
        push edx
764
        push edx
780
        push esi
765
        push esi
781
        mov edx,ebx
766
        mov edx,ebx
782
        xor ebx,ebx
767
        xor ebx,ebx
783
        mov bl,3
768
        mov bl,3
784
        shl ebx,16
769
        shl ebx,16
785
        mov ecx,eax
770
        mov ecx,eax
786
        mov esi,00FFFFFFh
771
        mov esi,00FFFFFFh
787
        xor eax,eax
772
        xor eax,eax
788
        mov al,47
773
        mov al,47
789
        int 40h
774
        int 40h
790
        pop esi
775
        pop esi
791
        pop edx
776
        pop edx
792
        pop ecx
777
        pop ecx
793
        pop ebx
778
        pop ebx
794
        pop eax
779
        pop eax
795
        retn
780
        retn
796
   
781
   
797
get_pixelclock:
782
get_pixelclock:
798
        retn
783
        retn
799
   
784
   
800
 ; light version of function
785
 ; light version of function
801
calc_refrate:
786
calc_refrate:
802
        retn
787
        retn
803
   
788
   
804
rect_select:
789
rect_select:
805
        mov ax,[vmselect]
790
        mov ax,[vmselect]
806
;     mov [ftr_ebx],eax
791
;     mov [ftr_ebx],eax
807
        cmp ax,00h
792
        cmp ax,00h
808
        je rs_loc_00
793
        je rs_loc_00
809
        cmp ah,0
794
        cmp ah,0
810
        jne rs_loc_01
795
        jne rs_loc_01
811
        dec al
796
        dec al
812
        mov cx,66
797
        mov cx,66
813
        mul cx
798
        mul cx
814
        add ax,46
799
        add ax,46
815
        mov bx,ax
800
        mov bx,ax
816
        shl ebx,16
801
        shl ebx,16
817
        add ax,66
802
        add ax,66
818
        mov bx,ax
803
        mov bx,ax
819
        mov ecx,60*65536+144
804
        mov ecx,60*65536+144
820
        mov edx,00ff0000h
805
        mov edx,00ff0000h
821
        call draw_rect
806
        call draw_rect
822
        retn
807
        retn
823
rs_loc_01:
808
rs_loc_01:
824
        push ax
809
        push ax
825
        xor ah,ah
810
        xor ah,ah
826
        dec al
811
        dec al
827
        xor ebx,ebx
812
        xor ebx,ebx
828
        mov bx,66
813
        mov bx,66
829
        mul bx
814
        mul bx
830
        add ax,46
815
        add ax,46
831
        mov bx,ax
816
        mov bx,ax
832
        shl ebx,16
817
        shl ebx,16
833
        add ax,66
818
        add ax,66
834
        mov bx,ax
819
        mov bx,ax
835
        pop ax
820
        pop ax
836
        xchg ah,al
821
        xchg ah,al
837
        xor ah,ah
822
        xor ah,ah
838
        dec al
823
        dec al
839
        xor ecx,ecx
824
        xor ecx,ecx
840
        mov cx,12
825
        mov cx,12
841
        mul cx
826
        mul cx
842
        add ax,84
827
        add ax,84
843
        mov cx,ax
828
        mov cx,ax
844
        shl ecx,16
829
        shl ecx,16
845
        add ax,12
830
        add ax,12
846
        mov cx,ax
831
        mov cx,ax
847
        mov edx,00ff0000h
832
        mov edx,00ff0000h
848
        call draw_rect
833
        call draw_rect
849
rs_loc_00:
834
rs_loc_00:
850
        retn
835
        retn
851
   
-
 
852
print_my_title:
-
 
853
        pusha
-
 
854
        xor eax,eax
-
 
855
        mov ecx,eax
-
 
856
        mov cl,labellen-labelt
-
 
857
        mov al,4
-
 
858
        mov edx,labelt
-
 
859
        mov ebx,8*65536+8
-
 
860
        mov edi,00ff0000h
-
 
861
        xor esi,esi
-
 
862
        inc esi
-
 
863
pmt_loc_00:
-
 
864
        push ecx
-
 
865
        mov ecx,edi
-
 
866
        int 40h
-
 
867
        inc edx
-
 
868
        sub edi,4*65536
-
 
869
        add edi,4*256
-
 
870
        add ebx,6*65536
-
 
871
        pop ecx
-
 
872
        loop pmt_loc_00
-
 
873
        popa
-
 
874
        retn
-
 
875
   
-
 
876
   
836
   
877
draw_face:
837
draw_face:
878
        call draw_table
838
        call draw_table
879
;
839
;
880
;
840
;
881
        mov ebx,320*65536+390
841
        mov ebx,320*65536+390
882
        mov ecx,66*65536+144
842
        mov ecx,66*65536+144
883
        mov edx,0000FF00h
843
        mov edx,0000FF00h
884
        call draw_rect
844
        call draw_rect
885
        mov ebx,10*65536+390
845
        mov ebx,10*65536+390
886
        mov ecx,27*65536+55
846
        mov ecx,27*65536+55
887
        call draw_rect
847
        call draw_rect
888
        add ebx,2*65536
848
        add ebx,2*65536
889
        sub bx,2
849
        sub bx,2
890
        add ecx,2*65536
850
        add ecx,2*65536
891
        sub cx,2
851
        sub cx,2
892
        call draw_rect
852
        call draw_rect
893
        mov ebx,10*65536+390
853
        mov ebx,10*65536+390
894
        mov ecx,155*65536+193
854
        mov ecx,155*65536+193
895
        call draw_rect
855
        call draw_rect
896
        add ebx,2*65536
856
        add ebx,2*65536
897
        sub bx,2
857
        sub bx,2
898
        add ecx,2*65536
858
        add ecx,2*65536
899
        sub cx,2
859
        sub cx,2
900
        call draw_rect
860
        call draw_rect
901
        xor eax,eax
861
        xor eax,eax
902
        mov al,13
862
        mov al,13
903
        mov ebx,182*65536+36
863
        mov ebx,182*65536+36
904
        mov ecx,26*65536+5
864
        mov ecx,26*65536+5
905
        mov edx,000020C0h
865
        mov edx,000020C0h
906
        int 40h
866
        int 40h
907
        mov ebx,173*65536+54
867
        mov ebx,173*65536+54
908
        mov ecx,153*65536+7
868
        mov ecx,153*65536+7
909
        int 40h
869
        int 40h
910
        mov ebx,337*65536+36
870
        mov ebx,337*65536+36
911
        mov ecx,62*65536+10
871
        mov ecx,62*65536+10
912
        int 40h
872
        int 40h
913
        mov al,4
873
        mov al,4
914
        shr ecx,16
874
        shr ecx,16
915
        mov bx,cx
875
        mov bx,cx
916
        add ebx,3*65536
876
        add ebx,3*65536
917
        mov ecx,00FF0000h
877
        mov ecx,00FF0000h
918
        mov edx,width
878
        mov edx,width
919
        mov esi,5
879
        mov esi,5
920
        int 40h
880
        int 40h
921
        xor ecx,ecx
881
        xor ecx,ecx
922
        add edx,5
882
        add edx,5
923
        xor esi,esi
883
        xor esi,esi
924
        inc esi
884
        inc esi
925
        mov ebx,335*65536+104
885
        mov ebx,335*65536+104
926
        int 40h
886
        int 40h
927
        add ebx,36*65536
887
        add ebx,36*65536
928
        inc edx
888
        inc edx
929
        int 40h
889
        int 40h
930
        mov edx,tmode
890
        mov edx,tmode
931
        mov ecx,00FF0000h
891
        mov ecx,00FF0000h
932
        mov ebx,182*65536+24
892
        mov ebx,182*65536+24
933
        mov esi,6
893
        mov esi,6
934
        int 40h
894
        int 40h
935
        mov edx,actions
895
        mov edx,actions
936
        mov ebx,173*65536+152
896
        mov ebx,173*65536+152
937
        mov esi,9
897
        mov esi,9
938
        int 40h
898
        int 40h
939
        xor ecx,ecx
899
        xor ecx,ecx
940
        mov edx,button1
900
        mov edx,button1
941
        mov ebx,59*65536+174
901
        mov ebx,59*65536+174
942
        mov esi,2
902
        mov esi,2
943
        int 40h
903
        int 40h
944
        add edx,esi
904
        add edx,esi
945
        mov esi,6
905
        mov esi,6
946
        add ebx,78*65536
906
        add ebx,78*65536
947
        int 40h
907
        int 40h
948
        add edx,esi
908
        add edx,esi
949
        add ebx,90*65536
909
        add ebx,90*65536
950
        int 40h
910
        int 40h
951
        add edx,esi
911
        add edx,esi
952
        mov esi,7
912
        mov esi,7
953
        add ebx,87*65536
913
        add ebx,87*65536
954
        int 40h
914
        int 40h
955
        call rect_select
915
        call rect_select
956
;        call debug_ftr
916
;        call debug_ftr
957
        call print_cur_vm
917
        call print_cur_vm
958
        call print_all_herz
918
        call print_all_herz
959
        retn
919
        retn
960
   
920
   
961
warning_info:
921
warning_info:
962
        call warning_window
922
        call warning_window
963
        call warning_loop
923
        call warning_loop
964
        retn
924
        retn
965
   
925
   
966
warning_window:
926
warning_window:
967
        mov  eax,12      ; function 12:tell os about windowdraw
927
        mov  eax,12      ; function 12:tell os about windowdraw
968
        mov  ebx,1      ; 1, start of draw
928
        mov  ebx,1      ; 1, start of draw
969
        int  0x40
929
        int  0x40
970
   ; DRAW WARNING WINDOW
930
   ; DRAW WARNING WINDOW
971
        mov  eax,0      ; function 0 : define and draw window
931
        xor  eax,eax      ; function 0 : define and draw window
972
;        mov  ebx,100*65536+400    ; [x start] *65536 + [x size]
-
 
973
        mov ebx,[oldX]
932
        mov ebx,[oldX]
974
        shr ebx,1
933
        shr ebx,1
975
        sub ebx,200
934
        sub ebx,200
976
        shl ebx,16
935
        shl ebx,16
977
        mov bx,400
936
        mov bx,400
978
;        mov  ecx,100*65536+200    ; [y start] *65536 + [y size]
937
;        mov  ecx,100*65536+200    ; [y start] *65536 + [y size]
979
        mov ecx,[oldY]
938
        mov ecx,[oldY]
980
        shr ecx,1
939
        shr ecx,1
981
        sub ecx,100
940
        sub ecx,100
982
        shl ecx,16
941
        shl ecx,16
983
        mov cx,200
942
        mov cx,200
984
        mov  edx,0x02808080     ; color of work area RRGGBB,8->color glide
943
        mov  edx,0x13808080     ; color of work area RRGGBB,8->color glide
985
        mov  esi,0x40300010     ; color of grab bar RRGGBB,8->color glide
-
 
986
        mov  edi,0x00ff0000     ; color of frames RRGGBB
-
 
987
        int  0x40
944
        mov  edi,header
988
   ; WARNING WINDOW LABEL
-
 
989
        call print_my_title
-
 
990
   ; CLOSE BUTTON
-
 
991
        mov  eax,8      ; function 8 : define and draw button
-
 
992
        mov  ebx,(200-36)*65536+72    ; [x start] *65536 + [x size]
-
 
993
        mov  ecx,(160-9)*65536+18     ; [y start] *65536 + [y size]
-
 
994
        mov  edx,1      ; button id
-
 
995
        mov  esi,0x00800010     ; button color RRGGBB
-
 
996
        int  0x40
945
        int  0x40
-
 
946
 
997
   ; WARNING TEXT
947
   ; WARNING TEXT
998
        mov  eax,4      ; function 4 : write text to window
948
        mov  eax,4      ; function 4 : write text to window
999
            mov  ebx,(200-(len_warn00/2)*6)*65536+60    ; [x start] *65536 + [y
949
        mov  ebx,(200-(len_warn00/2)*6)*65536+60    ; [x start] *65536 + [y
1000
   ;]
950
   ;]
1001
        mov  ecx,0xf0ff0000     ; color of text RRGGBB
951
        mov  ecx,0xf0ff0000     ; color of text RRGGBB
1002
        mov  edx,warn00        ; pointer to text beginning
952
        mov  edx,warn00        ; pointer to text beginning
1003
        mov  esi,len_warn00     ; text length
953
        mov  esi,len_warn00     ; text length
1004
;        int  0x40
954
;        int  0x40
1005
;        inc  ebx
955
;        inc  ebx
1006
        int  40h
956
        int  40h
1007
        add  ebx,1*65536
957
        add  ebx,1*65536
1008
        int  40h
958
        int  40h
1009
        mov  ebx,(200-(len_warn01/2)*6)*65536+100
959
        mov  ebx,(200-(len_warn01/2)*6)*65536+100
1010
        mov  edx,warn01
960
        mov  edx,warn01
1011
        mov  esi,len_warn01
961
        mov  esi,len_warn01
1012
        int  40h
962
        int  40h
1013
        mov  edx,button1
963
        mov  edx,button1
1014
        add  ecx,0ffffh
964
        add  ecx,0ffffh
1015
        mov  ebx,(200-6)*65536+(160-4)
965
        mov  ebx,(200-6)*65536+(160-4)
1016
        mov  esi,2
966
        mov  esi,2
1017
        int 40h
967
        int 40h
1018
        mov  eax,12      ; function 12:tell os about windowdraw
968
        mov  eax,12      ; function 12:tell os about windowdraw
1019
        mov  ebx,2      ; 2, end of draw
969
        mov  ebx,2      ; 2, end of draw
1020
        int  0x40
970
        int  0x40
1021
        retn
971
        retn
1022
   
972
   
1023
warning_loop:
973
warning_loop:
1024
        mov  eax,5
974
        mov  eax,5
1025
        mov ebx,13
975
        mov ebx,13
1026
        int  0x40
976
        int  0x40
1027
        mov eax,11
977
        mov eax,11
1028
        int 40h
978
        int 40h
1029
        cmp  eax,1      ; redraw request ?
979
        cmp  eax,1      ; redraw request ?
1030
        je  warning_red
980
        je  warning_red
1031
        cmp  eax,2      ; key in buffer ?
981
        cmp  eax,2      ; key in buffer ?
1032
        je  warning_key
982
        je  warning_key
1033
        cmp  eax,3      ; button in buffer ?
983
        cmp  eax,3      ; button in buffer ?
1034
        je  warning_button
984
        je  warning_button
1035
        mov  eax,4
985
        mov  eax,4
1036
        mov  ebx,(200-(len_warn01/2)*6)*65536+100
986
        mov  ebx,(200-(len_warn01/2)*6)*65536+100
1037
        mov  ecx,[blinkcol]
987
        mov  ecx,[blinkcol]
1038
        sub cl,12
988
        sub cl,12
1039
        dec cl
989
        dec cl
1040
        dec cl
990
        dec cl
1041
        dec cl
991
        dec cl
1042
        dec cl
992
        dec cl
1043
        mov [blinkcol],ecx
993
        mov [blinkcol],ecx
1044
        mov ch,0f0h
994
        mov ch,0f0h
1045
        shl ecx,16
995
        shl ecx,16
1046
        mov  edx,warn01
996
        mov  edx,warn01
1047
        mov  esi,len_warn01
997
        mov  esi,len_warn01
1048
        int  40h
998
        int  40h
1049
        sub ebx,1*65536
999
        sub ebx,1*65536
1050
        int 40h
1000
        int 40h
1051
        jmp  warning_loop
1001
        jmp  warning_loop
1052
  warning_red:      ; redraw
1002
  warning_red:      ; redraw
1053
        call warning_window
1003
        call warning_window
1054
        jmp  warning_loop
1004
        jmp  warning_loop
1055
  warning_key:      ; key
1005
  warning_key:      ; key
1056
        mov  eax,2      ;  read key
1006
        mov  eax,2      ;  read key
1057
        int  0x40
1007
        int  0x40
1058
        cmp ah,01h
1008
        cmp ah,01h
1059
        jne warning_loop
1009
        jne warning_loop
1060
        xor eax,eax
1010
        xor eax,eax
1061
        dec eax         ; Terminate application
1011
        dec eax         ; Terminate application
1062
        int 40h
1012
        int 40h
1063
        jmp warning_loop
1013
        jmp warning_loop
1064
  warning_button:   ; button
1014
  warning_button:   ; button
1065
        mov  eax,17     ; get id
1015
        mov  eax,17     ; get id
1066
        int  0x40
1016
        int  0x40
1067
        cmp  ah,1   ; button id=1 ?
1017
        cmp  ah,1   ; button id=1 ?
1068
        jne  warning_loop
1018
        jne  warning_loop
1069
        xor eax,eax
1019
        xor eax,eax
1070
        dec eax         ; close this program
1020
        dec eax         ; close this program
1071
        int  0x40
1021
        int  0x40
1072
        jmp warning_loop
1022
        jmp warning_loop
1073
        retn
1023
        retn
1074
   
1024
   
1075
;------------DATA AREA---------------
1025
;------------DATA AREA---------------
1076
   
1026
   
1077
oldX       dd ?
1027
oldX       dd ?
1078
oldY       dd ?
1028
oldY       dd ?
1079
initvm     dd ?
1029
initvm     dd ?
1080
currvm     dd 0
1030
currvm     dd 0
1081
oldvm      dd 0
1031
oldvm      dd 0
1082
refrate    dd 0
1032
refrate    dd 0
1083
initrr     dd 0
1033
initrr     dd 0
1084
mypid      dd ?
1034
mypid      dd ?
1085
mypno      dw ?
1035
mypno      dw ?
1086
totp       dd ?
1036
totp       dd ?
1087
vmselect   dw 0
1037
vmselect   dw 0
1088
ftr_eax    dd ?
1038
ftr_eax    dd ?
1089
ftr_ebx    dd ?
1039
ftr_ebx    dd ?
1090
blinkcol   dd 0ffh
1040
blinkcol   dd 0ffh
1091
   
1041
   
1092
;  db 0,0,0,0,0,0,0,0
1042
;  db 0,0,0,0,0,0,0,0
1093
;_m1        dw 0,0,0,0,0
1043
;_m1        dw 0,0,0,0,0
1094
;_m2        dw 0,0,0,0,0
1044
;_m2        dw 0,0,0,0,0
1095
;_m3        dw 0,0,0,0,0
1045
;_m3        dw 0,0,0,0,0
1096
;_m4        dw 0,0,0,0,0
1046
;_m4        dw 0,0,0,0,0
1097
   
-
 
1098
labelt:
1047
   
1099
     db   'Vertical Refresh Rate, ver.2.0,  Copileft 2003 ;) TRANS'
-
 
1100
labellen:
1048
header     db   'Vertical Refresh Rate v2.0 (C) 2003 TRANS',0
1101
   
1049
   
1102
_m1280x1024 db '1280x1024'
1050
_m1280x1024 db '1280x1024'
1103
_m1024x768  db '1024x768 '
1051
_m1024x768  db '1024x768 '
1104
_m800x600   db ' 800x600 '
1052
_m800x600   db ' 800x600 '
1105
_m640x480   db ' 640x480 '
1053
_m640x480   db ' 640x480 '
1106
_mk         db 'Key1Key2'
1054
_mk         db 'Key1Key2'
1107
   
1055
   
1108
curmode     db 'Current mode: '
1056
curmode     db 'Current mode: '
1109
            db '    x    x   Hz'
1057
            db '    x    x   Hz'
1110
cmlen=$-curmode
1058
cmlen=$-curmode
1111
selmode     db ' Select mode: '
1059
selmode     db ' Select mode: '
1112
selcans     db '----x----x---Hz'
1060
selcans     db '----x----x---Hz'
1113
noherz      db '---'
1061
noherz      db '---'
1114
width       db 'Width',11h,10h
1062
width       db 'Width',11h,10h
1115
tmode       db ' Mode '
1063
tmode       db ' Mode '
1116
actions     db ' Actions '
1064
actions     db ' Actions '
1117
button1     db 'Ok'      ;len=2
1065
button1     db 'Ok'      ;len=2
1118
button2     db 'Cancel'  ;len=6
1066
button2     db 'Cancel'  ;len=6
1119
button3     db 'Return'  ;len=6
1067
button3     db 'Return'  ;len=6
1120
button4     db 'Default' ;len=7
1068
button4     db 'Default' ;len=7
1121
   
1069
   
1122
strt  db 'LAUNCHER    '
1070
strt  db 'LAUNCHER    '
1123
   
1071
   
1124
warn00      db ' W  A  R  N  I  N  G  ! '
1072
warn00      db ' W  A  R  N  I  N  G  ! '
1125
len_warn00=$-warn00
1073
len_warn00=$-warn00
1126
warn01      db 'V i d e o  D r i v e r  N O T  I n s t a l l e d'
1074
warn01      db 'V i d e o  D r i v e r  N O T  I n s t a l l e d'
1127
len_warn01=$-warn01
1075
len_warn01=$-warn01
1128
   
1076
   
1129
   
1077
   
1130
drvinfo:   ; 512 bytes driver info area
1078
drvinfo:   ; 512 bytes driver info area
1131
; +0   - Full driver name
1079
; +0   - Full driver name
1132
; +32  - Driver version
1080
; +32  - Driver version
1133
; +64  - Word List of support video modes (max 32 positions)
1081
; +64  - Word List of support video modes (max 32 positions)
1134
; +128 - 5 words list of support vertical rate to each present mode
1082
; +128 - 5 words list of support vertical rate to each present mode
1135
      org $+32
1083
      org $+32
1136
drvver:
1084
drvver:
1137
      org $+32
1085
      org $+32
1138
vidmode:
1086
vidmode:
1139
      org $+64
1087
      org $+64
1140
_m1:
1088
_m1:
1141
      org drvinfo+200h
1089
      org drvinfo+200h
1142
   
1090
   
1143
buffer:
1091
buffer:
1144
I_END:
1092
I_END: