home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
POLYEDIT.LZH
/
MODEL
/
FONTPC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-25
|
2KB
|
96 lines
#include <stdio.h>
#include <pc.h>
#include <go32.h>
#include <dpmi.h>
#include "graph.h"
static _go32_dpmi_seginfo info ;
static _go32_dpmi_registers regsh, regsz ;
static char *fontbuf ;
#define iskanji( c ) ( ( c & 0x80 ) == 0x80 )
static void putfont( int, int, int, int );
void FontInit()
{
info.size = 256 ;
_go32_dpmi_allocate_dos_memory( &info );
fontbuf = (char*)( 0xE0000000 + info.rm_segment * 16 + info.rm_offset );
/* font routine ( 1byte ) */
regsh.x.ax = 0x5000 ;
regsh.x.bx = 0x0000 ;
regsh.x.dx = 0x0810 ;
regsh.x.ss = regsh.x.sp = 0 ;
_go32_dpmi_simulate_int( 0x15, ®sh );
regsh.x.ss = regsh.x.sp = 0 ;
regsh.x.cs = regsh.x.es ;
regsh.x.ip = regsh.x.bx ;
regsh.x.es = info.rm_segment ;
regsh.x.si = info.rm_offset ;
regsh.x.ss = regsh.x.sp = 0 ;
/* font routine ( 2byte ) */
regsz.x.ax = 0x5000 ;
regsz.x.bx = 0x0100 ;
regsz.x.dx = 0x1010 ;
regsz.x.ss = regsz.x.sp = 0 ;
_go32_dpmi_simulate_int( 0x15, ®sz );
regsz.x.ss = regsz.x.sp = 0 ;
regsz.x.cs = regsz.x.es ;
regsz.x.ip = regsz.x.bx ;
regsz.x.es = info.rm_segment ;
regsz.x.si = info.rm_offset ;
regsz.x.ss = regsz.x.sp = 0 ;
}
static void putfont( x, y, c, color )
int x, y ;
int c ;
int color ;
{
if ( c < 256 )
{
regsh.x.cx = c ;
_go32_dpmi_simulate_fcall( ®sh );
graph_pattern2( x, y, color, fontbuf, 8, 16 );
}
else
{
regsz.x.cx = c ;
_go32_dpmi_simulate_fcall( ®sz );
graph_pattern2( x, y, color, fontbuf, 16, 16 );
}
}
void FontPuts( x, y, str, fg, bg )
int x, y ;
unsigned char *str ;
int fg, bg ;
{
int color ;
color = ( bg << 4 ) | fg ;
while( *str != '\0' )
{
if ( iskanji( *str ) )
{
putfont( x, y, str[0]*256+str[1], color );
x += 16 ;
str += 2 ;
}
else
{
putfont( x, y, *str, color );
x += 8 ;
str++ ;
}
}
}