larry@JPL-VLSI.ARPA (08/20/86)
[89 lines]
Microsoft C 3.0 will not correctly compile the 3.7 version of ibmpc.c
that I had. I made the changes suggested by Chow & Smith, then the
following corrections, leaving the old code to be inserted if MSC is not
defined. IBMEEOL and SCWRITE are also more than twice as fast (assuming
the old code worked on some C compiler) because each line is copied only
once and does not use a function call. The resulting code is practically
instantaneous on an AT and not much slower on an XT. Combined with
TYPEAHEAD, it is really something!
Larry @ jpl-vlsi.arpa
#if MSC /* Insert after line: #if IBMPC */
#include <dos.h>
#endif
...
#ifndef MSC
int *scptr[NROW]; /* pointer to screen lines */
int sline[NCOL]; /* screen line image */
#else
int far *scptr[NROW];
#endif
...
ibmeeol() /* erase to the end of the line */
{
int attr; /* attribute byte mask to place in RAM */
#ifndef MSC
int *lnptr; /* pointer to the destination line */
#endif
int i;
...
#ifndef MSC
lnptr = &sline[0];
for (i=0; i < NCOL; i++)
*lnptr++ = SPACE | attr;
#endif
...
#ifndef MSC
movmem(&sline[0], scptr[crow]+ccol, (NCOL-ccol)*2);
#else
for (i=ccol; i < NCOL; i++)
*(scptr[crow] + (long)(i)) = SPACE | attr;
#endif
}
scinit() /* initialize the screen head pointers */
{
#ifndef MSC
union {
long laddr; /* long form of address */
int *paddr; /* pointer form of address */
} addr;
#endif
int i;
#ifndef MSC
for (i = 0; i < NROW; i++) {
addr.laddr = SCADD + (long)(NCOL * i * 2);
scptr[i] = addr.paddr;
}
#else
for (i = 0; i < NROW; i++)
scptr[i] = (int far *)SCADD + (long)(NCOL * i);
#endif
}
scwrite(row, outstr, forg, bacg) /* write a line out*/
...
{
int attr; /* attribute byte mask to place in RAM */
#ifndef MSC
int *lnptr; /* pointer to the destination line */
#endif
int i;
...
#ifndef MSC
lnptr = &sline[0];
for (i=0; i<NCOL; i++)
*lnptr++ = (outstr[i] & 255) | attr;
#endif
...
#ifndef MSC
movmem(&sline[0], scptr[row],NCOL*2);
#else
for (i=0; i<NCOL; i++)
*(scptr[row] + (long)(i)) = (outstr[i] & 0xFF) | attr;
#endif
}