home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / misc / addmem2.lha / AddMem.c
Encoding:
C/C++ Source or Header  |  1992-06-05  |  953 b   |  37 lines

  1. /* AddMem2 V1.0 by Steve Snodgrass */
  2. /* Compiled with SAS/C 5.10        */
  3.  
  4. #include <exec/types.h>
  5. #include <stdio.h>
  6. #include <exec/memory.h>
  7. #include <clib/exec_protos.h>
  8. #include <pragmas/exec.h>
  9.  
  10. void main(int argc, char *argv[]) {
  11.  
  12. ULONG size, attr = MEMF_FAST|MEMF_PUBLIC;
  13. LONG pri = -1;
  14. APTR base;
  15.  
  16. ULONG bot, top;
  17.  
  18. if (argc < 3 || argc > 4) {
  19.     printf("Usage: AddMem <lower hex address> <upper hex address> [priority]\n");
  20.     printf("\nAddMem2 V1.0 by Steve Snodgrass, 1992 CPU - public domain\n");
  21.     printf("Creative Power Unlimited - PD & FreeWare is us.\n");
  22.     printf("The default memory priority is -1.\n");
  23.     exit(0);
  24.     }
  25. sscanf(argv[1],"%x",&bot);
  26. sscanf(argv[2],"%x",&top);
  27. if (argc == 4) pri = atoi(argv[3]);
  28. if (pri < -128 || pri > 127) {
  29.     printf("Illegal priority - memory not added\n");
  30.     exit(1);
  31.     }
  32. size = top-bot+1;
  33. base = (void *)bot;
  34. AddMemList(size,attr,pri,base,NULL);
  35. printf("%dK added to memory: %6x - %6x\n",size/1024,bot,top);
  36. }
  37.