]> 4ch.mooo.com Git - 16.git/blob - 16/ADT2PLAY/TXTSCRIO.PAS
d187824db47fe166ac5471bf88b3505a0d894b72
[16.git] / 16 / ADT2PLAY / TXTSCRIO.PAS
1 unit TxtScrIO;\r
2 interface\r
3 \r
4 const\r
5   Black   = $00;  DGray    = $08;\r
6   Blue    = $01;  LBlue    = $09;\r
7   Green   = $02;  LGreen   = $0a;\r
8   Cyan    = $03;  LCyan    = $0b;\r
9   Red     = $04;  LRed     = $0c;\r
10   Magenta = $05;  LMagenta = $0d;\r
11   Brown   = $06;  Yellow   = $0e;\r
12   LGray   = $07;  White    = $0f;\r
13   Blink   = $80;\r
14 \r
15 procedure ShowStr(var dest; x,y: Byte; str: String; attr: Byte);\r
16 procedure ShowVStr(var dest; x,y: Byte; str: String; attr: Byte);\r
17 procedure ShowCStr(var dest; x,y: Byte; str: String; atr1,atr2: Byte);\r
18 procedure ShowVCStr(var dest; x,y: Byte; str: String; atr1,atr2: Byte);\r
19 procedure ShowC3Str(var dest; x,y: Byte; str: String; atr1,atr2,atr3: Byte);\r
20 procedure ShowVC3Str(var dest; x,y: Byte; str: String; atr1,atr2,atr3: Byte);\r
21 function CStrLen(str: String): Byte;\r
22 function AbsPos(x,y: Byte): Word;\r
23 function Color(fgnd,bgnd: Byte): Byte;\r
24 procedure CleanScreen(var dest);\r
25 procedure initialize;\r
26 \r
27 type\r
28   tCUSTOM_VIDEO_MODE = 0..52;\r
29 \r
30 procedure SetCustomVideoMode(vmode: tCUSTOM_VIDEO_MODE);\r
31 \r
32 type\r
33   tFRAME_SETTING = Record\r
34                      shadow_enabled,\r
35                      wide_range_type,\r
36                      zooming_enabled,\r
37                      update_area: Boolean;\r
38                    end;\r
39 const\r
40   fr_setting: tFRAME_SETTING =\r
41     (shadow_enabled:  TRUE;\r
42      wide_range_type: FALSE;\r
43      zooming_enabled: FALSE;\r
44      update_area:     TRUE);\r
45 \r
46 procedure Frame(var dest; x1,y1,x2,y2,atr1: Byte;\r
47                           title: String; atr2: Byte; border: String);\r
48 \r
49 const\r
50   solid1 = '        ';\r
51   solid2 = 'ÛßÛÛÛÛÜÛ';\r
52   single = 'ÚÄ¿³³ÀÄÙ';\r
53   double = 'ÉÍ»ººÈͼ';\r
54   dbside = 'ÖÄ·ººÓĽ';\r
55   dbtop  = 'Õ͸³³Ô;';\r
56 \r
57 var\r
58   MaxLn,MaxCol,\r
59   work_maxln,work_maxcol: Byte;\r
60   area_x1,area_y1,area_x2,area_y2: Byte;\r
61   v_mode: Byte;\r
62   DispPg: Byte;\r
63   v_seg,v_ofs: Longint;\r
64   CheckSnow: Boolean;\r
65 \r
66 function iEGA:  Boolean;\r
67 function iVGA:  Boolean;\r
68 function iPS2:  Boolean;\r
69 function iMDA:  Boolean;\r
70 function iCGA:  Boolean;\r
71 function iMCGA: Boolean;\r
72 \r
73 function  WhereX: Byte;\r
74 function  WhereY: Byte;\r
75 procedure GotoXY(x,y: Byte);\r
76 procedure ResetMode;\r
77 \r
78 function  GetCursor: Longint;\r
79 procedure SetCursor(cursor: Longint);\r
80 procedure ThinCursor;\r
81 procedure WideCursor;\r
82 procedure HideCursor;\r
83 function  GetCursorShape: Word;\r
84 procedure SetCursorShape(shape: Word);\r
85 \r
86 type\r
87   tVIDEO_STATE = Record\r
88                    font: Byte;\r
89                    cursor: Longint;\r
90                    MaxLn,MaxCol,v_mode: Byte;\r
91                    v_ofs: Longint;\r
92                    screen: array[0..PRED(8192)] of Byte;\r
93                    data: array[0..PRED(4096)] of Byte;\r
94                  end;\r
95 \r
96 procedure GetVideoState(var data: tVIDEO_STATE);\r
97 procedure SetVideoState(var data: tVIDEO_STATE; restore_screen: Boolean);\r
98 procedure GetRGBitem(color: Byte; var red,green,blue: Byte);\r
99 procedure SetRGBitem(color: Byte; red,green,blue: Byte);\r
100 procedure WaitRetrace;\r
101 procedure GetPalette(var pal; first,last: Word);\r
102 procedure SetPalette(var pal; first,last: Word);\r
103 \r
104 type\r
105   tFADE  = (first,fadeOut,fadeIn);\r
106   tDELAY = (fast,delayed);\r
107 \r
108 type\r
109   tFADE_BUF = Record\r
110                 action: tFADE;\r
111                 pal0: array[0..255] of Record r,g,b: Byte end;\r
112                 pal1: array[0..255] of Record r,g,b: Byte end;\r
113               end;\r
114 \r
115 const\r
116   fade_speed: Byte = 63;\r
117 \r
118 procedure VgaFade(var data: tFADE_BUF; fade: tFADE; delay: tDELAY);\r
119 procedure RefreshEnable;\r
120 procedure RefreshDisable;\r
121 procedure Split2Static;\r
122 procedure SplitScr(line: Integer);\r
123 procedure SetSize(columns,lines: Integer);\r
124 procedure SetTextDisp(x,y: Integer);\r
125 \r
126 implementation\r
127 uses DPMI;\r
128 \r
129 var\r
130   absolute_pos: Word;\r
131 \r
132 procedure DupChar; assembler;\r
133 asm\r
134         pushad                           {  IN/ al     -column        }\r
135         xor     ebx,ebx                  {      ah     -line          }\r
136         xchg    ax,bx                    {      dl     -character     }\r
137         xor     eax,eax                  {      dh     -attribute     }\r
138         xchg    ax,bx                    {      ecx    -count         }\r
139         mov     bl,al                    {      edi    -ptr. to write }\r
140         mov     al,MaxCol\r
141         mul     ah\r
142         add     ax,bx\r
143         mov     bl,MaxCol\r
144         sub     ax,bx\r
145         dec     ax\r
146         shl     ax,1\r
147         jecxz   @@1\r
148         add     edi,eax\r
149         xchg    ax,dx\r
150         rep     stosw\r
151         xchg    ax,dx\r
152 @@1:    mov     absolute_pos,ax\r
153         popad\r
154 end;\r
155 \r
156 procedure ShowStr(var dest; x,y: Byte; str: String; attr: Byte); assembler;\r
157 asm\r
158         mov     edi,[dest]\r
159         mov     esi,[str]\r
160         mov     al,x\r
161         mov     ah,y\r
162         xor     ecx,ecx\r
163         call    DupChar\r
164         xor     edx,edx\r
165         mov     dx,absolute_pos\r
166         lodsb\r
167         mov     cl,al\r
168         jecxz   @@2\r
169         add     edi,edx\r
170         mov     ah,attr\r
171 @@1:    lodsb\r
172         stosw\r
173         loop    @@1\r
174 @@2:\r
175 end;\r
176 \r
177 procedure ShowVStr(var dest; x,y: Byte; str: String; attr: Byte); assembler;\r
178 asm\r
179         mov     al,MaxCol\r
180         dec     al\r
181         xor     ah,ah\r
182         xor     ebx,ebx\r
183         mov     bl,2\r
184         mul     bl\r
185         mov     bx,ax\r
186         mov     edi,[dest]\r
187         mov     esi,[str]\r
188         mov     al,x\r
189         mov     ah,y\r
190         xor     ecx,ecx\r
191         call    DupChar\r
192         xor     edx,edx\r
193         mov     dx,absolute_pos\r
194         lodsb\r
195         mov     cl,al\r
196         jecxz   @@2\r
197         add     edi,edx\r
198         mov     ah,attr\r
199 @@1:    lodsb\r
200         stosw\r
201         add     edi,ebx\r
202         loop    @@1\r
203 @@2:\r
204 end;\r
205 \r
206 procedure ShowCStr(var dest; x,y: Byte; str: String; atr1,atr2: Byte); assembler;\r
207 asm\r
208         mov     esi,[str]\r
209         mov     edi,[dest]\r
210         lodsb\r
211         xor     ecx,ecx\r
212         mov     cl,al\r
213         jecxz   @@3\r
214         push    ecx\r
215         mov     al,x\r
216         mov     ah,y\r
217         xor     ecx,ecx\r
218         call    DupChar\r
219         xor     edx,edx\r
220         mov     dx,absolute_pos\r
221         pop     ecx\r
222         add     edi,edx\r
223         mov     ah,atr1\r
224         mov     bh,atr2\r
225 @@1:    lodsb\r
226         cmp     al,'~'\r
227         jz      @@2\r
228         stosw\r
229         loop    @@1\r
230         jmp     @@3\r
231 @@2:    xchg    ah,bh\r
232         loop    @@1\r
233 @@3:\r
234 end;\r
235 \r
236 procedure ShowVCStr(var dest; x,y: Byte; str: String; atr1,atr2: Byte); assembler;\r
237 asm\r
238         mov     al,MaxCol\r
239         dec     al\r
240         xor     ah,ah\r
241         mov     bl,2\r
242         mul     bl\r
243         mov     bx,ax\r
244         mov     esi,[str]\r
245         mov     edi,[dest]\r
246         lodsb\r
247         xor     ecx,ecx\r
248         mov     cl,al\r
249         jecxz   @@3\r
250         push    ecx\r
251         mov     al,x\r
252         mov     ah,y\r
253         xor     ecx,ecx\r
254         call    DupChar\r
255         xor     edx,edx\r
256         mov     dx,absolute_pos\r
257         pop     ecx\r
258         add     edi,edx\r
259         mov     dx,bx\r
260         mov     ah,atr1\r
261         mov     bh,atr2\r
262 @@1:    lodsb\r
263         cmp     al,'~'\r
264         jz      @@2\r
265         stosw\r
266         add     edi,edx\r
267         loop    @@1\r
268         jmp     @@3\r
269 @@2:    xchg    ah,bh\r
270         loop    @@1\r
271 @@3:\r
272 end;\r
273 \r
274 procedure ShowC3Str(var dest; x,y: Byte; str: String; atr1,atr2,atr3: Byte); assembler;\r
275 asm\r
276         mov     esi,[str]\r
277         mov     edi,[dest]\r
278         lodsb\r
279         xor     ecx,ecx\r
280         mov     cl,al\r
281         jecxz   @@3\r
282         push    ecx\r
283         mov     al,x\r
284         mov     ah,y\r
285         xor     ecx,ecx\r
286         call    DupChar\r
287         xor     edx,edx\r
288         mov     dx,absolute_pos\r
289         pop     ecx\r
290         add     edi,edx\r
291         mov     ah,atr1\r
292         mov     bl,atr2\r
293         mov     bh,atr3\r
294 @@1:    lodsb\r
295         cmp     al,'~'\r
296         jz      @@2\r
297         cmp     al,'`'\r
298         jz      @@3\r
299         stosw\r
300         loop    @@1\r
301         jmp     @@4\r
302 @@2:    xchg    ah,bl\r
303         loop    @@1\r
304         jmp     @@4\r
305 @@3:    xchg    ah,bh\r
306         loop    @@1\r
307 @@4:\r
308 end;\r
309 \r
310 procedure ShowVC3Str(var dest; x,y: Byte; str: String; atr1,atr2,atr3: Byte); assembler;\r
311 asm\r
312         mov     al,MaxCol\r
313         dec     al\r
314         xor     ah,ah\r
315         mov     bl,2\r
316         mul     bl\r
317         mov     bx,ax\r
318         mov     esi,[str]\r
319         mov     edi,[dest]\r
320         lodsb\r
321         xor     ecx,ecx\r
322         mov     cl,al\r
323         jecxz   @@4\r
324         push    ecx\r
325         mov     al,x\r
326         mov     ah,y\r
327         xor     ecx,ecx\r
328         call    DupChar\r
329         xor     edx,edx\r
330         mov     dx,absolute_pos\r
331         pop     ecx\r
332         add     edi,edx\r
333         mov     dx,bx\r
334         mov     ah,atr1\r
335         mov     bl,atr2\r
336         mov     bh,atr3\r
337 @@1:    lodsb\r
338         cmp     al,'~'\r
339         jz      @@2\r
340         cmp     al,'`'\r
341         jz      @@3\r
342         stosw\r
343         add     edi,edx\r
344         loop    @@1\r
345         jmp     @@4\r
346 @@2:    xchg    ah,bl\r
347         loop    @@1\r
348         jmp     @@4\r
349 @@3:    xchg    ah,bh\r
350         loop    @@1\r
351 @@4:\r
352 end;\r
353 \r
354 function CStrLen(str: String): Byte; assembler;\r
355 asm\r
356         mov     edi,[str]\r
357         xor     ecx,ecx\r
358         mov     cl,[edi]\r
359         inc     edi\r
360         mov     bx,cx\r
361         jecxz   @@2\r
362         mov     al,'~'\r
363 @@1:    repne   scasb\r
364         jnz     @@2\r
365         dec     bx\r
366         jmp     @@1\r
367 @@2:    mov     ax,bx\r
368 end;\r
369 \r
370 function AbsPos(x,y: Byte): Word; assembler;\r
371 asm\r
372         mov     al,x\r
373         mov     ah,y\r
374         xor     ecx,ecx\r
375         call    DupChar\r
376         mov     ax,absolute_pos\r
377 end;\r
378 \r
379 function Color(fgnd,bgnd: Byte): Byte; assembler;\r
380 asm\r
381         mov     al,bgnd\r
382         xor     ah,ah\r
383         mov     bh,16\r
384         mul     bh\r
385         add     al,fgnd\r
386 end;\r
387 \r
388 procedure CleanScreen(var dest); assembler;\r
389 asm\r
390         mov     edi,[dest]\r
391         mov     al,1\r
392         mov     bh,1\r
393         mov     cl,MaxCol\r
394         xor     ch,ch\r
395 @@1:    mov     ah,bh\r
396         mov     dl,' '\r
397         mov     dh,07h\r
398         call    DupChar\r
399         inc     bh\r
400         cmp     bh,MaxLn\r
401         jle     @@1\r
402 end;\r
403 \r
404 procedure Frame(var dest; x1,y1,x2,y2,atr1: Byte;\r
405                           title: String; atr2: Byte; border: String); assembler;\r
406 var\r
407   xexp1,xexp2,xexp3,yexp1,yexp2: Byte;\r
408   offs: Longint;\r
409 \r
410 asm\r
411         cmp     fr_setting.update_area,1\r
412         jnz     @@0\r
413         mov     al,x1\r
414         mov     area_x1,al\r
415         mov     al,y1\r
416         mov     area_y1,al\r
417         mov     al,x2\r
418         mov     area_x2,al\r
419         mov     al,y2\r
420         mov     area_y2,al\r
421 @@0:    mov     bl,fr_setting.wide_range_type\r
422         mov     bh,fr_setting.shadow_enabled\r
423         mov     esi,[border]\r
424         mov     edi,[dest]\r
425         mov     offs,edi\r
426         cmp     bl,0\r
427         je      @@1\r
428         mov     xexp1,4\r
429         mov     xexp2,-1\r
430         mov     xexp3,7\r
431         mov     yexp1,1\r
432         mov     yexp2,2\r
433         jmp     @@2\r
434 @@1:    mov     xexp1,1\r
435         mov     xexp2,2\r
436         mov     xexp3,1\r
437         mov     yexp1,0\r
438         mov     yexp2,1\r
439         jmp     @@4\r
440 @@2:    mov     al,x1\r
441         sub     al,3\r
442         mov     ah,y1\r
443         dec     ah\r
444         mov     dl,' '\r
445         mov     dh,atr1\r
446         xor     ecx,ecx\r
447         mov     cl,x2\r
448         sub     cl,x1\r
449         add     cl,7\r
450         call    DupChar\r
451         mov     ah,y2\r
452         inc     ah\r
453         call    DupChar\r
454         mov     bl,y1\r
455 @@3:    mov     al,x1\r
456         sub     al,3\r
457         mov     ah,bl\r
458         mov     dl,' '\r
459         mov     ecx,3\r
460         call    DupChar\r
461         mov     al,x2\r
462         inc     al\r
463         mov     dl,' '\r
464         mov     ecx,3\r
465         call    DupChar\r
466         inc     bl\r
467         cmp     bl,y2\r
468         jng     @@3\r
469 @@4:    mov     al,x1\r
470         mov     ah,y1\r
471         mov     dl,[esi+1]\r
472         mov     dh,atr1\r
473         mov     ecx,1\r
474         push    edi\r
475         call    DupChar\r
476         inc     al\r
477         mov     dl,[esi+2]\r
478         mov     dh,atr1\r
479         mov     cl,x2\r
480         sub     cl,x1\r
481         dec     cl\r
482         call    DupChar\r
483         mov     al,x2\r
484         mov     dl,[esi+3]\r
485         mov     dh,atr1\r
486         mov     ecx,1\r
487         call    DupChar\r
488         mov     bl,y1\r
489 @@5:    inc     bl\r
490         mov     al,x1\r
491         mov     ah,bl\r
492         mov     dl,[esi+4]\r
493         mov     dh,atr1\r
494         mov     ecx,1\r
495         call    DupChar\r
496         inc     al\r
497         mov     dl,' '\r
498         mov     dh,atr1\r
499         mov     cl,x2\r
500         sub     cl,x1\r
501         dec     cl\r
502         call    DupChar\r
503         mov     al,x2\r
504         mov     dl,[esi+5]\r
505         mov     dh,atr1\r
506         mov     ecx,1\r
507         call    DupChar\r
508         cmp     bl,y2\r
509         jnge    @@5\r
510         mov     al,x1\r
511         mov     ah,y2\r
512         mov     dl,[esi+6]\r
513         mov     dh,atr1\r
514         mov     ecx,1\r
515         call    DupChar\r
516         inc     al\r
517         mov     dl,[esi+7]\r
518         mov     cl,x2\r
519         sub     cl,x1\r
520         dec     cl\r
521         call    DupChar\r
522         mov     al,x2\r
523         mov     dl,[esi+8]\r
524         mov     dh,atr1\r
525         mov     ecx,1\r
526         call    DupChar\r
527         mov     esi,[title]\r
528         mov     cl,[esi]\r
529         jecxz   @@7\r
530         xor     eax,eax\r
531         mov     al,x2\r
532         sub     al,x1\r
533         sub     al,cl\r
534         mov     bl,2\r
535         div     bl\r
536         add     al,x1\r
537         add     al,ah\r
538         mov     ah,y1\r
539         xor     ecx,ecx\r
540         call    DupChar\r
541         push    eax\r
542         xor     eax,eax\r
543         mov     ax,absolute_pos\r
544         mov     edi,offs\r
545         add     edi,eax\r
546         pop     eax\r
547         lodsb\r
548         mov     cl,al\r
549         mov     ah,atr2\r
550 @@6:    lodsb\r
551         stosw\r
552         loop    @@6\r
553 @@7:    cmp     bh,0\r
554         je      @@11\r
555         mov     bl,y1\r
556         sub     bl,yexp1\r
557 @@8:    inc     bl\r
558         mov     al,x2\r
559         add     al,xexp1\r
560         mov     ah,bl\r
561         xor     ecx,ecx\r
562         call    DupChar\r
563         push    eax\r
564         xor     eax,eax\r
565         mov     ax,absolute_pos\r
566         mov     edi,offs\r
567         add     edi,eax\r
568         pop     eax\r
569         inc     edi\r
570         mov     al,07\r
571         stosb\r
572         cmp     MaxLn,80\r
573         jae     @@9\r
574         inc     edi\r
575         stosb\r
576         cmp     MaxCol,132\r
577         jna     @@9\r
578         inc     edi\r
579         stosb\r
580 @@9:    cmp     bl,y2\r
581         jng     @@8\r
582         mov     al,x1\r
583         add     al,xexp2\r
584         mov     ah,y2\r
585         add     ah,yexp2\r
586         xor     ecx,ecx\r
587         call    DupChar\r
588         push    eax\r
589         xor     eax,eax\r
590         mov     ax,absolute_pos\r
591         mov     edi,offs\r
592         add     edi,eax\r
593         pop     eax\r
594         inc     edi\r
595         mov     al,07\r
596         mov     cl,x2\r
597         sub     cl,x1\r
598         add     cl,xexp3\r
599         cmp     MaxLn,45\r
600         jb      @@10\r
601         dec     cl\r
602 @@10:   stosb\r
603         inc     edi\r
604         loop    @@10\r
605 @@11:\r
606 end;\r
607 \r
608 function iEGA: Boolean; assembler;\r
609 asm\r
610         mov     ax,01200h\r
611         mov     bx,00010h\r
612         mov     cx,0ffffh\r
613         int     10h\r
614         cmp     cx,0ffffh\r
615         jz      @@1\r
616         mov     al,1\r
617         jmp     @@2\r
618 @@1:    xor     al,al\r
619 @@2:\r
620 end;\r
621 \r
622 function iVGA: Boolean; assembler;\r
623 asm\r
624         mov     ax,1a00h\r
625         int     10h\r
626         cmp     al,1ah\r
627         jnz     @@1\r
628         cmp     bl,7\r
629         jb      @@1\r
630         cmp     bl,0ffh\r
631         jnz     @@2\r
632 @@1:    xor     al,al\r
633         jmp     @@3\r
634 @@2:    mov     al,1\r
635 @@3:\r
636 end;\r
637 \r
638 function iPS2: Boolean; assembler;\r
639 asm\r
640         mov     ax,1a00h\r
641         int     10h\r
642         and     al,0ffh\r
643         cmp     al,1ah\r
644         jnz     @@1\r
645         and     bl,0ffh\r
646         cmp     bl,07h\r
647         jb      @@1\r
648         cmp     bl,0ch\r
649         ja      @@1\r
650         cmp     bl,09h\r
651         jz      @@1\r
652         cmp     bl,0ah\r
653         jz      @@1\r
654         mov     al,1\r
655         jmp     @@2\r
656 @@1:    xor     al,al\r
657 @@2:\r
658 end;\r
659 \r
660 function iMDA: Boolean; assembler;\r
661 asm\r
662         cmp     v_mode,07h\r
663         jnz     @@1\r
664         mov     al,1\r
665         jmp     @@2\r
666 @@1:    xor     al,al\r
667 @@2:\r
668 end;\r
669 \r
670 function iCGA: Boolean; assembler;\r
671 asm\r
672         call    iMDA\r
673         cmp     al,0\r
674         jnz     @@1\r
675         call    iEGA\r
676         cmp     al,0\r
677         jnz     @@1\r
678         call    iPS2\r
679         cmp     al,0\r
680         jnz     @@1\r
681         mov     al,1\r
682         jmp     @@2\r
683 @@1:    xor     al,al\r
684 @@2:\r
685 end;\r
686 \r
687 function iMCGA: Boolean; assembler;\r
688 asm\r
689         call    iMDA\r
690         cmp     al,0\r
691         jnz     @@1\r
692         call    iEGA\r
693         cmp     al,0\r
694         jnz     @@1\r
695         call    iPS2\r
696         cmp     al,1\r
697         jnz     @@1\r
698         mov     al,1\r
699         jmp     @@2\r
700 @@1:    xor     al,al\r
701 @@2:\r
702 end;\r
703 \r
704 function WhereX: Byte; assembler;\r
705 asm\r
706         mov     bh,DispPg\r
707         mov     ah,03h\r
708         int     10h\r
709         inc     dl\r
710         mov     al,dl\r
711 end;\r
712 \r
713 function WhereY: Byte; assembler;\r
714 asm\r
715         mov     bh,DispPg\r
716         mov     ah,03h\r
717         int     10h\r
718         inc     dh\r
719         mov     al,dh\r
720 end;\r
721 \r
722 procedure GotoXY(x,y: Byte); assembler;\r
723 asm\r
724         mov     dh,y\r
725         mov     dl,x\r
726         dec     dh\r
727         dec     dl\r
728         mov     bh,DispPg\r
729         mov     ah,02h\r
730         int     10h\r
731 end;\r
732 \r
733 procedure ResetMode; assembler;\r
734 asm\r
735         xor     ah,ah\r
736         mov     al,v_mode\r
737         mov     bh,DispPg\r
738         int     10h\r
739 end;\r
740 \r
741 function GetCursor: Longint; assembler;\r
742 asm\r
743         xor     edx,edx\r
744         mov     bh,DispPg\r
745         mov     ah,03h\r
746         int     10h\r
747         shl     edx,16\r
748         xor     eax,eax\r
749         push    edx\r
750         call    GetCursorShape\r
751         pop     edx\r
752         add     edx,eax\r
753         mov     eax,edx\r
754 end;\r
755 \r
756 \r
757 procedure SetCursor(cursor: Longint); assembler;\r
758 asm\r
759         xor     eax,eax\r
760         mov     ax,word ptr [cursor]\r
761         push    eax\r
762         call    SetCursorShape\r
763         mov     dx,word ptr [cursor+2]\r
764         mov     bh,DispPg\r
765         mov     ah,02h\r
766         int     10h\r
767 end;\r
768 \r
769 procedure ThinCursor; assembler;\r
770 asm\r
771         xor     ecx,ecx\r
772         call    iMDA\r
773         cmp     al,1\r
774         jnz     @@1\r
775         mov     cx,0b0ch\r
776         jmp     @@5\r
777 @@1:    call    iCGA\r
778         cmp     al,1\r
779         jnz     @@2\r
780         mov     cx,0708h\r
781         jmp     @@5\r
782 @@2:    call    iMCGA\r
783         cmp     al,1\r
784         jnz     @@3\r
785         mov     cx,0708h\r
786         jmp     @@5\r
787 @@3:    call    iVGA\r
788         cmp     al,1\r
789         jnz     @@4\r
790         mov     cx,0d0eh\r
791         jmp     @@5\r
792 @@4:    mov     cx,0b0ch\r
793 @@5:    push    ecx\r
794         call    SetCursorShape\r
795 end;\r
796 \r
797 procedure WideCursor; assembler;\r
798 asm\r
799         xor     ecx,ecx\r
800         call    iMDA\r
801         cmp     al,1\r
802         jnz     @@1\r
803         mov     cx,010ch\r
804         jmp     @@5\r
805 @@1:    call    iCGA\r
806         cmp     al,1\r
807         jnz     @@2\r
808         mov     cx,0107h\r
809         jmp     @@5\r
810 @@2:    call    iMCGA\r
811         cmp     al,1\r
812         jnz     @@3\r
813         mov     cx,0107h\r
814         jmp     @@5\r
815 @@3:    call    iVGA\r
816         cmp     al,1\r
817         jnz     @@4\r
818         mov     cx,010eh\r
819         jmp     @@5\r
820 @@4:    mov     cx,010ch\r
821 @@5:    push    ecx\r
822         call    SetCursorShape\r
823 end;\r
824 \r
825 procedure HideCursor; assembler;\r
826 asm\r
827         xor     ecx,ecx\r
828         mov     cx,1010h\r
829         push    ecx\r
830         call    SetCursorShape\r
831 end;\r
832 \r
833 function GetCursorShape: Word; assembler;\r
834 asm\r
835         mov     dx,03d4h\r
836         mov     al,0ah\r
837         out     dx,al\r
838         inc     dx\r
839         in      al,dx\r
840         and     al,1fh\r
841         mov     ah,al\r
842         dec     dx\r
843         mov     al,0bh\r
844         out     dx,al\r
845         inc     dx\r
846         in      al,dx\r
847         and     al,1fh\r
848 end;\r
849 \r
850 procedure SetCursorShape(shape: Word); assembler;\r
851 asm\r
852         mov     dx,03d4h\r
853         mov     al,0ah\r
854         out     dx,al\r
855         inc     dx\r
856         in      al,dx\r
857         mov     ah,BYTE(shape)[1]\r
858         and     al,0e0h\r
859         or      al,ah\r
860         out     dx,al\r
861         dec     dx\r
862         mov     al,0bh\r
863         out     dx,al\r
864         inc     dx\r
865         in      al,dx\r
866         mov     ah,BYTE(shape)[0]\r
867         and     al,0e0h\r
868         or      al,ah\r
869         out     dx,al\r
870 end;\r
871 \r
872 procedure initialize;\r
873 begin\r
874   asm\r
875         mov     ah,0fh\r
876         int     10h\r
877         and     al,7fh\r
878         mov     v_mode,al\r
879         mov     DispPg,bh\r
880   end;\r
881 \r
882   If (MEM[0:$449] = 7) then\r
883     begin\r
884       v_seg := $0b000;\r
885       MaxLn := 25;\r
886     end\r
887   else begin\r
888          v_seg := $0b800;\r
889          MaxLn := SUCC(MEM[0:$484]);\r
890        end;\r
891 \r
892   v_ofs  := MEM[0:$44e];\r
893   MaxCol := MEM[0:$44a];\r
894 \r
895   work_MaxLn  := MaxLn;\r
896   work_MaxCol := MaxCol;\r
897 \r
898   If iCGA then CheckSnow := TRUE\r
899   else CheckSnow := FALSE;\r
900 end;\r
901 \r
902 var\r
903   dos_seg: Word;\r
904   bios_data_backup: array[0..167] of Byte;\r
905   regs: tRmRegs;\r
906 \r
907 procedure GetVideoState(var data: tVIDEO_STATE);\r
908 begin\r
909   Move(Ptr(v_seg,v_ofs)^,data.screen,SizeOf(data.screen));\r
910   data.cursor := GetCursor;\r
911   data.font := MEMW[0:$0485];\r
912   data.v_mode := v_mode;\r
913   data.MaxLn := MaxLn;\r
914   data.MaxCol := MaxCol;\r
915   data.v_ofs := v_ofs;\r
916   Move(MEM[$40:0],bios_data_backup,168);\r
917   dos_seg := DosMemoryAlloc(SizeOf(tVIDEO_STATE(data).data));\r
918   ClearRmRegs(regs);\r
919   regs.cx := 7;\r
920   regs.es := dos_seg;\r
921   regs.ax := $1c01;\r
922   RealModeInt($10,regs);\r
923   Move(bios_data_backup,MEM[$40:0],168);\r
924   Move(POINTER(DWORD(dos_seg)*16)^,tVIDEO_STATE(data).data,\r
925        SizeOf(tVIDEO_STATE(data).data));\r
926   DosMemoryFree(dos_seg);\r
927 end;\r
928 \r
929 procedure SetVideoState(var data: tVIDEO_STATE; restore_screen: Boolean);\r
930 begin\r
931   v_mode := data.v_mode;\r
932   ResetMode;\r
933   Move(MEM[$40:0],bios_data_backup,168);\r
934   dos_seg := DosMemoryAlloc(SizeOf(tVIDEO_STATE(data).data));\r
935   Move(tVIDEO_STATE(data).data,POINTER(DWORD(dos_seg)*16)^,\r
936        SizeOf(tVIDEO_STATE(data).data));\r
937   ClearRmRegs(regs);\r
938   regs.cx := 7;\r
939   regs.es := dos_seg;\r
940   regs.ax := $1c02;\r
941   RealModeInt($10,regs);\r
942   DosMemoryFree(dos_seg);\r
943   Move(bios_data_backup,MEM[$40:0],168);\r
944 \r
945   MEM[0:$44e] := data.v_ofs;\r
946   MEM[0:$484] := PRED(data.MaxLn);\r
947   MEM[0:$44a] := data.MaxCol;\r
948 \r
949   Case data.font of\r
950      8:  asm mov ax,1112h; xor bl,bl; int 10h end;\r
951     14:  asm mov ax,1111h; xor bl,bl; int 10h end;\r
952     else asm mov ax,1114h; xor bl,bl; int 10h end;\r
953   end;\r
954 \r
955   initialize;\r
956   SetCursor(data.cursor);\r
957   If restore_screen then\r
958     Move(data.screen,Ptr(v_seg,v_ofs)^,SizeOf(data.screen));\r
959 end;\r
960 \r
961 procedure GetRGBitem(color: Byte; var red,green,blue: Byte);\r
962 begin\r
963   PORT[$3c7] := color;\r
964   red   := PORT[$3c9];\r
965   green := PORT[$3c9];\r
966   blue  := PORT[$3c9];\r
967 end;\r
968 \r
969 procedure SetRGBitem(color: Byte; red,green,blue: Byte);\r
970 begin\r
971   PORT[$3c8] := color;\r
972   PORT[$3c9] := red;\r
973   PORT[$3c9] := green;\r
974   PORT[$3c9] := blue;\r
975 end;\r
976 \r
977 procedure WaitRetrace; assembler;\r
978 asm\r
979         mov     dx,3dah\r
980 @@1:    in      al,dx\r
981         and     al,08h\r
982         jnz     @@1\r
983 @@2:    in      al,dx\r
984         and     al,08h\r
985         jz      @@2\r
986 end;\r
987 \r
988 procedure GetPalette(var pal; first,last: Word); assembler;\r
989 asm\r
990         xor     eax,eax\r
991         xor     ecx,ecx\r
992         mov     ax,first\r
993         mov     cx,last\r
994         sub     ecx,eax\r
995         inc     ecx\r
996         mov     dx,03c7h\r
997         out     dx,al\r
998         add     dx,2\r
999         mov     edi,[pal]\r
1000         add     edi,eax\r
1001         add     edi,eax\r
1002         add     edi,eax\r
1003         mov     eax,ecx\r
1004         add     ecx,eax\r
1005         add     ecx,eax\r
1006         rep     insb\r
1007 end;\r
1008 \r
1009 procedure SetPalette(var pal; first,last: Word); assembler;\r
1010 asm\r
1011         mov     dx,03dah\r
1012 @@1:    in      al,dx\r
1013         test    al,8\r
1014         jz      @@1\r
1015         xor     eax,eax\r
1016         xor     ecx,ecx\r
1017         mov     ax,first\r
1018         mov     cx,last\r
1019         sub     ecx,eax\r
1020         inc     ecx\r
1021         mov     dx,03c8h\r
1022         out     dx,al\r
1023         inc     dx\r
1024         mov     esi,[pal]\r
1025         add     esi,eax\r
1026         add     esi,eax\r
1027         add     esi,eax\r
1028         mov     eax,ecx\r
1029         add     ecx,eax\r
1030         add     ecx,eax\r
1031         rep     outsb\r
1032 end;\r
1033 \r
1034 const\r
1035   fade_first: Byte = 0;\r
1036   fade_last:  Byte = 255;\r
1037 \r
1038 procedure wait_ms; assembler;\r
1039 asm\r
1040 @@1:    mov     di,-1*1193*2\r
1041         xor     al,al\r
1042         out     43h,al\r
1043         in      al,40h\r
1044         mov     bl,al\r
1045         in      al,40h\r
1046         mov     bh,al\r
1047 @@2:    xor     al,al\r
1048         out     43h,al\r
1049         in      al,40h\r
1050         mov     ah,al\r
1051         in      al,40h\r
1052         xchg    ah,al\r
1053         sub     ax,bx\r
1054         cmp     ax,di\r
1055         jnc     @@2\r
1056 end;\r
1057 \r
1058 procedure VgaFade(var data: tFADE_BUF; fade: tFADE; delay: tDELAY);\r
1059 \r
1060 var\r
1061   i,j: Byte;\r
1062 \r
1063 begin\r
1064   If (fade = fadeOut) and (data.action in [first,fadeIn]) then\r
1065     begin\r
1066       GetPalette(data.pal0,fade_first,fade_last);\r
1067       If delay = delayed then\r
1068         For i := fade_speed downto 0 do\r
1069           begin\r
1070             For j := fade_first to fade_last do\r
1071               begin\r
1072                 data.pal1[j].r := data.pal0[j].r * i DIV fade_speed;\r
1073                 data.pal1[j].g := data.pal0[j].g * i DIV fade_speed;\r
1074                 data.pal1[j].b := data.pal0[j].b * i DIV fade_speed;\r
1075               end;\r
1076             SetPalette(data.pal1,fade_first,fade_last);\r
1077             wait_ms;\r
1078           end\r
1079       else\r
1080         begin\r
1081           FillChar(data.pal1,SizeOf(data.pal1),0);\r
1082           SetPalette(data.pal1,fade_first,fade_last);\r
1083         end;\r
1084       data.action := fadeOut;\r
1085     end;\r
1086 \r
1087   If (fade = fadeIn) and (data.action = fadeOut) then\r
1088     begin\r
1089       If delay = delayed then\r
1090         For i := 0 to fade_speed do\r
1091           begin\r
1092             For j := fade_first to fade_last do\r
1093               begin\r
1094                 data.pal1[j].r := data.pal0[j].r * i DIV fade_speed;\r
1095                 data.pal1[j].g := data.pal0[j].g * i DIV fade_speed;\r
1096                 data.pal1[j].b := data.pal0[j].b * i DIV fade_speed;\r
1097               end;\r
1098             SetPalette(data.pal1,fade_first,fade_last);\r
1099             wait_ms;\r
1100           end\r
1101       else\r
1102         SetPalette(data.pal0,fade_first,fade_last);\r
1103       data.action := fadeIn;\r
1104     end;\r
1105 end;\r
1106 \r
1107 procedure RefreshEnable; assembler;\r
1108 asm mov ax,1200h; mov bl,36h; int 10h end;\r
1109 \r
1110 procedure RefreshDisable; assembler;\r
1111 asm mov ax,1201h; mov bl,36h; int 10h end;\r
1112 \r
1113 procedure Split2Static;\r
1114 \r
1115 var\r
1116   temp: Byte;\r
1117 \r
1118 begin\r
1119   temp := PORT[$3da];\r
1120   PORT[$3c0] := $10 OR $20;\r
1121   PORT[$3c0] := PORT[$3c1] OR $20;\r
1122 end;\r
1123 \r
1124 procedure SplitScr(line: Integer);\r
1125 \r
1126 var\r
1127   temp: Byte;\r
1128 \r
1129 begin\r
1130   PORT[$3d4] := $18;\r
1131   PORT[$3d5] := LO(line);\r
1132   PORT[$3d4] := $07;\r
1133   temp := PORT[$3d5];\r
1134 \r
1135   If (line < $100) then temp := temp AND $0ef\r
1136   else temp := temp OR $10;\r
1137 \r
1138   PORT[$3d5] := temp;\r
1139   PORT[$3d4] := $09;\r
1140   temp := PORT[$3d5];\r
1141 \r
1142   If (line < $200) then temp := temp AND $0bf\r
1143   else temp := temp OR $40;\r
1144 \r
1145   PORT[$3d5] := temp;\r
1146 end;\r
1147 \r
1148 procedure SetSize(columns,lines: Integer);\r
1149 begin\r
1150   PORT[$3d4] := $13;\r
1151   PORT[$3d5] := columns SHR 1;\r
1152   MEMW[$0000:$44a] := columns;\r
1153   MEMW[$0000:$484] := lines-1;\r
1154   MEMW[$0000:$44c] := columns*lines;\r
1155 end;\r
1156 \r
1157 procedure SetTextDisp(x,y: Integer);\r
1158 \r
1159 var\r
1160   temp: Byte;\r
1161 \r
1162 begin\r
1163   While (PORT[$3da] AND 1 =  1) do ;\r
1164   While (PORT[$3da] AND 1 <> 1) do ;\r
1165 \r
1166   PORT[$3d4] := $0c;\r
1167   PORT[$3d5] := HI((y SHR 4)*MaxCol+(x DIV 9));\r
1168   PORT[$3d4] := $0d;\r
1169   PORT[$3d5] := LO((y SHR 4)*MaxCol+(x DIV 9));\r
1170   PORT[$3d4] := $08;\r
1171   PORT[$3d5] := (PORT[$3d5] AND $0e0) OR (y AND $0f);\r
1172   temp := PORT[$3da];\r
1173   PORT[$3c0] := $13 OR $20;\r
1174   PORT[$3c0] := (x+9) MOD 9;\r
1175 end;\r
1176 \r
1177 procedure SetCustomVideoMode(vmode: tCUSTOM_VIDEO_MODE);\r
1178 \r
1179 const\r
1180   vmode_data: array[0..52,0..63] of Byte = (\r
1181 \r
1182 { 1..5   - BIOS variables,\r
1183   6..9   - Sequencer,\r
1184   10     - Miscellaneous Output,\r
1185   11..35 - CRTC,\r
1186   36..55 - Attribute,\r
1187   56..64 - Graphics   }\r
1188 \r
1189 {  0, Text 36x14, 9x14, complete }\r
1190 (  36,  13,  14,   0, 4,     8,   3,   0,   2,    99,\r
1191   40, 35, 36,138, 38,192,183, 31,  0,205, 11, 12,  0,  0,  0,\r
1192    0,148,134,135, 18, 31,142,177,163,255,  0,  1,  2,  3,  4,\r
1193    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1194     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1195 \r
1196 {  1, Text 40x14, 8x14, complete }\r
1197 (  40,  13,  14,   0, 5,     9,   3,   0,   2,    99,\r
1198   45, 39, 40,144, 43,160,183, 31,  0,205, 11, 12,  0,  0,  0,\r
1199    0,148,134,135, 20, 31,142,177,163,255,  0,  1,  2,  3,  4,\r
1200    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1201     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1202 \r
1203 {  2, Text 40x14, 9x14, complete }\r
1204 (  40,  13,  14,   0, 5,     8,   3,   0,   2,   103,\r
1205   45, 39, 40,144, 43,160,183, 31,  0,205, 11, 12,  0,  0,  0,\r
1206    0,148,134,135, 20, 31,142,177,163,255,  0,  1,  2,  3,  4,\r
1207    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1208     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1209 \r
1210 {  3, Text 46x14, 8x14, complete }\r
1211 (  46,  13,  14,   0, 6,     9,   3,   0,   2,   103,\r
1212   52, 45, 46,151, 50,150,183, 31,  0,205, 11, 12,  0,  0,  0,\r
1213    0,148,134,135, 23, 31,142,177,163,255,  0,  1,  2,  3,  4,\r
1214    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1215     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1216 \r
1217 \r
1218 {  4, Text 36x15, 9x16, complete }\r
1219 (  36,  14,  16,  0, 5,     8,   3,   0,   2,   227,\r
1220   40, 35, 36,138, 38,192, 11, 62,  0,207, 13, 14,  0,  0,  0,\r
1221    0,234,172,223, 18, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1222    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1223     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1224 \r
1225 {  5, Text 40x15, 8x16, complete }\r
1226 (  40,  14,  16,   0, 5,     9,   3,   0,   2,   227,\r
1227   45, 39, 40,144, 43,160, 11, 62,  0,207, 13, 14,  0,  0,  0,\r
1228    0,234,172,223, 20, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1229    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1230     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1231 \r
1232 {  6, Text 40x15, 9x16, complete }\r
1233 (  40,  14,  16,   0, 5,     8,   3,   0,   2,   231,\r
1234   45, 39, 40,144, 43,160, 11, 62,  0,207, 13, 14,  0,  0,  0,\r
1235    0,234,172,223, 20, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1236    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1237     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1238 \r
1239 {  7, Text 46x15, 8x16, complete }\r
1240 (  46,  14,  16,   0, 6,     9,   3,   0,   2,   231,\r
1241   52, 45, 46,151, 50,150, 11, 62,  0,207, 13, 14,  0,  0,  0,\r
1242    0,234,172,223, 23, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1243    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1244     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1245 \r
1246 \r
1247 {  8, Text 36x17, 9x14, complete }\r
1248 (  36,  16,  14,   0, 5,     8,   3,   0,   2,   227,\r
1249   40, 35, 36,138, 38,192,  7, 62,  0,205, 11, 12,  0,  0,  0,\r
1250    0,230,168,219, 18, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1251    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1252     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1253 \r
1254 {  9, Text 40x17, 8x14, complete }\r
1255 (  40,  16,  14,   0, 6,     9,   3,   0,   2,   227,\r
1256   45, 39, 40,144, 43,160,  7, 62,  0,205, 11, 12,  0,  0,  0,\r
1257    0,230,168,219, 20, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1258    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1259     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1260 \r
1261 { 10, Text 40x17, 9x14, complete }\r
1262 (  40,  16,  14,   0, 6,     8,   3,   0,   2,   231,\r
1263   45, 39, 40,144, 43,160,  7, 62,  0,205, 11, 12,  0,  0,  0,\r
1264    0,230,168,219, 20, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1265    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1266     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1267 \r
1268 { 11, Text 46x17, 9x14, complete }\r
1269 (  46,  16,  14,   0, 7,     9,   3,   0,   2,   231,\r
1270   52, 45, 46,151, 50,150,  7, 62,  0,205, 11, 12,  0,  0,  0,\r
1271    0,230,168,219, 23, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1272    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1273     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1274 \r
1275 \r
1276 { 12, Text 36x22, 9x16, complete }\r
1277 (  36,  21,  16,   0, 7,     8,   3,   0,   2,   163,\r
1278   40, 35, 36,138, 38,192,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1279    0,133,165, 95, 18, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1280    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1281     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1282 \r
1283 { 13, Text 40x22, 8x16, complete }\r
1284 (  40,  21,  16,   0, 7,     9,   3,   0,   2,   163,\r
1285   45, 39, 40,144, 43,160,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1286    0,133,165, 95, 20, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1287    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1288     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1289 \r
1290 { 14, Text 40x22, 9x16, complete }\r
1291 (  40,  21,  16,   0, 7,     8,   3,   0,   2,   167,\r
1292   45, 39, 40,144, 43,160,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1293    0,133,165, 95, 20, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1294    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1295     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1296 \r
1297 { 15, Text 46x22, 8x16, complete }\r
1298 (  46,  21,  16,   0, 8,     9,   3,   0,   2,   167,\r
1299   52, 45, 46,151, 50,150,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1300    0,133,165, 95, 23, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1301    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1302     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1303 \r
1304 { 16, Text 70x22, 9x16, complete }\r
1305 (  70,  21,  16,   0,13,     0,   3,   0,   2,   163,\r
1306   83, 69, 70,150, 75, 21,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1307    0,133,165, 95, 35, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1308    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1309     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1310 \r
1311 { 17, Text 80x22, 8x16, complete }\r
1312 (  80,  21,  16,   0,14,     1,   3,   0,   2,   163,\r
1313   95, 79, 80,130, 85,129,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1314    0,133,165, 95, 40, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1315    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 0,\r
1316     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1317 \r
1318 { 18, Text 80x22, 9x16, complete }\r
1319 (  80,  21,  16,   0,14,     0,   3,   0,   2,   167,\r
1320   95, 79, 80,130, 85,129,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1321    0,133,165, 95, 40, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1322    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1323     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1324 \r
1325 { 19, Text 90x22, 8x16, complete }\r
1326 (  90,  21,  16,   0,16,     1,   3,   0,   2,   167,\r
1327  107, 89, 90,142, 95,138,193, 31,  0, 79, 13, 14,  0,  0,  0,\r
1328    0,133,165, 95, 45, 31,101,187,163,255,  0,  1,  2,  3,  4,\r
1329    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1330     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1331 \r
1332 \r
1333 { 20, Text 36x25, 9x16, complete }\r
1334 (  36,  24,  16,   0, 8,     8,   3,   0,   2,    99,\r
1335   40, 35, 36,138, 38,192,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1336    0,156,142,143, 18, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1337    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1338     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1339 \r
1340 { 21, Text 40x25, 8x16, complete }\r
1341 (  40,  24,  16,   0, 8,     9,   3,   0,   2,    99,\r
1342   45, 39, 40,144, 43,160,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1343    0,156,142,143, 20, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1344    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1345     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1346 \r
1347 { 22, Text 40x25, 9x16, complete }\r
1348 (  40,  24,  16,   0, 8,     8,   3,   0,   2,   103,\r
1349   45, 39, 40,144, 43,160,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1350    0,156,142,143, 20, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1351    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  8,\r
1352     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1353 \r
1354 { 23, Text 46x25, 8x16, complete }\r
1355 (  46,  24,  16,   0,10,     9,   3,   0,   2,   103,\r
1356   52, 45, 46,151, 50,150,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1357    0,156,142,143, 23, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1358    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1359     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1360 \r
1361 { 24, Text 70x25, 9x16, complete }\r
1362 (  70,  24,  16,   0,14,     0,   3,   0,   2,   99,\r
1363   83, 69, 70,150, 75, 21,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1364    0,156,142,143, 35, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1365    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1366     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1367 \r
1368 { 25, Text 80x25, 8x16, complete }\r
1369 (  80,  24,  16,   0,16,     1,   3,   0,   2,   99,\r
1370   95, 79, 80,130, 85,129,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1371    0,156,142,143, 40, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1372    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 0,\r
1373     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1374 \r
1375 { 26, Text 80x25, 9x16, standard }\r
1376 (  80,  24,  16,   0,16,     0,   3,   0,   2,   103,\r
1377   95, 79, 80,130, 85,129,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1378    0,156,142,143, 40, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1379    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1380     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1381 \r
1382 { 27, Text 90x25, 8x16, complete }\r
1383 (  90,  24,  16,  0, 18  ,   1,   3,   0,   2,  103,\r
1384  107, 89, 90,142, 95,138,191, 31,  0, 79, 13, 14,  0,  0,  0,\r
1385    0,156,142,143, 45, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1386    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1387     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1388 \r
1389 \r
1390 { 28, Text 46x29, 8x16, complete }\r
1391 (  46,  28,  14,   0,11,     9,   3,   0,   2,   103,\r
1392   52, 45, 46,151, 50,150,193, 31,  0, 77, 11, 12,  0,  0,  0,\r
1393    0,159,145,149, 23, 31,155,185,163,255,  0,  1,  2,  3,  4,\r
1394    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1395     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1396 \r
1397 { 29, Text 70x29, 9x14, complete }\r
1398 (  70,  28,  14,  0, 16  ,   0,   3,   0,   2,   99,\r
1399   83, 69, 70,150, 75, 21,193, 31,  0, 77, 11, 12,  0,  0,  0,\r
1400    0,159,145,149, 35, 31,155,185,163,255,  0,  1,  2,  3,  4,\r
1401    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1402     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1403 \r
1404 { 30, Text 80x29, 8x14, complete }\r
1405 (  80,  28,  14,  0, 19  ,   1,   3,   0,   2,   99,\r
1406   95, 79, 80,130, 85,129,193, 31,  0, 77, 11, 12,  0,  0,  0,\r
1407    0,159,145,149, 40, 31,155,185,163,255,  0,  1,  2,  3,  4,\r
1408    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1409     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1410 \r
1411 { 31, Text 80x29, 9x14, complete }\r
1412 (  80,  28,  14,  0, 19  ,   0,   3,   0,   2,  103,\r
1413   95, 79, 80,130, 85,129,193, 31,  0, 77, 11, 12,  0,  0,  0,\r
1414    0,159,145,149, 40, 31,155,185,163,255,  0,  1,  2,  3,  4,\r
1415    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1416     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1417 \r
1418 { 32, Text 90x29, 8x14, complete }\r
1419 (  90,  28,  14,  0, 21  ,   1,   3,   0,   2,  103,\r
1420  107, 89, 90,142, 95,138,193, 31,  0, 77, 11, 12,  0,  0,  0,\r
1421    0,159,145,149, 45, 31,155,185,163,255,  0,  1,  2,  3,  4,\r
1422    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1423     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1424 \r
1425 \r
1426 { 33, Text 70x30, 9x16, complete }\r
1427 (  70,  29,  16,  0, 17  ,   0,   3,   0,   2,  227,\r
1428   83, 69, 70,150, 75, 21, 11, 62,  0, 79, 13, 14,  0,  0,  0,\r
1429    0,234,172,223, 35, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1430    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1431     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1432 \r
1433 { 34, Text 80x30, 8x16, complete }\r
1434 (  80,  29,  16,  0, 19  ,   1,   3,   0,   2,  227,\r
1435   95, 79, 80,130, 85,129, 11, 62,  0, 79, 13, 14,  0,  0,  0,\r
1436    0,234,172,223, 40, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1437    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1438     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1439 \r
1440 { 35, Text 80x30, 9x16, complete }\r
1441 (  80,  29,  16,  0, 19  ,   0,   3,   0,   2,  231,\r
1442   95, 79, 80,130, 85,129, 11, 62,  0, 79, 13, 14,  0,  0,  0,\r
1443    0,234,172,223, 40, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1444    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1445     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1446 \r
1447 { 36, Text 90x30, 8x16 ,complete }\r
1448 (  90,  29,  16,  0, 22  ,   1,   3,   0,   2,  231,\r
1449  107, 89, 90,142, 95,138, 11, 62,  0, 79, 13, 14,  0,  0,  0,\r
1450    0,234,172,223, 45, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1451    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1452     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1453 \r
1454 \r
1455 { 37, Text 70x34, 9x14, complete }\r
1456 (  70,  33,  14,  0, 19  ,   0,   3,   0,   2,  227,\r
1457   83, 69, 70,150, 75, 21,  7, 62,  0, 77, 11, 12,  0,  0,  0,\r
1458    0,230,168,219, 35, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1459    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1460     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1461 \r
1462 { 38, Text 80x34, 8x14, complete }\r
1463 (  80,  33,  14,  0, 22  ,   1,   3,   0,   2,  227,\r
1464   95, 79, 80,130, 85,129,  7, 62,  0, 77, 11, 12,  0,  0,  0,\r
1465    0,230,168,219, 40, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1466    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1467     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1468 \r
1469 { 39, Text 80x34, 9x14, complete }\r
1470 (  80,  33,  14,  0, 22  ,   0,   3,   0,   2,  231,\r
1471   95, 79, 80,130, 85,129,  7, 62,  0, 77, 11, 12,  0,  0,  0,\r
1472    0,230,168,219, 40, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1473    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1474     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1475 \r
1476 { 40, Text 90x34, 8x14, complete }\r
1477 (  90,  33,  14,  0, 24  ,   1,   3,   0,   2,  231,\r
1478  107, 89, 90,142, 95,138,  7, 62,  0, 77, 11, 12,  0,  0,  0,\r
1479    0,230,168,219, 45, 31,227,  2,163,255,  0,  1,  2,  3,  4,\r
1480    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1481     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1482 \r
1483 \r
1484 { 41, Text 70x44, 9x8, complete }\r
1485 (  70,  43,   8,   0,25,     0,   3,   0,   2,   163,\r
1486   83, 69, 70,150, 75, 21,193, 31,  0, 71,  6,  7,  0,  0,  0,\r
1487    0,133,135, 95, 35, 15,101,187,163,255,  0,  1,  2,  3,  4,\r
1488    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1489     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1490 \r
1491 { 42, Text 80x44, 8x8, complete }\r
1492 (  80,  43,   8,   0,28,     1,   3,   0,   2,   163,\r
1493   95, 79, 80,130, 85,129,193, 31,  0, 71,  6,  7,  0,  0,  0,\r
1494    0,133,135, 95, 40, 15,101,187,163,255,  0,  1,  2,  3,  4,\r
1495    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 0,\r
1496     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1497 \r
1498 { 43, Text 80x44, 9x8, complete }\r
1499 (  80,  43,   8,   0,28,     0,   3,   0,   2,   167,\r
1500   95, 79, 80,130, 85,129,193, 31,  0, 71,  6,  7,  0,  0,  0,\r
1501    0,133,135, 95, 40, 15,101,187,163,255,  0,  1,  2,  3,  4,\r
1502    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1503     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1504 \r
1505 { 44, Text 90x44, 8x8, complete }\r
1506 (  90,  43,   8,   0,31,     1,   3,   0,   2,   167,\r
1507  107, 89, 90,142, 95,138,193, 31,  0, 71,  6,  7,  0,  0,  0,\r
1508    0,133,135, 95, 45, 15,101,187,163,255,  0,  1,  2,  3,  4,\r
1509    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15,  0,\r
1510     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1511 \r
1512 \r
1513 { 45, Text 70x50, 9x8, complete }\r
1514 (  70,  49,   8,   0,28,     0,   3,   0,   2,   99,\r
1515   83, 69, 70,150, 75, 21,191, 31,  0, 71,  6,  7,  0,  0,  0,\r
1516    0,156,142,143, 35, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1517    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1518     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1519 \r
1520 { 46, Text 80x50, 8x8, complete }\r
1521 (  80,  49,   8,   0,32,     1,   3,   0,   2,   99,\r
1522   95, 79, 80,130, 85,129,191, 31,  0, 71,  6,  7,  0,  0,  0,\r
1523    0,156,142,143, 40, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1524    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 0,\r
1525     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1526 \r
1527 { 47, Text 80x50, 9x8, standard }\r
1528 (  80,  49,   8,   0,32,     0,   3,   0,   2,   103,\r
1529   95, 79, 80,130, 85,129,191, 31,  0, 71,  6,  7,  0,  0,  0,\r
1530    0,156,142,143, 40, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1531    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63, 12,  0, 15, 8,\r
1532     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1533 \r
1534 { 48, Text 90x50, 8x8, complete }\r
1535 (  90,  49,   8,  0, 36  ,   1,   3,   0,   2,  103,\r
1536  107, 89, 90,142, 95,138,191, 31,  0, 71,  6,  7,  0,  0,  0,\r
1537    0,156,142,143, 45, 31,150,185,163,255,  0,  1,  2,  3,  4,\r
1538    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1539     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1540 \r
1541 \r
1542 { 49, Text 70x60, 9x8, complete }\r
1543 (  70,  59,   8,  0, 33  ,   0,   3,   0,   2,  227,\r
1544   83, 69, 70,150, 75, 21, 11, 62,  0, 71,  6,  7,  0,  0,  0,\r
1545    0,234,172,223, 35, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1546    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1547     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1548 \r
1549 { 50, Text 80x60, 8x8, complete }\r
1550 (  80,  59,   8,  0, 38  ,   1,   3,   0,   2,  227,\r
1551   95, 79, 80,130, 85,129, 11, 62,  0, 71,  6,  7,  0,  0,  0,\r
1552    0,234,172,223, 40, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1553    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1554     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1555 \r
1556 { 51, Text 80x60, 9x8, complete }\r
1557 (  80,  59,   8,  0, 38  ,   0,   3,   0,   2,  231,\r
1558   95, 79, 80,130, 85,129, 11, 62,  0, 71,  6,  7,  0,  0,  0,\r
1559    0,234,172,223, 40, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1560    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  8,\r
1561     0,   0,   0,   0,   0,  16,  14,   0, 255),\r
1562 \r
1563 { 52, Text 90x60, 8x8, complete }\r
1564 (  90,  59,   8,128, 42  ,   1,   3,   0,   2,  231,\r
1565  107, 89, 90,142, 95,138, 11, 62,  0, 71,  6,  7,  0,  0,  0,\r
1566    0,234,172,223, 45, 31,231,  6,163,255,  0,  1,  2,  3,  4,\r
1567    5, 20,  7, 56, 57, 58, 59, 60, 61, 62, 63,  8,  0, 15,  0,\r
1568     0,   0,   0,   0,   0,  16,  14,   0, 255)\r
1569 \r
1570 );\r
1571 \r
1572 begin\r
1573   asm\r
1574         movzx   eax,vmode\r
1575         shl     eax,6\r
1576         lea     esi,[vmode_data]\r
1577         add     esi,eax\r
1578         mov     dx,3cch\r
1579         in      al,dx\r
1580         mov     dl,0d4h\r
1581         test    al,1\r
1582         jnz     @@1\r
1583         mov     dl,0b4h\r
1584   @@1:  add     dx,6\r
1585         in      al,dx\r
1586         xor     al,al\r
1587         mov     dx,3c0h\r
1588         out     dx,al\r
1589         mov     ax,100h\r
1590         mov     dx,3c4h\r
1591         out     dx,ax\r
1592         add     esi,5\r
1593         mov     ecx,4\r
1594         mov     al,1\r
1595         mov     dx,3c4h\r
1596   @@2:  mov     ah,[esi]\r
1597         inc     esi\r
1598         out     dx,ax\r
1599         inc     al\r
1600         loop    @@2\r
1601         mov     al,[esi]\r
1602         inc     esi\r
1603         mov     dx,3c2h\r
1604         out     dx,al\r
1605         mov     dx,3c4h\r
1606         mov     ax,300h\r
1607         out     dx,ax\r
1608         mov     dx,3cch\r
1609         in      al,dx\r
1610         mov     dl,0d4h\r
1611         test    al,1\r
1612         jnz     @@3\r
1613         mov     dl,0b4h\r
1614   @@3:  movzx   edi,SEG0040\r
1615         shl     edi,4\r
1616         add     edi,63h\r
1617         shl     edi,4\r
1618         mov     [edi],dx\r
1619         mov     al,11h\r
1620         out     dx,al\r
1621         inc     dx\r
1622         mov     ah,al\r
1623         in      al,dx\r
1624         dec     dx\r
1625         xchg    al,ah\r
1626         and     ah,7fh\r
1627         out     dx,ax\r
1628         mov     ecx,25\r
1629         xor     al,al\r
1630   @@4:  mov     ah,[esi]\r
1631         inc     esi\r
1632         out     dx,ax\r
1633         inc     al\r
1634         loop    @@4\r
1635         add     dx,6\r
1636         in      al,dx\r
1637         xor     ah,ah\r
1638         mov     ecx,20\r
1639         mov     dx,3c0h\r
1640   @@5:  mov     al,ah\r
1641         out     dx,al\r
1642         inc     ah\r
1643         mov     al,[esi]\r
1644         inc     esi\r
1645         out     dx,al\r
1646         loop    @@5\r
1647         xor     al,al\r
1648         mov     ecx,9\r
1649         mov     dx,3ceh\r
1650   @@6:  mov     ah,[esi]\r
1651         inc     esi\r
1652         out     dx,ax\r
1653         inc     al\r
1654         loop    @@6\r
1655         mov     dx,3c0h\r
1656         mov     al,32\r
1657         out     dx,al\r
1658   end;\r
1659 \r
1660   MEM[SEG0040:$4a] := vmode_data[vmode,0];\r
1661   MEM[SEG0040:$84] := vmode_data[vmode,1];\r
1662   MEM[SEG0040:$85] := vmode_data[vmode,2];\r
1663   MEM[SEG0040:$4c] := vmode_data[vmode,3];\r
1664   MEM[SEG0040:$4d] := vmode_data[vmode,4];\r
1665   FillChar(MEM[SEG0040:$4e],17,0);\r
1666 \r
1667   MEM[SEG0040:$60] := vmode_data[vmode,20];\r
1668   MEM[SEG0040:$61] := vmode_data[vmode,21];\r
1669   MEM[SEG0040:$62] := 0;\r
1670 \r
1671   Case vmode_data[vmode,2] of\r
1672      8: asm mov ah,11h; mov al,2; xor bx,bx; int 10h end;\r
1673     14: asm mov ah,11h; mov al,1; xor bx,bx; int 10h end;\r
1674     16: asm mov ah,11h; mov al,4; xor bx,bx; int 10h end;\r
1675   end;\r
1676 \r
1677   initialize;\r
1678   CleanScreen(Ptr(v_seg,v_ofs)^);\r
1679 end;\r
1680 \r
1681 begin\r
1682   initialize;\r
1683 end.\r