home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
273_01
/
writefn.ca
< prev
next >
Wrap
Text File
|
1988-02-11
|
1KB
|
61 lines
#include <dos.h>
writef_n(int row, int col, int attr, char *mch, int count)
/* This will write of the string of characters pointed to by mch.
Writing will stop when the end of string is reached or count characters
are written.
*/
{
extern int color, mono, cga, ega, scrseg, bios;
int scrofs, *pattr, orow, ocol ,x;
char pchar;
char far *base;
char far *work;
if(mono) base=(char far *)0xb0000000;
else base=(char far *)0xb8000000;
if(bios) {
get_cur(&orow,&ocol);
locate(row,col) ;
while(*mch && count--) {
put_ca(*mch,attr,1);
cur_rt();
mch++;
}
locate(orow,ocol);
return(0);
}
scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
work = base + scrofs;
while(*mch && count--) {
pchar = *mch;
asm mov cl,pchar
asm les bx,work
if(cga) {
asm mov dx,03dah
asm in al,dx
asm test al,1
asm jnz $-3
asm in al,dx
asm test al,1
asm jz $-3
}
asm mov byte ptr es:[bx],cl
work++;
pchar = attr;
asm mov cl,pchar
asm les bx,work;
if(cga) {
asm mov dx,03dah
asm in al,dx
asm test al,1
asm jnz $-3
asm in al,dx
asm test al,1
asm jz $-3
}
asm mov byte ptr es:[bx],cl
work++;
mch++;
}
return(0);
}