home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / vbi / example.c next >
C/C++ Source or Header  |  1987-01-01  |  2KB  |  67 lines

  1. /* vbishell.c -- vertical blank interrupt handler shell
  2.  *
  3.  * Copyright (C) 1987 by Amgem, Inc.
  4.  *
  5.  * Permission is hereby granted for anyone to make or distribute copies of
  6.  * this program provided the copyright notice and this permission notice are
  7.  * retained.
  8.  * 
  9.  * This software, or software containing all or part of it, may not be sold
  10.  * except with express permission of the authors.
  11.  *
  12.  * Authors:  Bill Dorsey & John Iarocci
  13.  *
  14.  * If you have any questions or comments, the authors may be reached at
  15.  * The Tanj BBS, (301)-251-0675.  Updates and bug fixes may also be obtained
  16.  * through the above service.
  17.  *
  18.  * The code which follows was compiled using the Mark Williams C compiler,
  19.  * but should be portable with little work to other C compilers.  See the
  20.  * associated documentation for notes on how to convert it for use with other
  21.  * C compilers
  22.  */
  23.  
  24. #include <osbind.h>
  25. #include "vbi.h"
  26.  
  27. extern PROC proctab[NPROC];
  28.  
  29. main()
  30. {
  31.   int pid1,pid2;
  32.   long i;
  33.   int process1(),process2();
  34.  
  35.   if (init() == SYSERR) {
  36.     printf("Installation failure\n");
  37.     exit(1);
  38.   }
  39.  
  40.   if ((pid1=create(process1)) == SYSERR)    /* create process 1 */
  41.     printf("Could not create process 1\n");
  42.   if ((pid2=create(process2)) == SYSERR)    /* create process 2 */
  43.     printf("Could not create process 2\n");
  44.   printf("Now entering loop...\n");
  45.   for (i=0; i<2000000L; i++)            /* delay for a while */
  46.     ;
  47.   if (delete(pid1) == SYSERR)            /* delete process 1 */
  48.     printf("Could not delete process 1\n");
  49.   if (delete(pid2) == SYSERR)            /* delete process 2 */
  50.     printf("Could not delete process 2\n");
  51.   if (remove() == SYSERR)            /* remove VBI handler */
  52.     printf("Could not remove VBI handler\n");
  53.   exit(0);                    /* return to OS */
  54. }
  55.  
  56. int process1()
  57. {
  58.   Bconout(2,'A');            /* output 'A' to console */
  59.   sleep(4);                /* 4 seconds until next call */
  60. }
  61.  
  62. int process2()
  63. {
  64.   Bconout(2,'B');            /* output 'B' to console */
  65.   sleep(5);                /* 5 seconds until next call */
  66. }
  67.