Category : Word Processors
Archive   : HP22D5.ZIP
Filename : FONT.C

 
Output of file : FONT.C contained in archive : HP22D5.ZIP
#include
#include

#include "extern.h"
#include "io.h"

#define SEQ_PORT 0x3c4
#define CONTROLLER_PORT 0x3ce

WORD near SeqSetParms[] = {0x0100,0x0402,0x0704,0x0300};
WORD near ControllerSetParms[] = {0x0204,0x0005,0x0006};
WORD near SeqResetParms[] = {0x0100,0x0302,0x0304,0x0300};
WORD near ControllerResetParms[] = {0x0004,0x1005,0x0e06};

#pragma intrinsic(_disable,_enable)

static near _setup_mode()

{
register int i;

_disable();
for (i=0;i<=3;i++) outpw(SEQ_PORT,SeqSetParms[i]);
_enable();
for (i=0;i<=2;i++) outpw(CONTROLLER_PORT,ControllerSetParms[i]);
}

static near _reset_mode()

{
register int i;

_disable();
for (i=0;i<=3;i++) outpw(SEQ_PORT,SeqResetParms[i]);
_enable();
for (i=0;i<=2;i++) outpw(CONTROLLER_PORT,ControllerResetParms[i]);
}

/*
** This routine loads a font into the EGA card font memory.
**
** Parameters:
**
** fileName DOS name of the file containing the font
**
** Font File Format:
**
** This file containing the font consists of 256 characters of
** 14 bytes each. There is no heading, so the first byte in the file
** is the first byte of character 0.
**
** To call this function from HyperPAD:
**
** get loadFont("script.fnt");
** if it is "error" then
** answer "Unable to load the specified font." with "Ok";
*/
LoadFont(NumArgs,...)

int NumArgs;

{
va_list args;
int handle;
register int ch;
PTR p;

if (NumArgs != 1) return(0);

va_start(args,NumArgs);

if ((handle = open(deref(va_arg(args,HANDLE)),READ)) <= 0) {
ReturnValue(stoh("ERROR"));
return(STOP);
}

/* hide the mouse so it doesn't interfere */
HideMouse();

/* read the font, skipping unused EGA font memory */
_setup_mode();
for (ch=0,p=(PTR)0xA0000000L;ch<256;ch++,p+=32) {
read(handle,p,14);
}
_reset_mode();

close(handle);

ShowMouse();

return(STOP);
}

/*
** This routine restores the default font by reinitializing HyperPAD's
** video drivers.
*/
SetDefaultFont()

{

ReleaseHPAD();
RestoreHPAD();
return(STOP);
}

POOL pascal Pool[] = {
{ "loadFont",
LoadFont,
0,
FUNCTION},

{ "setDefaultFont",
SetDefaultFont,
0,
HANDLER},

{ NULL,
NULL,
0,
0} };


  3 Responses to “Category : Word Processors
Archive   : HP22D5.ZIP
Filename : FONT.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/