home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / SRC / TS_BOOT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-14  |  1.5 KB  |  64 lines

  1.            /******************************************
  2.            *        CSR_DEMO.C             *
  3.            *      Copyright Chen Shuren.  1991         *
  4.                ******************************************/
  5.  
  6. #include <stdlib.h>
  7. #include <dos.h>
  8. #include <ts.h>
  9. #undef main            /*this file contains the real McCoy...*/
  10. extern int  _slint;
  11.  
  12. TS_TASK ts_main(void)
  13. {
  14.     int i;
  15.     for(i = 0; i < 4; i++){
  16.         critstart(DOS_CRCLASS);
  17.         printf("process_name -> %s\n", curproc->name);
  18.         critend(DOS_CRCLASS);
  19.     }
  20. }
  21.  
  22. static TS_TASK ts_idle(void)
  23. {
  24.     int i;
  25.     for(i = 0; i < 2; i++){
  26.         critstart(DOS_CRCLASS);
  27.         printf("process_name -> %s\n", curproc->name);
  28.         critend(DOS_CRCLASS);
  29.     }
  30. }
  31.  
  32. void main(argc ,argv ,envp) int argc; 
  33. char **argv; 
  34. char **envp;
  35. {
  36.     PROCESS bootproc;
  37.     union REGS regs ;
  38.     char *p, *inDos_ptr();
  39.     int i = 1;
  40.  
  41.     /*initialize _vidseg to user's video segment*/
  42.     regs.h.ah = 15 ;
  43.     int86( 0x10 , ®s , ®s ) ;
  44.     _vidseg = ( (regs.h.al == 7 ) ? 0xB000 : 0xB800 ) ;
  45.     if (p = getenv("SLICER"))  _slint    = atoi(p);
  46.     _DosFlag = inDos_ptr();
  47.     /*boot slicer*/
  48.     if (argc == 2)    i   = atoi(argv[1]);
  49.     _ts_boot(&bootproc) ;
  50.     ssleep() ;
  51.     tickrate(i);
  52.     if((_idleproc = spawn("TSIDLE", 0x100, ts_idle)) &&
  53.        (_mainproc = spawn("TSMAIN", 0x100, ts_main))){
  54.         _mainproc->status |= DOSCRIT;
  55.         _mainproc->nxt = _idleproc;
  56.         _idleproc->nxt = _mainproc;
  57.         init13(&_i13Flag, 0x13);  /* Slicer sleeps when in FileIO */
  58.         swake();
  59.         guc();
  60.     }
  61.     else printf("No memory for TSMAIN\r\n");
  62.     exitmp( 0xFF ) ;
  63. } /* main */
  64.