home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
-
- 96 COLUMN WRITER
-
- This program is written in Microsoft C, version 3 or higher and
- is designed to allow the writing of up to 96 characters on the
- graphics screen of the IBM PC.
-
- It uses the font already found in the IBM PC or compatible and uses
- it to write the characters on the display.
-
- This program takes characters as entered from the keyboard and
- displays them onto the screen in 96 column format.
-
- This routine may be made resident and used to replace the BIOS
- INT10H TTY handler used by DOS when outputing data.
-
- The program can be adapted to other compilers by watching the
- following points:
-
- The peekpv and pokepv routines will have to be changed as the
- Microsoft C Compiler allows far pointers (32 bits) and
-
- the font should be changed to a single font versus the IBM FAT font
- as the characters use double vertical lines so that they
- look nicer and
-
- the address of the IBM font which is at F000:FA6E should be checked
- to ensure it coincides with your system.
-
- *******************************************************************************
-
- This program uses the shareware concept. If you find it useful, or if
- you incorporate it in other programs, please ensure that the originating author
- is acknowledged. You may also want to contribute $10 for this routine.
-
- *******************************************************************************
-
- Peter P. Vekinis, 119 N. Harvard, Arlington Heights, IL 60004, USA
-
- *******************************************************************************
-
- Copyright (C) 1986, 1987, 1988, 1989 Peter Vekinis
-
- ******************************************************************************/
-
- #define ERROR -1
- #define O_BINARY 0x8000
- #include <dos.h>
-
- main()
- {
- register i,j;
- char *msg="Hello, this is 96 column mode. As you can see we can fit more than 80 columns in one line on the screen.";
-
- pcvsvm(6); /* sets the video mode to high res graphics */
-
- read_font(); /* reads the font already dumped */
-
- for(i=0; *(msg+i) != 0; i++)
- shochat96(10,0+i,*(msg+i),0);
- }
-
-
- char norm_pt[2048]; /* the font area */
-
- read_font() /* Copy font from ROM */
- {
- register i;
-
- for(i=0; i<= 1024; i++)
- *(norm_pt+i)=(peekpv(0xf000,0xfa6e+i));
-
- }
-
-
- shochat96(row,col,chr,atr)
- int row, col;
- char chr, atr;
- {
- int i,j,chrloc, grow;
- register col1, col2;
- unsigned char k, k1;
-
- col1=(col * 6) / 8;
- col2=(col * 6) % 8;
- chrloc=chr << 3;
- grow=(row * 320) + col1;
-
-
- if(col2 == 0)
- {
- k=peekpv(0xb800,grow);
- poken(0xb800,grow,(k & 0x03) | ((*(norm_pt+chrloc) & 0xfc)));
- k=peekpv(0xb800,grow+8192);
- poken(0xb800,grow+8192,(k & 0x03) | ((*(norm_pt+chrloc+1) &
- 0xfc) ));
- k=peekpv(0xb800,grow+80);
- poken(0xb800,grow+80,(k & 0x03) | ((*(norm_pt+chrloc+2) &
- 0xfc)));
- k=peekpv(0xb800,grow+8192+80);
- poken(0xb800,grow+8192+80,(k & 0x03) | ((*(norm_pt+chrloc+3) &
- 0xfc)));
- k=peekpv(0xb800,grow+160);
- poken(0xb800,grow+160,(k & 0x03) | ((*(norm_pt+chrloc+4) &
- 0xfc) ));
- k=peekpv(0xb800,grow+160+8192);
- poken(0xb800,grow+160+8192,(k & 0x03) | ((*(norm_pt+chrloc+5) &
- 0xfc)));
- k=peekpv(0xb800,grow+240);
- poken(0xb800,grow+240,(k & 0x03) | ((*(norm_pt+chrloc+6) &
- 0xfc) ));
- k=peekpv(0xb800,grow+240+8192);
- poken(0xb800,grow+240+8192,(k & 0x03) | ((*(norm_pt+chrloc+7) &
- 0xfc)));
- }
- else
- if(col2 == 2)
- {
- k=peekpv(0xb800,grow);
- poken(0xb800,grow,(k & 0xc0) | ((*(norm_pt+chrloc) & 0xfc) >>
- 2));
- k=peekpv(0xb800,grow+8192);
- poken(0xb800,grow+8192,(k & 0xc0) | ((*(norm_pt+chrloc+1) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+80);
- poken(0xb800,grow+80,(k & 0xc0) | ((*(norm_pt+chrloc+2) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+8192+80);
- poken(0xb800,grow+8192+80,(k & 0xc0) | ((*(norm_pt+chrloc+3) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+160);
- poken(0xb800,grow+160,(k & 0xc0) | ((*(norm_pt+chrloc+4) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+160+8192);
- poken(0xb800,grow+160+8192,(k & 0xc0) | ((*(norm_pt+chrloc+5) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+240);
- poken(0xb800,grow+240,(k & 0xc0) | ((*(norm_pt+chrloc+6) &
- 0xfc) >> 2));
- k=peekpv(0xb800,grow+240+8192);
- poken(0xb800,grow+240+8192,(k & 0xc0) | ((*(norm_pt+chrloc+7) &
- 0xfc) >> 2));
- }
- else
- if(col2 == 4)
- {
- k=peekpv(0xb800,grow);
- poken(0xb800,grow,(k & 0xf0) | ((*(norm_pt+chrloc) & 0xf0) >>
- 4));
- k=peekpv(0xb800,grow+1);
- poken(0xb800,grow+1,(k & 0x3f) | ((*(norm_pt+chrloc) & 0x0c) <<
- 4));
- k=peekpv(0xb800,grow+8192);
- poken(0xb800,grow+8192,(k & 0xf0) | ((*(norm_pt+chrloc+1) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+8192);
- poken(0xb800,grow+1+8192,(k & 0x3f) | ((*(norm_pt+chrloc+1) &
- 0x0c) << 4));
- k=peekpv(0xb800,grow+80);
- poken(0xb800,grow+80,(k & 0xf0) | ((*(norm_pt+chrloc+2) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+80);
- poken(0xb800,grow+1+80,(k & 0x3f) | ((*(norm_pt+chrloc+2) &
- 0x0c) << 4));
- k=peekpv(0xb800,grow+8192+80);
- poken(0xb800,grow+8192+80,(k & 0xf0) | ((*(norm_pt+chrloc+3) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+8192+80);
- poken(0xb800,grow+1+8192+80,(k & 0x3f) | ((*(norm_pt+chrloc+3) &
- 0x0c) << 4));
- k=peekpv(0xb800,grow+160);
- poken(0xb800,grow+160,(k & 0xf0) | ((*(norm_pt+chrloc+4) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+160);
- poken(0xb800,grow+1+160,(k & 0x3f) | ((*(norm_pt+chrloc+4) &
- 0x0c) << 4));
- k=peekpv(0xb800,grow+160+8192);
- poken(0xb800,grow+160+8192,(k & 0xf0) | ((*(norm_pt+chrloc+5) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+160+8192);
- poken(0xb800,grow+1+160+8192,(k & 0x3f) | ((*(norm_pt+chrloc+5)
- & 0x0c) << 4));
- k=peekpv(0xb800,grow+240);
- poken(0xb800,grow+240,(k & 0xf0) | ((*(norm_pt+chrloc+6) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+240);
- poken(0xb800,grow+1+240,(k & 0x3f) | ((*(norm_pt+chrloc+6) &
- 0x0c) << 4));
- k=peekpv(0xb800,grow+8192+240);
- poken(0xb800,grow+8192+240,(k & 0xf0) | ((*(norm_pt+chrloc+7) &
- 0xf0) >> 4));
- k=peekpv(0xb800,grow+1+8192+240);
- poken(0xb800,grow+1+8192+240,(k & 0x3f) | ((*(norm_pt+chrloc+7)
- & 0x0c) << 4));
- }
- else
- if(col2 == 6)
- {
- k=peekpv(0xb800,grow);
- poken(0xb800,grow,(k & 0xfc) | ((*(norm_pt+chrloc) & 0xc0) >>
- 6));
- k=peekpv(0xb800,grow+1);
- poken(0xb800,grow+1,(k & 0x0f) | ((*(norm_pt+chrloc) & 0x3c) <<
- 2));
- k=peekpv(0xb800,grow+8192);
- poken(0xb800,grow+8192,(k & 0xfc) | ((*(norm_pt+chrloc+1) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+8192);
- poken(0xb800,grow+1+8192,(k & 0x0f) | ((*(norm_pt+chrloc+1) &
- 0x3c) << 2));
- k=peekpv(0xb800,grow+80);
- poken(0xb800,grow+80,(k & 0xfc) | ((*(norm_pt+chrloc+2) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+80);
- poken(0xb800,grow+1+80,(k & 0x0f) | ((*(norm_pt+chrloc+2) &
- 0x3c) << 2 ));
- k=peekpv(0xb800,grow+8192+80);
- poken(0xb800,grow+8192+80,(k & 0xfc) | ((*(norm_pt+chrloc+3) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+8192+80);
- poken(0xb800,grow+1+8192+80,(k & 0x0f) | ((*(norm_pt+chrloc+3)
- & 0x3c) << 2));
- k=peekpv(0xb800,grow+160);
- poken(0xb800,grow+160,(k & 0xfc) | ((*(norm_pt+chrloc+4) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+160);
- poken(0xb800,grow+1+160,(k & 0x0f) | ((*(norm_pt+chrloc+4) &
- 0x3c) << 2));
- k=peekpv(0xb800,grow+160+8192);
- poken(0xb800,grow+160+8192,(k & 0xfc) | ((*(norm_pt+chrloc+5) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+160+8192);
- poken(0xb800,grow+1+160+8192,(k & 0x0f) | ((*(norm_pt+chrloc+5)
- & 0x3c) << 2));
- k=peekpv(0xb800,grow+240);
- poken(0xb800,grow+240,(k & 0xfc) | ((*(norm_pt+chrloc+6) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+240);
- poken(0xb800,grow+1+240,(k & 0x0f) | ((*(norm_pt+chrloc+6) &
- 0x3c) << 2));
- k=peekpv(0xb800,grow+8192+240);
- poken(0xb800,grow+8192+240,(k & 0xfc) | ((*(norm_pt+chrloc+7) &
- 0xc0) >> 6));
- k=peekpv(0xb800,grow+1+8192+240);
- poken(0xb800,grow+1+8192+240,(k & 0x0f) | ((*(norm_pt+chrloc+7)
- & 0x3c) << 2));
- }
- }
-
-
- /******************************************************************
-
- The Peek byte function
-
- *******************************************************************/
-
- peekpv(seg,off)
- unsigned seg, off;
- {
- unsigned long seg1, off1;
- char k;
- char far *screen;
-
- seg1=seg;
- off1=off;
- screen =((seg1 << 16) | off1);
- k=*(screen);
- return k;
- }
-
- /*******************************************************************
-
- The poke byte function
-
- ********************************************************************/
- poken(seg,off,byte)
- unsigned seg, off;
- char byte;
- {
- long seg1, off1;
- char far *screen;
- seg1=seg;
- off1=off;
-
- screen =((seg1 << 16) | off1);
- *screen=byte;
- }
-
- /*******************************************************************
-
- The setvideo mode
-
- ********************************************************************/
- pcvsvm(mode)
- char mode;
- {
- union REGS regs;
-
- regs.h.ah=0;
- regs.h.al=mode;
- int86(0x10,®s,®s);
- }
-
-
-
-
-
-
-
-