home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BDSC / BDSC-1 / NOBOOT.C < prev    next >
Text File  |  2000-06-30  |  2KB  |  103 lines

  1. /*
  2.     NOBOOT.C    written by Leor Zolman
  3.             3/82
  4.  
  5.     Given a list of C-generated COM files (linked with the standard
  6.     distribution version of the C.CCC run-time package), this program
  7.     changes those COM files so that they do not perform a warm-boot after
  8.     their execution is complete, but instead preserve the CCP (Console
  9.     Command Processor) that is in memory when execution begins and
  10.     return to the CCP directly following execution.
  11.  
  12.     NOTE: If a command is the object of a pipe operation using DIO,
  13.     then a warm-boot will always occur after its execution, whether
  14.     or not NOBOOT has been applied to it.
  15.  
  16.     link by:
  17.         A>clink noboot wildexp
  18.     (or)    A>l2 noboot wildexp
  19. */
  20.  
  21. #include "bdscio.h"
  22.  
  23. main(argc,argv)
  24. char **argv;
  25. {
  26.    int fd;
  27.    int i;
  28.    char c;
  29.    char nambuf[30];
  30.    char workbuf[0x500];
  31.    int loop;
  32.  
  33.    if (argc == 1) {
  34.      puts("Usage: noboot <list of C-generated COM file names>\n");
  35.     exit();
  36.    }
  37.  
  38.    for (loop = 1; loop < argc; loop++)
  39.    {
  40.     puts("NOBOOT-ing ");
  41.     puts(argv[loop]);
  42.     putchar('\n');
  43.  
  44.     for (i=0; (c = argv[loop][i]) && c != '.'; i++)
  45.          nambuf[i] = c;
  46.     nambuf[i] = '\0';
  47.     strcat(nambuf,".COM");
  48.  
  49.     if ((fd = open(nambuf,2)) == ERROR) {
  50.         puts("Can't open: ");
  51.         puts(nambuf);
  52.         exit();
  53.     }
  54.  
  55.     i = read(fd,workbuf+0x100,8);
  56.     if (i != 8) puts("Couldn't read in at least 8 sectors...\n");
  57.  
  58.     workbuf[0x100] = 0x21;
  59.     workbuf[0x101] = 0x00;
  60.     workbuf[0x102] = 0x00;
  61.     workbuf[0x103] = 0x39;
  62.     workbuf[0x104] = 0x22;
  63.     workbuf[0x105] = 0x79;
  64.     workbuf[0x106] = 0x05;
  65.     workbuf[0x107] = 0xcd;
  66.     workbuf[0x108] = 0x34;
  67.     workbuf[0x109] = 0x01;
  68.     workbuf[0x10a] = 0xf9;
  69.  
  70.     workbuf[0x12f] = 0x2a;
  71.     workbuf[0x130] = 0x79;
  72.     workbuf[0x131] = 0x05;
  73.     workbuf[0x132] = 0xf9;
  74.     workbuf[0x133] = 0xc9;
  75.  
  76.     workbuf[0x134] = 0x2a;
  77.     workbuf[0x135] = 0x06;
  78.     workbuf[0x136] = 0x00;
  79.     workbuf[0x137] = 0x11;
  80.     workbuf[0x138] = 0xcc;
  81.     workbuf[0x139] = 0xf7;
  82.     workbuf[0x13a] = 0x19;
  83.     workbuf[0x13b] = 0xc9;
  84.     workbuf[0x13c] = 0x00;
  85.     workbuf[0x13d] = 0x00;
  86.     workbuf[0x13e] = 0x00;
  87.  
  88.     workbuf[0x443] = 0xc3;
  89.     workbuf[0x444] = 0x2f;
  90.     workbuf[0x445] = 0x01;
  91.  
  92.     seek(fd,0,0);
  93.     if (write(fd,workbuf+0x100,8) != 8) {
  94.         puts("Write error.\n");
  95.         exit();
  96.     }
  97.  
  98.     if (close(fd) == ERROR) {
  99.         puts("Close error\n");
  100.     }
  101.    }
  102. }
  103.