/*/ QLIB Setup Utility v1.01a Used to modify MAX/MIN RAM alloc during QLIB startup. v1.01 - Fixed LE offset determination v1.01a - use %u instead of %i to print numbers (prevents printing neg nums) v1.02 - now can detect 'QLIB_MEM' across 64k file boundries /*/ #include #include #include #include #include //#define debug void usage(void) { printf("\nUsage : QSETUP [options] \n\n"); printf("Options:\n"); printf("--------\n"); printf("/X Maximum extended memory to alloc (in bytes)\n"); printf(" Default = 4 GBs\n"); printf("/M Minimum extended memory to alloc (in bytes)\n"); printf(" Default = 32 KBs\n"); exit(0); } void error(byte *s) { printf("Error : %s\n",s); exit(0); } int h; #define bufsiz 64*1024 byte buf[bufsiz]; byte bufc; dword max; dword min; dword omax; dword omin; byte domax=0; byte domin=0; byte ts[0x80]; byte fn[0x80]; dword bufs; dword offset; dword bufp; struct { word sign; word siz1; word siz2; word reits; word headsiz; } EXE; //total size of EXE part = (headsiz*16)+(siz2-1)*512+siz1 void qmax(byte * s) { if (!memicmp(s,"0x",2)) { max=str2numx(s); } else { max=str2num(s); } domax=1; } void qmin(byte * s) { if (!memicmp(s,"0x",2)) { min=str2numx(s); } else { min=str2num(s); } domin=1; } union { dword d1 ; struct { byte b1; byte b2; byte b3; byte b4; } b; } conv; void putmm(dword off,dword m) { conv.d1=m; buf[off+0]=conv.b.b1; buf[off+1]=conv.b.b2; buf[off+2]=conv.b.b3; buf[off+3]=conv.b.b4; } //not needed anymore dword getmm(dword off) { conv.b.b1=buf[off+0]; conv.b.b2=buf[off+1]; conv.b.b3=buf[off+2]; conv.b.b4=buf[off+3]; return conv.d1; } void main(byte argc,byte **args) { word a; word t1; printf("\nQLIB Setup Utility v1.02 (by : Peter Quiring)\n"); if (argc<2) usage(); fn[0]=0; for (a=1;a=bufs) { if (bufs