112 lines
2.1 KiB
Plaintext
112 lines
2.1 KiB
Plaintext
#help_index "Comm"
|
|
|
|
extern void Lpt1PutChar(U1 ch);
|
|
|
|
void Irq07Handler()
|
|
{
|
|
LBts(&sema_irqs[7],0);
|
|
}
|
|
ext[EXT_IRQ07]=&Irq07Handler;
|
|
|
|
#define LPT_INIT 0x09
|
|
#define LPT_ON 0x1D
|
|
#define LPT_STROBE (LPT_ON ^ 1)
|
|
#define LPT_OFF 0x05
|
|
|
|
I8 lpt1_col=0;
|
|
|
|
public void Lpt1On()
|
|
{
|
|
lpt1_col=0;
|
|
OutP(0x77A,0); //Standard Mode
|
|
OutP(0x37A,LPT_INIT);
|
|
OutP(0x37A,LPT_ON);
|
|
}
|
|
|
|
public void Lpt1Off()
|
|
{
|
|
Sleep(1000);
|
|
OutP(0x37A,LPT_OFF);
|
|
}
|
|
|
|
void Lpt1LineFeed()
|
|
{
|
|
Lpt1PutChar(CH_CR);
|
|
Lpt1PutChar(CH_LINE_FEED);
|
|
}
|
|
|
|
public void Lpt1PutChar(U1 *ch)
|
|
{
|
|
U8 timeout_jiffies;
|
|
if (ch==CH_CURSOR) return;
|
|
|
|
timeout_jiffies=Jiffies+JIFFY_FREQ*300;
|
|
while (InP(0x379)&0xF8!=0x58 && Jiffies<timeout_jiffies)
|
|
SwapInNext;
|
|
OutP(0x378,ch);
|
|
OutP(0x37A,LPT_STROBE);
|
|
OutP(0x37A,LPT_ON);
|
|
timeout_jiffies=Jiffies+JIFFY_FREQ*300;
|
|
while (InP(0x379)&0xF8!=0x58 && Jiffies<timeout_jiffies)
|
|
SwapInNext;
|
|
|
|
if (ch>=CH_SHIFT_SPACE && ch<=0x7F) {
|
|
lpt1_col++;
|
|
if (lpt1_col>=80)
|
|
Lpt1LineFeed;
|
|
} else if (ch==CH_CR)
|
|
lpt1_col=0;
|
|
else if (ch==CH_TAB) {
|
|
lpt1_col=(lpt1_col+8) & ~7;
|
|
if (lpt1_col>=80)
|
|
Lpt1LineFeed;
|
|
}
|
|
}
|
|
|
|
public void Lpt1PrintF(I1 *src,...)
|
|
{
|
|
I1 *buf=SPrintFJoin(NULL,src,argc,argv),*ptr=buf;
|
|
while (*ptr)
|
|
Lpt1PutChar(*ptr++);
|
|
Free(buf);
|
|
}
|
|
|
|
public void Lpt1PrintLtf(Ltf *l)
|
|
{
|
|
U1 t;
|
|
BoolU4 just_did_crlf=TRUE;
|
|
I8 i;
|
|
LtfEntry *ll;
|
|
LtfRecalc(l);
|
|
ll=l->dummy.next;
|
|
Lpt1On;
|
|
while (ll!=l) {
|
|
if (just_did_crlf) {
|
|
for (i=0;i<ll->indent>>2;i++)
|
|
Lpt1PutChar(CH_SPACE);
|
|
just_did_crlf=FALSE;
|
|
}
|
|
t=ll->btype;
|
|
if (Bt(ltf_display_types,t))
|
|
Lpt1PrintF("%s",ll->display);
|
|
else if (t==LTFT_TAB)
|
|
Lpt1PutChar(CH_TAB);
|
|
else if (t==LTFT_CR || t==LTFT_SOFT_CR) {
|
|
Lpt1LineFeed;
|
|
just_did_crlf=TRUE;
|
|
}
|
|
ll=ll->next;
|
|
}
|
|
Lpt1PutChar(CH_FORM_FEED);
|
|
Lpt1Off;
|
|
}
|
|
|
|
public void Lpt1PrintFile(I1 *name)
|
|
{
|
|
Lpt1On;
|
|
Lpt1PrintF("%F",name);
|
|
Lpt1PutChar(CH_FORM_FEED);
|
|
Lpt1Off;
|
|
}
|
|
#help_index ""
|
|
|