#include #define VIDEO 0x10 //video interrupt #define COLS 80 //screen width #define ROWS 25 //screen rows #define PRINTER 0x17 //BIOS printer interrupt #define LPT1 0x00 //LPT1. your first printer #define EJECT 0x0c //Eject page printer command void cls(void); void locate(int col,int row); void eject(void); void prnchar(char c); void prnstring(char *string); void cls(void) { union REGS regs; regs.h.ah=0x06; //func 6, scroll window regs.h.al=0x00; //clear screen regs.h.bh=0x07; //make screen "blank" regs.h.ch=0x00; //upper left row regs.h.cl=0x00; //upper left column regs.h.dh=ROWS-1; //lower right row regs.h.dl=COLS-1; //lower right column int86(VIDEO,®s,®s); locate(0,0); //"Home" the cursor } void locate(int col,int row) { union REGS regs; regs.h.ah=0x02; //vid func 2, move cursor regs.h.bh=0x00; //video screen (always 0) regs.h.dh=row; //cursor's row pos regs.h.dl=col; //cursor's col pos int86(VIDEO,®s,®s); } void eject(void) { prnchar(EJECT); } void prnchar(char c) { union REGS regs; regs.h.ah=0x00; //print character function regs.h.al=c; //character to print regs.x.dx=LPT1; //printer port to print to int86(PRINTER,®s,®s); } void prnstring(char *string) { while(*string) //while there's a char to print prnchar(*string++); //print it and increment }