home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
oricon
/
src
/
oricon.c
< prev
next >
Wrap
Text File
|
1990-06-14
|
2KB
|
119 lines
#include <stdio.h>
#define TRUE 1
#define FALSE 0
#define ERR (-1)
void palet_init()
{
static struct {
char b,r,g;
} pal[]={
{ 0x00,0x00,0x00 }, { 0xB0,0x00,0x00 },
{ 0x00,0xB0,0x00 }, { 0xB0,0xB0,0x00 },
{ 0x00,0x00,0xB0 }, { 0xB0,0x00,0xB0 },
{ 0x00,0xB0,0xB0 }, { 0xB0,0xB0,0xB0 },
{ 0xB0,0xB0,0xB0 }, { 0xF0,0x00,0x00 },
{ 0x00,0xF0,0x00 }, { 0xF0,0xF0,0x00 },
{ 0x00,0x00,0xF0 }, { 0xF0,0x00,0xF0 },
{ 0x00,0xF0,0xF0 }, { 0xF0,0xF0,0xF0 }
};
int i;
for ( i = 0 ; i < 16 ; i++ ) {
outp(0xfd90,i);
outp(0xfd92,pal[i].b);
outp(0xfd94,pal[i].r);
outp(0xfd96,pal[i].g);
}
}
void crtc_set(data)
int *data;
{
int i;
for ( i = 0 ; i < 32 ; i++ ) {
outp(0x440,i);
outp(0x442,data[i]);
outp(0x443,data[i] >> 8);
}
}
void crtc_onoff(val)
int val;
{
outp(0x440,0x1c);
outp(0x443,val);
}
void crtc_init(data)
int *data;
{
crtc_onoff(0);
crtc_set(data);
crtc_onoff(data[0x1c]|0x80);
}
void video_ctl(val)
int val;
{
outp(0x448,0);
outp(0x44a,val);
outp(0x448,1);
outp(0x44a,val >> 8);
}
void screen_init()
{
static int reg_set[]={
0x0040,0x0320,0x0000,0x0000,0x035F,0x0000,0x0010,0x0000,
0x036F,0x009C,0x031C,0x009C,0x031C,0x0040,0x0360,0x0040,
0x0360,0x0000,0x009C,0x0000,0x0050,0x0000,0x009C,0x0000,
0x0050,0x004A,0x0001,0x0000,0x003F,0x0003,0x0000,0x0150 };
outp(0xfda0,0);
crtc_init(reg_set);
video_ctl(0x0815);
palet_init();
VDB_00();
cflush2();
outp(0xfda0,0x0f);
}
void main(argc,argv)
int argc;
char *argv[];
{
int i;
char *cmd,*p,*s;
static char param[256];
if ( argc <= 1 ) {
cmd = "C:\COMMAND.COM";
param[0] = 0;
param[1] = 0x0D;
} else {
i = 0;
p = param+1;
cmd = *(++argv);
argc--;
while ( --argc > 0 ) {
if ( i > 0 ) {
i++;
*(p++) = ' ';
}
s = *(++argv);
while ( *s != '\0' ) {
*(p++) = *(s++);
i++;
}
}
param[0] = i;
*p = 0x0D;
}
screen_init();
freopen("CON","r",stdin);
freopen("CON","w",stdout);
freopen("CON","w",stderr);
setbios();
fork(cmd,param);
resetbios();
}