/* tass_dos.2 -- second include file for DOS */ /* the following function is not ANSI C -- this code is specific to X86 PCs */ long product (sint one, sint two) #pragma aux __cdecl { VideoRec Dat; uint lo, hi; #ifdef __WATCOMC__ extern void ASM_00 (void); #pragma aux ASM_00 = \ "mov ax,ss:one" \ "mov bx,ss:two" \ "imul bx" \ "mov ss:lo,ax" \ "mov ss:hi,dx" \ modify [ax bx dx] ASM_00 (); #else ASM { mov ax,one mov bx,two imul bx mov lo,ax mov hi,dx } #endif Dat.W[0] = lo; Dat.W[1] = hi; return (Dat.B); } /* the following function is not ANSI C -- this code is specific to X86 PCs */ byte BIOget (uint port) /* get a byte from an IO port */ #pragma aux __cdecl { byte value; #ifdef __WATCOMC__ extern void ASM_01 (void); #pragma aux ASM_01 = \ "mov dx,ss:port" \ "in al,dx" \ "mov ss:value,al" \ modify [al dx] ASM_01 (); #else ASM { mov dx,port in al,dx mov value,al } #endif return (value); } /* the following function is not ANSI C -- this code is specific to X86 PCs */ void BIOput (uint port, byte data) /* put a byte to an IO port */ #pragma aux __cdecl { #ifdef __WATCOMC__ extern void ASM_02 (void); #pragma aux ASM_02 = \ "mov dx,ss:port" \ "mov al,ss:data" \ "out dx,al" \ modify [al dx] ASM_02 (); #else ASM { mov dx,port mov al,data out dx,al } #endif } /* the following function is not ANSI C -- this code is specific to VGA */ void setMapMask (byte Mask) /* set the VGA data mask */ { BIOput (0x03C4, 2); BIOput (0x03C5, Mask); } /* the following function is not ANSI C -- this code is specific to VGA */ byte GetColorPage (void) /* get the Color Page State */ #pragma aux __cdecl { uint value; #ifdef __WATCOMC__ extern void ASM_03 (void); #pragma aux ASM_03 = \ "mov ax,0x101A" \ "int 0x10" \ "mov ss:value,bx" \ modify [ax bx] ASM_03 (); #else ASM { mov ax,0x101A /* Get/Set Palette Registers AH = 0x10 */ /* Get Color Page State AL = 0x1A */ int 0x10 /* BIOS Video Interrupt = 0x10 */ mov value,bx } #endif if (value & 255) return ((byte) (value >> 4)); else return ((byte) (value >> 2)); } /* the following function is not ANSI C -- this code is specific to VGA */ void setVideoPalette (Palette *Pal) /* set the current Palette */ #pragma aux __cdecl { VideoRec Reg; uint iSeg, iOfs; #ifdef __WATCOMC__ extern void ASM_04 (void); #pragma aux ASM_04 = \ "mov dx,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "mov ax,0x1002" \ "int 0x10" \ modify [ax bx dx es] extern void ASM_05 (void); #pragma aux ASM_05 = \ "mov dx,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "mov ax,0x1012" \ "xor bh,bh" \ "mov bl,ss:DacReg" \ "mov cx,0x0010" \ "int 0x10" \ modify [ax bx cx dx es] #endif Reg.A = (texte) Pal; iOfs = Reg.W[0]; iSeg = Reg.W[1]; #ifdef __WATCOMC__ ASM_04 (); #else ASM { mov dx,iOfs mov ax,iSeg mov es,ax mov ax,0x1002 /* Get/Set Palette Registers AH = 0x10 */ /* Set All Palette Registers AL = 0x02 */ int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif iOfs += 17; /* skip 17 first bytes */ #ifdef __WATCOMC__ ASM_05 (); #else ASM { mov dx,iOfs mov ax,iSeg mov es,ax mov ax,0x1012 /* Get/Set Palette Registers AH = 0x10 */ /* Set Block Of DAC Registers AL = 0x12 */ xor bh,bh mov bl,DacReg /* first DAC register = current DAC Color Page */ mov cx,0x0010 /* set only 16 DAC registers */ int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif } /* the following function is not ANSI C -- this code is specific to VGA */ void GetVideoPalette (Palette *Pal) /* get the current Palette */ #pragma aux __cdecl { VideoRec Reg; uint iSeg, iOfs; #ifdef __WATCOMC__ extern void ASM_06 (void); #pragma aux ASM_06 = \ "mov dx,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "mov ax,0x1009" \ "int 0x10" \ modify [ax dx es] extern void ASM_07 (void); #pragma aux ASM_07 = \ "mov dx,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "mov ax,0x1017" \ "xor bh,bh" \ "mov bl,ss:DacReg" \ "mov cx,0x0010" \ "int 0x10" \ modify [ax bx cx dx es] #endif Reg.A = (texte) Pal; iOfs = Reg.W[0]; iSeg = Reg.W[1]; #ifdef __WATCOMC__ ASM_06 (); #else ASM { mov dx,iOfs mov ax,iSeg mov es,ax mov ax,0x1009 /* Get/Set Palette Registers AH = 0x10 */ /* Get All Palette Registers AL = 0x09 */ int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif iOfs += 17; /* skip 17 first bytes */ #ifdef __WATCOMC__ ASM_07 (); #else ASM { mov dx,iOfs mov ax,iSeg mov es,ax mov ax,0x1017 /* Get/Set Palette Registers AH = 0x10 */ /* Get Block Of DAC Registers AL = 0x17 */ xor bh,bh mov bl,DacReg /* first DAC register = current DAC Color Page */ mov cx,0x0010 /* get only 16 DAC registers */ int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif } /* the following function is not ANSI C -- this code is specific to VGA */ void setCursorType (uint Cur) /* set the cursor type */ #pragma aux __cdecl { #ifdef __WATCOMC__ extern void ASM_08 (void); #pragma aux ASM_08 = \ "mov ah,1" \ "mov cx,ss:Cur" \ "int 0x10" \ modify [ax cx] ASM_08 (); #else ASM { mov ah,1 /* Set Cursor Size AH = 1 */ mov cx,Cur int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif } /* the following function is not ANSI C -- this code is specific to VGA */ uint GetCursorType (void) /* get the current cursor type */ #pragma aux __cdecl { uint value; #ifdef __WATCOMC__ extern void ASM_09 (void); #pragma aux ASM_09 = \ "mov ah,3" \ "int 0x10" \ "mov ss:value,cx" \ modify [ax cx] ASM_09 (); #else ASM { mov ah,3 /* Get Cursor Type AH = 3 */ int 0x10 /* BIOS Video Interrupt = 0x10 */ mov value,cx } #endif return (value); } /* the following function is not ANSI C -- this code is specific to VGA */ void ClearVideoLine (uint Line, byte Color) /* clear one line of video RAM */ #pragma aux __cdecl { byte LoB, HiB; uint iSeg, iOfs; sint i; #ifdef __WATCOMC__ extern void ASM_10 (void); #pragma aux ASM_10 = \ "push di" \ "mov cx,ss:rowsiz" \ "mov di,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "mov al,0x0FF" \ "rep stosb" \ "pop di" \ modify [ax cx es] extern void ASM_11 (void); #pragma aux ASM_11 = \ "push di" \ "mov cx,ss:rowsiz" \ "mov di,ss:iOfs" \ "mov ax,ss:iSeg" \ "mov es,ax" \ "xor al,al" \ "rep stosb" \ "pop di" \ modify [ax cx es] #endif iSeg = 0xA000; /* video RAM segment */ iOfs = Line * rowsiz; /* this line's offset */ LoB = 0; HiB = 0; for (i = 0; i < 4; i++) { if (Color & BitMask[i]) HiB |= BitMask[i]; else LoB |= BitMask[i]; } if (HiB) { setMapMask (HiB); #ifdef __WATCOMC__ ASM_10 (); #else ASM { push di mov cx,rowsiz /* rowsiz bytes per line */ mov di,iOfs mov ax,iSeg mov es,ax mov al,0x0FF /* set all bits to 1 */ rep stosb pop di } #endif } if (LoB) { setMapMask (LoB); #ifdef __WATCOMC__ ASM_11 (); #else ASM { push di mov cx,rowsiz /* rowsiz bytes per line */ mov di,iOfs mov ax,iSeg mov es,ax xor al,al /* set all bits to 0 */ rep stosb pop di } #endif } } /* the following function is not ANSI C -- this code is specific to VGA */ void setVideoLine (uint Line, uint Wide) /* set video RAM from bitplane[i] */ #pragma aux __cdecl { uint iSegd, iOfsd, iSego, iOfso; VideoRec Reg; uint i; #ifdef __WATCOMC__ extern void ASM_12 (void); #pragma aux ASM_12 = \ "push si" \ "push di" \ "mov cx,ss:Wide" \ "mov di,ss:iOfsd" \ "mov ax,ss:iSegd" \ "mov es,ax" \ "mov si,ss:iOfso" \ "mov ax,ss:iSego" \ "push ds" \ "mov ds,ax" \ "rep movsb" \ "pop ds" \ "pop di" \ "pop si" \ modify [ax cx es] #endif iSegd = 0xA000; /* video RAM segment */ iOfsd = Line * rowsiz; /* line's offset: rowsiz bytes */ for (i = 0; i < 4; i++) { setMapMask (BitMask[i]); Reg.A = & (bitplane[i][0]); iSego = Reg.W[1]; iOfso = Reg.W[0]; #ifdef __WATCOMC__ ASM_12 (); #else ASM { push si push di mov cx,Wide mov di,iOfsd mov ax,iSegd mov es,ax mov si,iOfso mov ax,iSego push ds mov ds,ax rep movsb pop ds pop di pop si } #endif } } /* the following function is not ANSI C -- this code is specific to X86 PCs */ void GotoLC (byte line, byte column) /* move the cursor */ { curcol = column; currow = line; curlin = (line * rowsiz) << 4; /* because rowlin must be 16 */ } /* the following function is not ANSI C -- this code is specific to X86 PCs */ int KeyPressed (void) /* check for a keyboard event */ #pragma aux __cdecl { sint value; #ifdef __WATCOMC__ extern void ASM_13 (void); #pragma aux ASM_13 = \ "mov ah,0x0b" \ "int 0x21" \ "xor ah,ah" \ "mov ss:value,ax" \ modify [ax] ASM_13 (); #else ASM { mov ah,0x0b /* check keyboard function */ int 0x21 /* DOS services */ xor ah,ah /* AL = 0 when no key pressed */ mov value,ax /* AL = 255 when any key pressed */ } #endif return (value); } /* the following function is not ANSI C -- this code is specific to X86 PCs */ int GetKey (void) /* get a keypress -- called only after KeyPressed */ #pragma aux __cdecl { sint value; #ifdef __WATCOMC__ extern void ASM_14 (void); #pragma aux ASM_14 = \ "mov ah,0x08" \ "int 0x21" \ "xor ah,ah" \ "mov ss:value,ax" \ "cmp al,0" \ "jne gotkey" \ "mov ah,0x08" \ "int 0x21" \ "mov ah,1" \ "mov ss:value,ax" \ "gotkey: " \ modify [ax] ASM_14 (); #else ASM { mov ah,0x08 /* get key function */ int 0x21 /* DOS services */ xor ah,ah /* normal keys are below 256 */ mov value,ax cmp al,0 /* AL = 0 means function key */ jne gotkey mov ah,0x08 /* use another get key function to */ int 0x21 /* get the function key code in AL */ mov ah,1 /* function keys are above 255 */ mov value,ax } gotkey: #endif return (value); } /* the following function is not ANSI C -- this code is specific to X86 PCs */ void setCtrlBreak (void) /* make sure Ctrl-Break checking is active */ #pragma aux __cdecl { #ifdef __WATCOMC__ extern void ASM_15 (void); #pragma aux ASM_15 = \ "mov ax,0x3301" \ "mov dl,1" \ "int 0x21" \ modify [ax dx] ASM_15 (); #else ASM { mov ax,0x3301 /* set Ctrl-Break function (0x3300 is get for same) */ mov dl,1 /* specify Ctrl-Break should be ON */ int 0x21 /* DOS services */ } #endif } /* the following function is not ANSI C -- this code is specific to X86 PCs */ void SayChar (char it) /* display a char and move cursor */ #pragma aux __cdecl { uint topf; /* offset of character in font */ uint tops; /* offset of character on screen */ uint O, S, D; VideoRec P; #ifdef __WATCOMC__ extern void ASM_16 (void); #pragma aux ASM_16 = \ "push si" \ "push di" \ "mov ax,ss:D" \ "mov es,ax" \ "mov di,ss:tops" \ "mov ax,ss:S" \ "mov si,ss:O" \ "add si,ss:topf" \ "mov cl,0x10" \ "mov bx,ss:rowsiz" \ "dec bx" \ "push ds" \ "mov ds,ax" \ "again: movsb" \ "add di,bx" \ "dec cl" \ "jg again" \ "pop ds" \ "pop di" \ "pop si" \ modify [ax bx cx es] #endif /* check for special characters */ if (it == 8) /* backspace - go left 1 space */ { if (curcol) curcol--; else { if (currow) currow--; else currow = maxrow; curlin = (currow * rowsiz) << 4; /* because rowlin must be 16 */ curcol = rowsiz - 1; } return; } if (it == 9) /* horizontal tab - go right to next multiple of 8 spaces */ { curcol += 8; curcol >>= 3; curcol <<= 3; if (curcol >= rowsiz) { curcol = 0; if (currow >= maxrow) { currow = 0; curlin = 0; } else curlin = (currow++ * rowsiz) << 4; /* rowlin must be 16 */ } return; } if ((it == 10) || (it == 11)) /* line feed or vertical tab - go down 1 row */ { if (currow >= maxrow) { currow = 0; curlin = 0; } else curlin = (currow++ * rowsiz) << 4; /* rowlin must be 16 */ return; } if (it == 12) /* form feed - go up to top of screen */ { curcol = 0; currow = 0; curlin = 0; return; } if (it == 13) /* carriage return - go left to beginning of line */ { curcol = 0; /* Cr Lf is the DOS normal end of line */ return; } topf = ((uint) it) << 4; /* character offset in font (rowlin == 16) */ tops = curcol + curlin; /* character offset on screen */ /* prepare to write in full white - color 15 */ setMapMask (BitMask[0] | BitMask [1] | BitMask [2] | BitMask [3]); /* prepare font and screen addresses */ P.A = afont; O = P.W[0]; S = P.W[1]; D = 0xA000; /* write the character */ #ifdef __WATCOMC__ ASM_16 (); #else ASM { push si push di mov ax,D /* segment of display RAM */ mov es,ax mov di,tops /* offset in display RAM */ mov ax,S /* segment of ROM font */ mov si,O /* offset of ROM font */ add si,topf /* offset of char in ROM font */ mov cl,0x10 /* must be 16 lines per character row */ mov bx,rowsiz /* length of a row, in bytes */ dec bx /* 'coz movsb will increment by 1 */ push ds mov ds,ax } again: /* write 16 bytes while going down the screen */ ASM { movsb add di,bx /* move to next line, same column */ dec cl /* count 16 bytes */ jg again pop ds pop di pop si } #endif /* go to next column */ curcol++; if (curcol >= rowsiz) { curcol = 0; if (currow >= maxrow) { currow = 0; curlin = 0; } else curlin = (currow++ * rowsiz) << 4; /* rowlin must be 16 */ } } /* the following function is not ANSI C -- this code is specific to X86 PCs */ byte *get8by16chars (void) /* to be called after setVideoMode */ #pragma aux __cdecl { uint B, R; uint O, S; VideoRec P; #ifdef __WATCOMC__ extern void ASM_17 (void); #pragma aux ASM_17 = \ "push es" \ "push bp" \ "mov ax,0x1130" \ "mov bx,0x0606" \ "int 0x10" \ "mov ax,bp" \ "pop bp" \ "mov ss:O,ax" \ "mov ax,es" \ "pop es" \ "mov ss:S,ax" \ "xor dh,dh" \ "mov ss:R,dx" \ "mov ss:B,cx" \ modify [ax bx cx dx] ASM_17 (); #else ASM { push es push bp mov ax,0x1130 /* function 0x11, subfunction 0x30: get font info */ mov bx,0x0606 /* BH = 6 for ROM 8*16 */ int 0x10 /* BIOS video services */ mov ax,bp pop bp mov O,ax /* offset */ mov ax,es pop es mov S,ax /* segment */ xor dh,dh mov R,dx /* character rows per screen */ mov B,cx /* dot lines per char = bytes per char */ } #endif /* update some globals */ rowlin = B; maxrow = R; /* return font address */ P.W[0] = O; P.W[1] = S; return ((byte *) P.A); } /* the following function is not ANSI C -- this code is specific to VGA */ void setWiderScreen (void) #pragma aux __cdecl { byte Val; uint Hsize, Htotal; Hsize = Video.horpix >> 3; /* 8 pixels per byte */ Htotal = Hsize + 20; /* 160 pixel clocks flyback */ BIOput (0x03C4, 0x00); BIOput (0x03C5, 0x01); /* synchronous reset */ /* Ext Reg: Misc Out o@ 3C2 i@ 3CC */ BIOput (0x03C2, 0xE7); /* set for 28,322 Mhz */ /* Ext Reg: Feat Ctl o@ 3DA i@ 3CA */ /* Ext Reg: InSt Zer i@ 3C2 */ /* Ext Reg: InSt One i@ 3DA */ /* Ext Reg: Video En o@ 3C3 i@ 3C3 */ BIOput (0x03C4, 0x00); BIOput (0x03C5, 0x03); /* synchronous set */ /* unprotect the CRTC registers */ BIOput (CRTC, 0x11); BIOput (CRTC + 1, 127 & BIOget (CRTC + 1)); /* CRTC Rg: H Total 00@ 3D4 io@ 3D5 */ Val = (byte) (Htotal - 5); BIOput (CRTC, 0x00); BIOput (CRTC + 1, Val); /* CRTC Rg: H DisEnd 01@ 3D4 io@ 3D5 */ Val = (byte) (Hsize - 1); BIOput (CRTC, 0x01); BIOput (CRTC + 1, Val); /* CRTC Rg: H BlkBeg 02@ 3D4 io@ 3D5 */ Val = (byte) (Hsize + 1); BIOput (CRTC, 0x02); BIOput (CRTC + 1, Val); /* CRTC Rg: H BlkEnd 03@ 3D4 io@ 3D5 */ Val = 0x80 | (0x1F & (byte) (Htotal - 2)); BIOput (CRTC, 0x03); BIOput (CRTC + 1, Val); /* CRTC Rg: H RetBeg 04@ 3D4 io@ 3D5 */ Val = (byte) (Hsize + 3); BIOput (CRTC, 0x04); BIOput (CRTC + 1, Val); /* CRTC Rg: H RetEnd 05@ 3D4 io@ 3D5 */ if (Hsize == 96) Val = 0xE0 | (0x1F & (byte) (Htotal - 2)); else Val = 0x80 | (0x1F & (byte) (Htotal - 6)); BIOput (CRTC, 0x05); BIOput (CRTC + 1, Val); /* CRTC Rg: V Total 06@ 3D4 io@ 3D5 */ /* CRTC Rg: Overflow 07@ 3D4 io@ 3D5 */ /* CRTC Rg: Row Scan 08@ 3D4 io@ 3D5 */ /* CRTC Rg: Max Scan 09@ 3D4 io@ 3D5 */ /* CRTC Rg: Curs Beg 0A@ 3D4 io@ 3D5 */ /* CRTC Rg: Curs End 0B@ 3D4 io@ 3D5 */ /* CRTC Rg: Start Hi 0C@ 3D4 io@ 3D5 */ /* CRTC Rg: Start Lo 0D@ 3D4 io@ 3D5 */ /* CRTC Rg: CursL Hi 0E@ 3D4 io@ 3D5 */ /* CRTC Rg: CursL Lo 0F@ 3D4 io@ 3D5 */ /* CRTC Rg: V RetBeg 10@ 3D4 io@ 3D5 */ /* CRTC Rg: V RetEnd 11@ 3D4 io@ 3D5 */ /* CRTC Rg: V DisEnd 12@ 3D4 io@ 3D5 */ /* CRTC Rg: Offset 13@ 3D4 io@ 3D5 */ Val = (byte) (Hsize >> 1); BIOput (CRTC, 0x13); BIOput (CRTC + 1, Val); /* CRTC Rg: Underlin 14@ 3D4 io@ 3D5 */ /* CRTC Rg: V BlkBeg 15@ 3D4 io@ 3D5 */ /* CRTC Rg: V BlkEnd 16@ 3D4 io@ 3D5 */ /* CRTC Rg: Mode Ctl 17@ 3D4 io@ 3D5 */ /* CRTC Rg: Lin Comp 18@ 3D4 io@ 3D5 */ /* reprotect the CRTC registers */ BIOput (CRTC, 0x11); BIOput (CRTC + 1, 255 | BIOget (CRTC + 1)); } void initVideoMode (uint vmode, uint horpix, uint verlin) { Video.mode = vmode; /* usually graphics mode 0x12 */ Video.horpix = horpix; /* with 640 pixels per horizontal row */ Video.verlin = verlin; /* and 480 rows of pixels per screen */ Video.colors = 16; /* at 16 colors per pixel */ rowlin = 16; /* # of lines per character row, must be 16 */ rowsiz = horpix >> 3; /* # of bytes per row */ maxrow = verlin / rowlin; /* # of rows per screen */ } /* the following function is not ANSI C -- this code is specific to VGA */ void setVideoMode (void) /* set a VGA video mode */ #pragma aux __cdecl { uint value; byte vmode; #ifdef __WATCOMC__ extern void ASM_18 (void); #pragma aux ASM_18 = \ "mov ax,0x4f02" \ "mov bx,ss:value" \ "int 0x10" \ "mov ss:value,ax" \ modify [ax bx] extern void ASM_19 (void); #pragma aux ASM_19 = \ "xor ah,ah" \ "mov al,ss:vmode" \ "int 0x10" \ modify [ax] #endif if (Video.mode > 255) /* it is a VESA Super VGA mode */ { value = Video.mode; #ifdef __WATCOMC__ ASM_18 (); #else ASM { mov ax,0x4f02 /* function 4F: VESA, subfunction 02: set video mode */ mov bx,value int 0x10 /* BIOS Video Interrupt = 0x10 */ mov value,ax } #endif if (value != 0x4f) /* VESA call failed */ { initVideoMode (0x12, 640, 480); } } rowlin = 16; /* # of lines per character row, must be 16 */ maxrow = Video.verlin / rowlin; /* # of rows per screen */ rowsiz = Video.horpix >> 3; /* # of bytes per row */ if (Video.mode <= 255) /* it is a VGA mode */ { vmode = 255 & Video.mode; #ifdef __WATCOMC__ ASM_19 (); #else ASM { xor ah,ah /* Set Video Mode AH = 0 */ mov al,vmode int 0x10 /* BIOS Video Interrupt = 0x10 */ } #endif if ((Video.mode == 0x12) && (Video.horpix != 640)) setWiderScreen (); } } /* the following function is not ANSI C -- this code is specific to VGA */ byte GetVideoMode (void) /* get the current VGA video mode */ #pragma aux __cdecl { byte value; #ifdef __WATCOMC__ extern void ASM_20 (void); #pragma aux ASM_20 = \ "mov ah,0x0F" \ "int 0x10" \ "mov ss:value,al" \ modify [ax bx cx dx] ASM_20 (); #else ASM { mov ah,0x0F /* Get Video Mode AH = 0x0F */ int 0x10 /* BIOS Video Interrupt = 0x10 */ mov value,al } #endif return (value); } /* the following function is not ANSI C -- this code is specific to VGA */ uint GetCRTCaddress (void) /* get the 6845 CRTC address */ #pragma aux __cdecl { uint VGAdata[32]; /* 0x40 bytes of data */ VideoRec P; uint S, O; #ifdef __WATCOMC__ extern void ASM_21 (void); #pragma aux ASM_21 = \ "push di" \ "xor bx,bx" \ "mov ax,ss:S" \ "mov di,ss:O" \ "mov es,ax" \ "mov ah,0x1b" \ "int 0x10" \ "pop di" \ modify [ax bx es] #endif P.A = (void *) & (VGAdata[0]); O = P.W[0]; S = P.W[1]; #ifdef __WATCOMC__ ASM_21 (); #else ASM { push di xor bx,bx mov ax,S mov di,O /* es:di = address of 0x40 bytes */ mov es,ax mov ah,0x1b /* Get VGA status */ int 0x10 /* BIOS Video Interrupt = 0x10 */ pop di } #endif return (VGAdata[15]); } /* the following function is specific to VGA */ void GraphicsInit (void) /* opens the screen in user-specified graphics mode */ { uint i; OldMod = GetVideoMode (); OldCur = GetCursorType (); CRTC = GetCRTCaddress (); setVideoMode (); /* some graphics mode */ afont = get8by16chars (); setDisplayArea (Display); /* where to show what */ DacReg = GetColorPage (); GetVideoPalette ((Palette *) OldPal); setVideoPalette ((Palette *) G16Pal); for (i = 0; i < Video.verlin; i++) ClearVideoLine (i, 0); } /* the following function is specific to VGA */ void GraphicsQuit (void) /* restores the former screen mode */ { uint i; for (i = 0; i < Video.verlin; i++) ClearVideoLine (i, 0); setVideoPalette ((Palette *) OldPal); Video.mode = OldMod; setVideoMode (); setCursorType (OldCur); }