home *** CD-ROM | disk | FTP | other *** search
- /*
- * GBIOS CALL ROUTINE {@}
- * for PC98XA Made by BlackRose@ROS â╒`
- * 89/09/25
- * ---- V2.4.0 distribution ----
- */
-
- #include "option.h"
- #include "config.h"
- #ifdef PC98XA
- #ifdef UOP_GRAPHICS
- #include <stdio.h>
- #include <dos.h>
-
- #define GINT 0x1d
-
- typedef unsigned char byte;
- typedef unsigned int word;
-
-
- byte gwork[1024+16];
- byte *lioWork;
- word lioBase;
-
- union REGS reg;
- struct SREGS sreg;
-
- typedef struct { /* parameters for gscreen. */
- word offset;
- word base;
- } ParaInit;
-
- typedef struct { /* parameters for gscreen. */
- byte mode;
- byte sw;
- byte activ;
- byte disp;
- } ParaScreen;
-
- typedef struct { /* parameters for gview. */
- word sx;
- word sy;
- word ex;
- word ey;
- byte fill;
- byte bord;
- } ParaView;
-
- typedef struct { /* parameters for gcolor1. */
- byte back;
- byte fore;
- } ParaColor1;
-
- typedef struct { /* parameters for gpset. */
- word x;
- word y;
- byte pal;
- } ParaPset;
-
- typedef struct { /* parameters for gline. */
- word sx;
- word sy;
- word ex;
- word ey;
- byte pal;
- byte draw;
- byte sw;
- byte fill;
- byte style;
- byte len;
- word patOff;
- word patSeg;
- } ParaLine;
-
- typedef struct { /* parameters for gcircle. */
- word cx;
- word cy;
- word rx;
- word ry;
- byte pal;
- byte arc;
- word sx;
- word sy;
- word ex;
- word ey;
- byte fill;
- word patOff;
- word patSeg;
- } ParaCircle;
-
- typedef struct { /* parameters for gput2. */
- word x;
- word y;
- word jis;
- byte draw;
- byte sw;
- byte fore;
- byte back;
- } ParaPut2;
-
- void g_int()
- {
- }
-
- ginit()
- {
- void (*lf)();
- int off;
- byte *tmp;
- ParaInit *params;
-
- segread( &sreg );
-
- tmp = gwork;
- #if (defined(COMP_MSC) && (M_I86MM || M_I86SM)) || (__TURBOC__ && (__SMALL__ || __MEDIUM__))
- lioBase = sreg.ds + FP_OFF(tmp) / 16;
- off = FP_OFF(tmp) % 16;
- #else
- /* (M_I86LM || M_I86CM) || __LARGE__ || __COMPACT__*/
- lioBase = FP_SEG( tmp );
- off = FP_OFF( tmp );
- #endif
-
- ++lioBase;
-
- lioWork = (byte *) (gwork + 256 - off + 16);
- params = (ParaInit *) lioWork;
- lf = g_int;
- params->offset = FP_OFF( lf );
- params->base = FP_SEG( lf );
-
- reg.h.ah = 0x00;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- gstart();
- }
-
- gscreen( mode, sw, activ, disp )
- byte mode, sw, activ, disp;
- {
- ParaScreen *params = (ParaScreen *) lioWork;
-
- params->mode= ( mode == 3 || mode == 0 ) ? 0 : 1;
- params->sw= sw;
- params->activ= activ;
- params->disp= disp;
-
- reg.h.ah = 0x01;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gview( sx, sy, ex, ey, fill, bord )
- word sx, sy, ex, ey;
- byte fill, bord;
- {
- ParaView *params = (ParaView *) lioWork;
-
- params->sx= sx;
- params->sy= sy;
- params->ex= ex;
- params->ey= ey;
- params->fill= fill;
- params->bord= bord;
-
- reg.h.ah = 0x02;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gcolor1( back, bord, fore, mode )
- byte back, bord, fore, mode;
- {
- ParaColor1 *params = (ParaColor1 *) lioWork;
-
- params->back= back;
- params->fore= fore;
-
- reg.h.ah = 0x03;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gcls()
- {
- reg.h.ah = 0x05;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gpset( x, y, pal, mode )
- word x, y;
- byte pal, mode;
- {
- ParaPset *params = (ParaPset *) lioWork;
-
- params->x= x;
- params->y= y;
- params->pal= pal+8;
-
- reg.h.ah = 0x06;
- reg.h.al = mode;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gline( sx, sy, ex, ey, pal, draw, sw, fill, style, len, pat )
- word sx, sy, ex, ey;
- word pal, draw, sw, fill, style, len, pat;
- {
- ParaLine *params = (ParaLine *) lioWork;
-
- params->sx= sx;
- params->sy= sy;
- params->ex= ex;
- params->ey= ey;
- params->pal= pal+8;
- params->draw= draw;
- params->sw= sw;
- params->fill= fill;
- params->style= style;
- params->len= len;
- params->patOff= (unsigned)pat;
- params->patSeg= lioBase;
-
- reg.h.ah = 0x07;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gcircle( cx, cy, rx, ry, pal, arc, sx, sy, ex, ey, fill, pat )
- word cx, cy, rx, ry, pal, arc, sx, sy, ex, ey, fill, pat;
- {
- ParaCircle *params = (ParaCircle *) lioWork;
-
- params->cx= cx;
- params->cy= cy;
- params->rx= rx;
- params->ry= ry;
- params->pal= pal+8;
- params->arc= arc;
- params->sx= sx;
- params->sy= sy;
- params->ex= ex;
- params->ey= ey;
- params->fill= fill;
- params->patOff= (unsigned)pat;
- params->patSeg= lioBase;
-
- reg.h.ah = 0x08;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
- gput2( x, y, jis, draw, sw, fore, back )
- word x, y, jis;
- byte draw, sw, fore, back;
- {
- ParaPut2 *params = (ParaPut2 *) lioWork;
-
- params->x= x;
- params->y= y;
- params->jis= jis;
- params->draw= draw;
- params->sw= sw;
- params->fore= fore;
- params->back= back;
-
- reg.h.ah = 0x0d;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
-
-
- gstart()
- {
- reg.h.ah = 0x11;
- sreg.ds = lioBase;
- int86x( GINT, ®, ®, &sreg );
- }
- #endif /* UOP_GRAPHICS */
- #endif /* PC98XA */
-