Пример #1
0
void breakfunc(int signo) {
  BYTE bCell[2];
  
  bCell[0] = 0x20;
  bCell[1] = ( WM_BLACK << 4 ) + WM_PALEGRAY;
  
  VioScrollDn(TOP_ROW,LEFT_COL,0xFFFF,0xFFFF,0xFFFF,bCell,(HVIO) 0);
  VioSetMode(&oldMode, (HVIO) 0);
  VioSetCurPos(0, 0, (HVIO)0);
  VioSetCurType(&oldCurInfo, (HVIO)0);

  switch(signo) {
  case SIGINT:
    fprintf(stderr, "Interrupt (Ctrl-C)\n"); break;
  case SIGQUIT:
    fprintf(stderr, "Quit\n"); break;
  case SIGILL:
    fprintf(stderr, "Illegal instruction\n"); break;
  case SIGFPE:
    fprintf(stderr, "Floating point\n"); break;
  case SIGKILL:
    fprintf(stderr, "Kill process\n"); break;
  case SIGBUS:
    fprintf(stderr, "Bus error\n"); break;
  case SIGSEGV:
    fprintf(stderr, "Segmentation fault\n"); break;
  case SIGTERM:
    fprintf(stderr, "Termination, process killed\n"); break;
  case SIGBREAK:
    fprintf(stderr, "Break (Ctrl-Break)\n"); break;
  }
  exit(99);
}
Пример #2
0
void Vid_Reset()
{
  StopTimeService();
  StopKeyBarService();
  VioSetMode(&OldScreenData,hvio);
  VioSetCurType(&Save,hvio);
}
Пример #3
0
void Vid_Init(int mode)
{
   OldScreenData.cb=ScreenData.cb=sizeof(ScreenData);
   VioGetMode(&OldScreenData,hvio);
   memcpy(&ScreenData,&OldScreenData,sizeof(ScreenData));
   switch (mode)
      {
      case TEXT_25:
         ScreenData.row=25;
         ScreenData.vres=400;
         break;
      case TEXT_30:
         ScreenData.row=30;
         ScreenData.vres=480;
         break;
      }
VioSetMode(&ScreenData,hvio);
VioGetMode(&ScreenData,hvio);
CELL_SIZE=ScreenData.buf_length / (ScreenData.row * ScreenData.col);
VioGetCurType(&Save,hvio);
mAcurs=&Ins[1];
Ins[0].yStart=0;
Ins[0].cEnd=ScreenData.vres/ScreenData.row;
Ins[0].cx=1;
Ins[1].yStart=ScreenData.vres/ScreenData.row-2;
Ins[1].cEnd=ScreenData.vres/ScreenData.row;
Ins[1].cx=1;
VioSetCurType(&Ins[1],hvio);
}
Пример #4
0
static void os2vio_uninit(aa_context * c)
{
  BYTE bCell[2];
  
  bCell[0] = 0x20;
  bCell[1] = ( WM_BLACK << 4 ) + WM_PALEGRAY;
  
  VioScrollDn(TOP_ROW,LEFT_COL,0xFFFF,0xFFFF,0xFFFF,bCell,(HVIO) 0);
  VioSetMode(&oldMode, (HVIO) 0);
  VioSetCurPos(0, 0, (HVIO)0);
  VioSetCurType(&oldCurInfo, (HVIO)0);
}
Пример #5
0
void xf86CloseConsole()
{
	APIRET rc;
	ULONG drive;

	if (xf86Info.consoleFd != -1) {
		KbdClose(xf86Info.consoleFd);
	}
	VioSetMode(&OriginalVideoMode,(HVIO)0);
	rc = DosQuerySysInfo(5,5,&drive,sizeof(drive));
	rc = DosSuppressPopUps(0x0000L,drive+96);    /* Reenable popups */
	rc = DosCloseEventSem(hevPopupPending);
	rc = VioDeRegister();
	return;
}
Пример #6
0
int ConSetSize(int X, int Y) {
  VIOMODEINFO vmi;
  int rc;

  assert(X <= ConMaxCols);
  assert(Y <= ConMaxRows);

  vmi.cb = sizeof(VIOMODEINFO);
  VioGetMode(&vmi, 0);
  vmi.col = (USHORT)X;
  vmi.row = (USHORT)Y;
  vmi.cb  = 2 + 1 + 1 + 2 + 2;
  rc      = VioSetMode(&vmi, 0);

  if (rc == 0) return 0;

  return -1;
}
Пример #7
0
int tty_setsize (struct winsize *ws)
{
  USHORT cx, cy;
  VIOMODEINFO vi;
  vi.cb = sizeof (vi);
  VioGetMode(&vi, 0);

  VioGetCurPos (&cx, &cy, 0);

  vi.col = ws->ws_col;
  vi.row = ws->ws_row;
  vi.cb = sizeof (vi.cb) + sizeof (vi.fbType) + sizeof (vi.color) +
          sizeof (vi.col) + sizeof (vi.row);
  VioSetMode (&vi, 0);

  VioSetCurPos (cx, cy, 0);
  return 0;
}
Пример #8
0
main() {
printf("Cells - A Cellular Automata Demo for OS/2 2.0  \n");
printf("        By John E. Stone                       \n");
printf("For comments send E-Mail to: [email protected]  \n");
printf("\n\n\n\n\n");
printf("The number of states is how many different colors\n");
printf("a pixel can take on.  The larger the number of states\n");
printf("the longer it takes to complete, and it may even become\n");
printf("stagnant with more than 20 states.\n\n");
printf("\nProcess ID=%d\n",getpid());
printf("Would you like cells to continue processing when it\n");
printf("isn't visible on the screen? (1=no, 0=yes)                 \n");
scanf("%u",&VWAIT);
if ((VWAIT<0) || (VWAIT>1)) VWAIT=0;

printf("\n\nEnter the number of states in the system: (5-25) \n");
scanf("%d",&temp2);
st=10;
srand(getpid());

if ((temp2>4) || (temp2<26)) { st=temp2; }


/* setup for graphics mode */
phys.pBuf=(unsigned char *) 0xA0000;
phys.cb=65536;

moda.cb=12;
moda.fbType=3;
moda.color=8;
moda.row=25;
moda.col=40;
moda.hres=320;
moda.vres=200;

VioGetMode(&orig, HANDLE);
VioSetMode(&moda, HANDLE);
VioGetPhysBuf(&phys, 0);
ptr0=MAKEP(phys.asel[0], 0);
VioScrLock(1, &status, HANDLE); /* Wait for exclusive screenlock */

cls(ptr0,0);

for (i=0; i<=xs; i++) {
  for (j=0; j<=ys; j++) {
         nz[i][j]=(char) rand() % st;
         oz[i][j]=nz[i][j];
  }
}
numchange=1;

while ((kbhit()==0) && (numchange>0)) {
numchange=0;
for (i=0; i<=xs; i++) {
  for (j=0; j<=ys; j++) {
    for (x=0; x<=3; x++)  {
             k=(i+nx[x]+xc) % xc;
             l=(j+ny[x]+yc) % yc;
             if (oz[k][l]==((oz[i][j]+1) % st)) {
                 nz[i][j]=(oz[k][l] % st);
		 numchange++;
	     }
    }
  }
}

memcpy(oz,nz,sizeof(nz));
VioScrLock(VWAIT,&status,HANDLE);
if (!status) {
for (i=0; i<VRES; i++) {
  for (j=0; j<HRES; j++) {
    temp=COLORSET+nz[j][i];
    putpixel(ptr0,j,i,temp);
  }
}
}

VioScrUnLock(HANDLE);
}

VioScrLock(WAIT,&status,HANDLE);
cls(ptr0,0);

VioScrUnLock(HANDLE);

} /* end of cells.c */
Пример #9
0
USHORT __pascal VIOSETMODE(const PVIOMODEINFO ModeInfo, const HVIO hvio)
{
  return VioSetMode(ModeInfo, hvio);
}
Пример #10
0
static int os2vio_init(__AA_CONST struct aa_hardware_params *p,__AA_CONST  void *none, struct aa_hardware_params *dest, void *params)
{
  static struct aa_hardware_params def=
  {NULL,
   AA_DIM_MASK | AA_REVERSE_MASK | AA_NORMAL_MASK | AA_BOLD_MASK | AA_EXTENDED,
   0, 0,
   0, 0,
   80, 32,
   0, 0};
  BYTE bCell[2];
  VIOCURSORINFO hidecur;
#ifdef __EMX__
  int idx;
  struct sigaction   sa;
#endif  
  *dest=def;
  
  /* check size or prompt for it */
  if(p->width)
    width = p->width;
  else {
    char c[255];
    width = def.recwidth;
    if(p->recwidth)
      width = p->recwidth;
    printf("Width?[%i]", width);
    gets(c);
    sscanf(c, "%i", &width);
  }
  if (p->height)
    height = p->height;
  else {
    char c[256];
    height = def.recheight;
    if (p->recheight)
      height = p->recheight;
    printf("Height?[%i]", height);
    gets(c);
    sscanf(c, "%i", &height);
  }
  if (p->maxwidth && width > p->maxwidth)
    width = p->maxwidth;
  if (p->minwidth && width < p->minwidth)
    width = p->minwidth;
  if (p->maxheight && height > p->maxheight)
    height = p->maxheight;
  if (p->minheight && height < p->minheight)
    height = p->minheight;

  /* set font for modes that we know the size for, default vga16 */
  switch(height) {
  case 50:
    p->font = &aa_font8; break;
  case 43:
    p->font = &aa_font9; break;
  case 28:
    p->font = &aa_font14; break;
  }

  RowStr = (BYTE *)malloc(2 * width * sizeof(BYTE));
  if(RowStr==NULL) return 0;

  oldMode.cb=sizeof(VIOMODEINFO);
  VioGetMode((PVIOMODEINFO) &oldMode,(HVIO) 0);
  VioGetCurType(&oldCurInfo, (HVIO)0);
  memcpy((void *) &vio_mode, (const void *) &oldMode, sizeof(VIOMODEINFO));
  /* VIO, 80x50 */
  vio_mode.fbType = 1;
  vio_mode.color = 4;
  vio_mode.col = width;
  vio_mode.row = height;
  if(width>=132)
    vio_mode.hres = 1056;
  else
    vio_mode.hres = 720;
  vio_mode.vres = 400;
  vio_mode.fmt_ID = 0;
  vio_mode.attrib = 1;

  if (VioSetMode(&vio_mode, (HVIO) 0)) return 0;

#ifdef __EMX__
  /* under EMX, catch the signals to clean up proberly */

  sa.sa_handler = breakfunc;
  sa.sa_flags   = 0;
  sigemptyset(&sa.sa_mask);
  for (idx=SIGHUP;idx<=SIGTERM;idx++)  sigaction(idx,&sa,NULL);
#endif
  
  hidecur.attr = -1;
  VioSetCurType(&hidecur, (HVIO)0);
  
  bCell[0] = 0x20;
  bCell[1] = ( WM_BLACK << 4 ) + WM_PALEGRAY;
  
  VioScrollDn(TOP_ROW,LEFT_COL,0xFFFF,0xFFFF,0xFFFF,bCell,(HVIO) 0);

#ifdef 0
  printf("minwidth=%d\nminheight=%d\n", p->minwidth, p->minheight);
  printf("maxwidth=%d\nmaxheight=%d\n", p->maxwidth, p->maxheight);
  printf("recwidth=%d\nrecheight=%d\n", p->recwidth, p->recheight);
  printf("mmwidth=%d\nmmheight=%d\n", p->mmwidth, p->mmheight);
  printf("width=%d\nheight=%d\n", p->width, p->height);
  if(p->font!=NULL) {
    printf("fontheight=%d\n", p->font->height);
    printf("fontname=%s\n", p->font->name);
    printf("fontname(short)=%s\n", p->font->shortname);
  }
  getchar();
#endif

  return 1;
}
void RestoreScreen (char *buf) {

  VioSetMode(&vio,0);
  if(buf) 
    VioWrtCellStr(buf,((vio.col + 1) * (vio.row + 1)) * 2,0,0,0);
}
Пример #12
0
void  textreg(void)
/**********************************************************************/
/*                                                                    */
/* Set the registers to text mode values.                             */
/*                                                                    */
/**********************************************************************/
/*                                                                    */
/* This is ZEDIT source material.                                     */
/*                                                                    */
/* ZEDIT Source Materials are intellectual property                   */
/*     (c) Copyright 1987,2001 by Clyde Thomas Zuber.                 */
/*                                                                    */
/**********************************************************************/
{
#ifndef AIX
#ifndef S370
#ifndef OS2
extern unsigned int  graphic;

union  regs_both  regs;


#ifdef VMS
#include <stdio.h>


if (graphic & DISPL)
    printf("S(E)%c\\", 0x1B);
else
    endwin();


#else


if (graphic & HMONO)
    {
    /* reg 0 */
    prtcntl(ADDR_REG, 0x0000);
    prtcntl(DATA_REG, 0x0061);

    /* reg 1 */
    prtcntl(ADDR_REG, 0x0001);
    prtcntl(DATA_REG, 0x0050);

    /* reg 2 */
    prtcntl(ADDR_REG, 0x0002);
    prtcntl(DATA_REG, 0x0052);

    /* reg 3 */
    prtcntl(ADDR_REG, 0x0003);
    prtcntl(DATA_REG, 0x000F);

    /* reg 4 */
    prtcntl(ADDR_REG, 0x0004);
    prtcntl(DATA_REG, 0x0019);

    /* reg 5 */
    prtcntl(ADDR_REG, 0x0005);
    prtcntl(DATA_REG, 0x0006);

    /* reg 6 */
    prtcntl(ADDR_REG, 0x0006);
    prtcntl(DATA_REG, 0x0019);

    /* reg 7 */
    prtcntl(ADDR_REG, 0x0007);
    prtcntl(DATA_REG, 0x0019);

    /* reg 9 */
    prtcntl(ADDR_REG, 0x0009);
    prtcntl(DATA_REG, 0x000D);

    /* reg 10 */
    prtcntl(ADDR_REG, 0x000A);
    prtcntl(DATA_REG, 0x000B);

    /* reg 11 */
    prtcntl(ADDR_REG, 0x000B);
    prtcntl(DATA_REG, 0x000C);
    } /* end then */

else if (graphic & NOT_H)  /* ie. CGA, EGA, IBM, etc. */
    {
    regs.h.ah = 0;
    regs.h.al = 3;
    sysint(0x10, &regs, &regs);
    } /* end then */

#endif
#else
/**********************************************************************/
/*                                                                    */
/* OS2 compile code.                                                  */
/*                                                                    */
/**********************************************************************/

VIOMODEINFO  sel;


sel.cb = 12;
sel.fbType = VGMT_OTHER;
sel.col = 80;
sel.row = 25;
sel.color = 1;
sel.hres = 720;
sel.vres = 350;
while (VioSetMode(&sel, 0) == 438)
    {;}; /* end while */

#endif
#endif
#endif
} /* end textreg */