Subversion Repositories Kolibri OS

Rev

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

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