home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / oricon / src / oricon.c < prev    next >
Text File  |  1990-06-14  |  2KB  |  119 lines

  1. #include    <stdio.h>
  2.  
  3. #define TRUE    1
  4. #define FALSE   0
  5. #define ERR     (-1)
  6.  
  7. void    palet_init()
  8. {
  9.     static struct {
  10.     char    b,r,g;
  11.     } pal[]={
  12.     { 0x00,0x00,0x00 },    { 0xB0,0x00,0x00 },
  13.     { 0x00,0xB0,0x00 },    { 0xB0,0xB0,0x00 },
  14.     { 0x00,0x00,0xB0 },    { 0xB0,0x00,0xB0 },
  15.     { 0x00,0xB0,0xB0 },    { 0xB0,0xB0,0xB0 },
  16.     { 0xB0,0xB0,0xB0 },    { 0xF0,0x00,0x00 },
  17.     { 0x00,0xF0,0x00 },    { 0xF0,0xF0,0x00 },
  18.     { 0x00,0x00,0xF0 },    { 0xF0,0x00,0xF0 },
  19.     { 0x00,0xF0,0xF0 },    { 0xF0,0xF0,0xF0 }
  20.     };
  21.     int     i;
  22.  
  23.     for ( i = 0 ; i < 16 ; i++ ) {
  24.     outp(0xfd90,i);
  25.     outp(0xfd92,pal[i].b);
  26.     outp(0xfd94,pal[i].r);
  27.     outp(0xfd96,pal[i].g);
  28.     }
  29. }
  30. void    crtc_set(data)
  31. int    *data;
  32. {
  33.     int     i;
  34.  
  35.     for ( i = 0 ; i < 32 ; i++ ) {
  36.     outp(0x440,i);
  37.     outp(0x442,data[i]);
  38.     outp(0x443,data[i] >> 8);
  39.     }
  40. }
  41. void    crtc_onoff(val)
  42. int    val;
  43. {
  44.     outp(0x440,0x1c);
  45.     outp(0x443,val);
  46. }
  47. void    crtc_init(data)
  48. int    *data;
  49. {
  50.     crtc_onoff(0);
  51.     crtc_set(data);
  52.     crtc_onoff(data[0x1c]|0x80);
  53. }
  54. void    video_ctl(val)
  55. int    val;
  56. {
  57.     outp(0x448,0);
  58.     outp(0x44a,val);
  59.     outp(0x448,1);
  60.     outp(0x44a,val >> 8);
  61. }
  62. void    screen_init()
  63. {
  64.     static int    reg_set[]={
  65.     0x0040,0x0320,0x0000,0x0000,0x035F,0x0000,0x0010,0x0000,
  66.     0x036F,0x009C,0x031C,0x009C,0x031C,0x0040,0x0360,0x0040,
  67.     0x0360,0x0000,0x009C,0x0000,0x0050,0x0000,0x009C,0x0000,
  68.     0x0050,0x004A,0x0001,0x0000,0x003F,0x0003,0x0000,0x0150 };
  69.  
  70.     outp(0xfda0,0);
  71.     crtc_init(reg_set);
  72.     video_ctl(0x0815);
  73.     palet_init();
  74.     VDB_00();
  75.     cflush2();
  76.     outp(0xfda0,0x0f);
  77. }
  78.  
  79. void    main(argc,argv)
  80. int    argc;
  81. char    *argv[];
  82. {
  83.     int     i;
  84.     char    *cmd,*p,*s;
  85.     static char param[256];
  86.  
  87.     if ( argc <= 1 ) {
  88.     cmd = "C:\COMMAND.COM";
  89.     param[0] = 0;
  90.     param[1] = 0x0D;
  91.     } else {
  92.     i = 0;
  93.     p = param+1;
  94.     cmd = *(++argv);
  95.     argc--;
  96.     while ( --argc > 0 ) {
  97.         if ( i > 0 ) {
  98.         i++;
  99.         *(p++) = ' ';
  100.         }
  101.         s = *(++argv);
  102.         while ( *s != '\0' ) {
  103.         *(p++) = *(s++);
  104.         i++;
  105.         }
  106.     }
  107.     param[0] = i;
  108.     *p = 0x0D;
  109.     }
  110.  
  111.     screen_init();
  112.     freopen("CON","r",stdin);
  113.     freopen("CON","w",stdout);
  114.     freopen("CON","w",stderr);
  115.     setbios();
  116.     fork(cmd,param);
  117.     resetbios();
  118. }
  119.