home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / COMM / MISC / SRC26_2.ZIP / SRC / GLIOXA.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-03  |  5.5 KB  |  283 lines

  1. /*
  2. *    GBIOS CALL ROUTINE                              {@}
  3. *         for  PC98XA         Made by BlackRose@ROS  â╒`
  4.  * 89/09/25
  5.  *      ---- V2.4.0 distribution ----
  6. */
  7.  
  8. #include "option.h"
  9. #include "config.h"
  10. #ifdef PC98XA
  11. #ifdef UOP_GRAPHICS
  12. #include <stdio.h>
  13. #include <dos.h>
  14.  
  15. #define GINT    0x1d
  16.  
  17. typedef    unsigned char    byte;
  18. typedef    unsigned int    word;
  19.  
  20.  
  21. byte    gwork[1024+16];
  22. byte    *lioWork;
  23. word    lioBase;
  24.  
  25. union    REGS    reg;
  26. struct    SREGS    sreg;
  27.  
  28. typedef struct    {        /* parameters for gscreen. */
  29.     word    offset;
  30.     word    base;
  31. }   ParaInit;
  32.  
  33. typedef struct    {        /* parameters for gscreen. */
  34.     byte    mode;
  35.     byte    sw;
  36.     byte    activ;
  37.     byte    disp;
  38. }   ParaScreen;
  39.  
  40. typedef struct    {        /* parameters for gview. */
  41.     word    sx;
  42.     word    sy;
  43.     word    ex;
  44.     word    ey;
  45.     byte    fill;
  46.     byte    bord;
  47. }   ParaView;
  48.  
  49. typedef struct    {        /* parameters for gcolor1. */
  50.     byte    back;
  51.     byte    fore;
  52. }   ParaColor1;
  53.  
  54. typedef struct    {        /* parameters for gpset. */
  55.     word    x;
  56.     word    y;
  57.     byte    pal;
  58. }   ParaPset;
  59.  
  60. typedef struct    {        /* parameters for gline. */
  61.     word    sx;
  62.     word    sy;
  63.     word    ex;
  64.     word    ey;
  65.     byte    pal;
  66.     byte    draw;
  67.     byte    sw;
  68.     byte    fill;
  69.     byte    style;
  70.     byte    len;
  71.     word    patOff;
  72.     word    patSeg;
  73. }   ParaLine;
  74.  
  75. typedef struct    {        /* parameters for gcircle. */
  76.     word    cx;
  77.     word    cy;
  78.     word    rx;
  79.     word    ry;
  80.     byte    pal;
  81.     byte    arc;
  82.     word    sx;
  83.     word    sy;
  84.     word    ex;
  85.     word    ey;
  86.     byte    fill;
  87.     word    patOff;
  88.     word    patSeg;
  89. }   ParaCircle;
  90.  
  91. typedef struct    {        /* parameters for gput2. */
  92.     word    x;
  93.     word    y;
  94.     word    jis;
  95.     byte    draw;
  96.     byte    sw;
  97.     byte    fore;
  98.     byte    back;
  99. }   ParaPut2;
  100.  
  101. void g_int()
  102. {
  103. }
  104.  
  105. ginit()
  106. {
  107.     void    (*lf)();
  108.     int     off;
  109.     byte    *tmp;
  110.     ParaInit    *params;
  111.  
  112.     segread( &sreg );
  113.  
  114.     tmp = gwork;
  115. #if (defined(COMP_MSC) && (M_I86MM || M_I86SM)) || (__TURBOC__ && (__SMALL__ || __MEDIUM__))
  116.     lioBase = sreg.ds + FP_OFF(tmp) / 16;
  117.     off = FP_OFF(tmp) % 16;
  118. #else
  119. /* (M_I86LM || M_I86CM) || __LARGE__ || __COMPACT__*/
  120.     lioBase = FP_SEG( tmp );
  121.     off = FP_OFF( tmp );
  122. #endif
  123.  
  124.     ++lioBase;
  125.  
  126.     lioWork = (byte *) (gwork + 256 - off + 16);
  127.     params = (ParaInit *) lioWork;
  128.     lf = g_int;
  129.     params->offset = FP_OFF( lf );
  130.     params->base = FP_SEG( lf );
  131.  
  132.     reg.h.ah = 0x00;
  133.     sreg.ds = lioBase;
  134.     int86x( GINT, ®, ®, &sreg );
  135.     gstart();
  136. }
  137.  
  138. gscreen( mode, sw, activ, disp )
  139.     byte    mode, sw, activ, disp;
  140. {
  141.     ParaScreen    *params = (ParaScreen *) lioWork;
  142.  
  143.     params->mode=   ( mode == 3 || mode == 0 ) ? 0 : 1;
  144.     params->sw=     sw;
  145.     params->activ=  activ;
  146.     params->disp=   disp;
  147.  
  148.     reg.h.ah = 0x01;
  149.     sreg.ds = lioBase;
  150.     int86x( GINT, ®, ®, &sreg );
  151. }
  152.  
  153. gview( sx, sy, ex, ey, fill, bord )
  154.     word    sx, sy, ex, ey;
  155.     byte    fill, bord;
  156. {
  157.     ParaView    *params = (ParaView *) lioWork; 
  158.  
  159.     params->sx=     sx;
  160.     params->sy=     sy;
  161.     params->ex=     ex;
  162.     params->ey=     ey;
  163.     params->fill=   fill;
  164.     params->bord=   bord;
  165.  
  166.     reg.h.ah = 0x02;
  167.     sreg.ds = lioBase;
  168.     int86x( GINT, ®, ®, &sreg );
  169. }
  170.  
  171. gcolor1( back, bord, fore, mode )
  172.     byte    back, bord, fore, mode;
  173. {
  174.     ParaColor1    *params = (ParaColor1 *) lioWork;
  175.  
  176.     params->back=   back;
  177.     params->fore=   fore;
  178.  
  179.     reg.h.ah = 0x03;
  180.     sreg.ds = lioBase;
  181.     int86x( GINT, ®, ®, &sreg );
  182. }
  183.  
  184. gcls()
  185. {
  186.     reg.h.ah = 0x05;
  187.     sreg.ds = lioBase;
  188.     int86x( GINT, ®, ®, &sreg );
  189. }
  190.  
  191. gpset( x, y, pal, mode )
  192.     word    x, y;
  193.     byte    pal, mode;
  194. {
  195.     ParaPset    *params = (ParaPset *) lioWork; 
  196.  
  197.     params->x=        x;
  198.     params->y=        y;
  199.     params->pal=    pal+8;
  200.  
  201.     reg.h.ah = 0x06;
  202.     reg.h.al = mode;
  203.     sreg.ds = lioBase;
  204.     int86x( GINT, ®, ®, &sreg );
  205. }
  206.  
  207. gline( sx, sy, ex, ey, pal, draw, sw, fill, style, len, pat )
  208.     word    sx, sy, ex, ey;
  209.     word    pal, draw, sw, fill, style, len, pat;
  210. {
  211.     ParaLine    *params = (ParaLine *) lioWork;
  212.  
  213.     params->sx=     sx;
  214.     params->sy=     sy;
  215.     params->ex=     ex;
  216.     params->ey=     ey;
  217.     params->pal=    pal+8;
  218.     params->draw=   draw;
  219.     params->sw=     sw;
  220.     params->fill=   fill;
  221.     params->style=  style;
  222.     params->len=    len;
  223.     params->patOff= (unsigned)pat;
  224.     params->patSeg= lioBase;
  225.  
  226.     reg.h.ah = 0x07;
  227.     sreg.ds = lioBase;
  228.     int86x( GINT, ®, ®, &sreg );
  229. }
  230.  
  231. gcircle( cx, cy, rx, ry, pal, arc, sx, sy, ex, ey, fill, pat )
  232.     word    cx, cy, rx, ry, pal, arc, sx, sy, ex, ey, fill, pat;
  233. {
  234.     ParaCircle    *params = (ParaCircle *) lioWork;
  235.  
  236.     params->cx=     cx;
  237.     params->cy=     cy;
  238.     params->rx=     rx;
  239.     params->ry=     ry;
  240.     params->pal=    pal+8;
  241.     params->arc=    arc;
  242.     params->sx=     sx;
  243.     params->sy=     sy;
  244.     params->ex=     ex;
  245.     params->ey=     ey;
  246.     params->fill=   fill;
  247.     params->patOff= (unsigned)pat;
  248.     params->patSeg= lioBase;
  249.  
  250.     reg.h.ah = 0x08;
  251.     sreg.ds = lioBase;
  252.     int86x( GINT, ®, ®, &sreg );
  253. }
  254.  
  255. gput2( x, y, jis, draw, sw, fore, back )
  256.     word    x, y, jis;
  257.     byte    draw, sw, fore, back;
  258. {
  259.     ParaPut2    *params = (ParaPut2 *) lioWork; 
  260.  
  261.     params->x=        x;
  262.     params->y=        y;
  263.     params->jis=    jis;
  264.     params->draw=   draw;
  265.     params->sw=     sw;
  266.     params->fore=   fore;
  267.     params->back=   back;
  268.  
  269.     reg.h.ah = 0x0d;
  270.     sreg.ds = lioBase;
  271.     int86x( GINT, ®, ®, &sreg );
  272. }
  273.  
  274.  
  275. gstart()
  276. {
  277.     reg.h.ah = 0x11;
  278.     sreg.ds = lioBase;
  279.     int86x( GINT, ®, ®, &sreg );
  280. }
  281. #endif /* UOP_GRAPHICS */
  282. #endif /* PC98XA */
  283.