home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
273_01
/
swriteca.ca
< prev
next >
Wrap
Text File
|
1988-02-11
|
1KB
|
58 lines
#include <dos.h>
swrite_ca(int row, int col, char *area)
/* This will do a direct video write of the character ch. It will be
placed at location row,col using attribute attr.
*/
{
extern int color, mono, cga, ega, scrseg, bios;
union REGS inregs, outregs;
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) {
locate(row,col) ;
inregs.h.bh=0x00;
inregs.h.ah=0x09;
inregs.h.al=*area;
area++;
inregs.h.bl=*area;
inregs.x.cx=0x01;
int86(0x10,&inregs,&inregs);
return(0);
}
scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
work = base + scrofs;
pchar = *area;
asm les bx,work
asm mov cl,pchar
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++;
area++;
pchar = *area;
asm les bx,work
asm mov cl,pchar
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
return(0);
}