home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************/
- /* Alloc -- */
- /* this program allocates a block of memory, given the */
- /* address of the block, and the size of the block (in K) */
- /* desired. This program was written to allocate (but not */
- /* clear) a block of memory for zkick (a program that loads */
- /* a version of kickstart into RAM). Well, my ADRAM board's */
- /* software "re-freed" the memory. As soon as it was used, */
- /* BOOM went the system. A sample startup sequence that uses */
- /* both zkick and alloc is included under the file "startup- */
- /* alloc". */
- /* */
- /* AUTHOR: Mitchell M. Evans DATE: 08 Jan 92 */
- /******************************************************************/
-
- #include <stdio.h>
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- char *block;
- int start, size;
- char *startstr, *sizestr;
-
- if (argc != 3) usage(); /* did the user use the correct # of args? */
-
- argv++; /* first arg is program name - skip it */
- startstr = *(argv++); /* this is a ptr to the starting block str */
- sizestr = *(argv++); /* this is a ptr to the size string */
-
- sscanf(startstr, "%x", &start); /* convert strings to numeric values */
- sscanf(sizestr, "%d", &size); /* for use in AllocAbs call */
-
- if ((block = (char *)AllocAbs(1024 * size, start))==0) /* alloc RAM */
- printf("Aalloc failed! Contact Mitch pronto!\n");
- exit(0);
- }
-
- /* Remind the user how the program is used. */
- usage()
- {
- printf("Usage:\n");
- printf(" alloc startloc size(K)\n");
- printf("\n\nstartloc should be in HEX notation (e.g. c000000)\n");
- printf("size should be in K (e.g. 512 for 512K block)\n\n");
- exit(1);
- }
-
-