From: sparky4 Date: Thu, 2 Jul 2015 22:44:38 +0000 (-0500) Subject: wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=1ac770860f019965706c1c3e07df40ff9849dfb0;p=16.git wwww modified: exmmtest.exe modified: src/lib/16_ca.c modified: src/lib/16_mm.c --- diff --git a/exmmtest.exe b/exmmtest.exe index c3e45c28..5f74fc42 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index e2963290..fe76ec2c 100644 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -216,43 +216,47 @@ void CAL_GetGrChunkLength (int chunk) ========================== */ -boolean CA_FarRead (int handle, byte huge *dest, dword length) +boolean CA_FarRead(int handle, byte huge *dest, dword length) { boolean flag; dword fat=0; word segm=0; - while(length>0xffffl) + if(length>0xfffflu) { - fat=length-0xffffl; - segm++; + segm=(length%0xfffflu)-1; + fat=segm*0xfffflu; + length-=fat; // printf("CA_FarRead doesn't support 64K reads yet!\n"); } - - __asm + + if(!fat&&!segm) { - push ds - mov bx,[handle] - mov cx,[WORD PTR length] - mov dx,[WORD PTR dest] - mov ds,[WORD PTR dest+2] - mov ah,0x3f // READ w/handle - int 21h - pop ds - jnc good - mov errno,ax - mov flag,0 - jmp End + __asm + { + push ds + mov bx,[handle] + mov cx,[WORD PTR length] + mov dx,[WORD PTR dest] + mov ds,[WORD PTR dest+2] + mov ah,0x3f // READ w/handle + int 21h + pop ds + jnc good + mov errno,ax + mov flag,0 + jmp End good: - cmp ax,[WORD PTR length] - je done -// errno = EINVFMT; // user manager knows this is bad read - mov flag,0 - jmp End + cmp ax,[WORD PTR length] + je done +// errno = EINVFMT; // user manager knows this is bad read + mov flag,0 + jmp End done: - mov flag,1 + mov flag,1 End: - } - return flag; + } + return flag; + }else return 0;//todo: EXPAND!!! } @@ -266,43 +270,47 @@ End: ========================== */ -boolean CA_FarWrite (int handle, byte huge *source, dword length) +boolean CA_FarWrite(int handle, byte huge *source, dword length) { boolean flag; dword fat=0; word segm=0; - while(length>0xffffl) + if(length>0xfffflu) { - fat=length-0xffffl; - segm++; + segm=(length%0xfffflu)-1; + fat=segm*0xfffflu; + length-=fat; // printf("CA_FarRead doesn't support 64K reads yet!\n"); } - - __asm + + if(!fat&&!segm) { - push ds - mov bx,[handle] - mov cx,[WORD PTR length] - mov dx,[WORD PTR source] - mov ds,[WORD PTR source+2] - mov ah,0x40 // WRITE w/handle - int 21h - pop ds - jnc good - mov errno,ax - mov flag,0 - jmp End + __asm + { + push ds + mov bx,[handle] + mov cx,[WORD PTR length] + mov dx,[WORD PTR source] + mov ds,[WORD PTR source+2] + mov ah,0x40 // WRITE w/handle + int 21h + pop ds + jnc good + mov errno,ax + mov flag,0 + jmp End good: - cmp ax,[WORD PTR length] - je done - //errno = ENOMEM; // user manager knows this is bad write - mov flag,0 - jmp End + cmp ax,[WORD PTR length] + je done + //errno = ENOMEM; // user manager knows this is bad write + mov flag,0 + jmp End done: - mov flag,1 + mov flag,1 End: - } - return flag; + } + return flag; + }else return 0; } diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 8df8cb4d..7ca7cea1 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -174,7 +174,7 @@ unsigned MML_SetupEMS(mminfo_t *mm) mov [freeEMSpages],bx or bx,bx jz noEMS // no EMS at all to allocate - +//++++EXPAND DONG!!!! cmp bx,4 jle getpages // there is only 1,2,3,or 4 pages mov bx,4 // we can't use more than 4 pages @@ -413,8 +413,9 @@ void MML_ShutdownXMS(mminfo_t *mm) void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) { mmblocktype huge *scan,huge *last; - unsigned oldend; - //++++if(mm->EMSVer) + dword oldend; + dword fat=0; + word segm=0; dword extra; scan = last = mm->mmhead; @@ -435,13 +436,19 @@ void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) oldend = scan->start + scan->length; extra = oldend - (segstart+seglength); //++++emsver stuff! - if(extra > 0xfffflu) + if(extra>0xfffflu) { - printf("MML_UseSpace: Segment spans two blocks!\n"); - //return; + segm=(extra%(0xfffflu))-1; + fat=segm*(0xfffflu); + extra-=fat; +//printf("extra=%lu ", extra); +//printf("segm=%lu\n", segm); + printf("MML_UseSpace: Segment spans two blocks!\n"); } - +//segu: +//++++todo: linked list of segment! +//printf("segm=%lu\n", segm); if(segstart == scan->start) { last->next = scan->next; // unlink block @@ -451,6 +458,8 @@ void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) else scan->length = segstart-scan->start; // shorten block +// segm--; + if(0xfffflu > extra > 0) { MM_GetNewBlock(mm); @@ -459,7 +468,7 @@ void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) mm->mmnew->start = segstart+seglength; mm->mmnew->length = extra; mm->mmnew->attributes = LOCKBIT; - } + }//else if(segm>0) goto segu; } @@ -593,13 +602,13 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi) MML_SetupEMS(mm); // allocate space printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug! //TODO: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT! - if(mm->EMSVer>=0x40) MML_UseSpace(mm->EMSpageframe,((dword)mm->EMSpagesmapped)*((dword)mm->freeEMSpages), mm); - else MML_UseSpace(mm->EMSpageframe,mm->EMSpagesmapped*0x400, mm); + if(mm->EMSVer>=0x40) MML_UseSpace(mm->EMSpageframe,((dword)mm->EMSpagesmapped)*0x4000lu, mm); + else MML_UseSpace(mm->EMSpageframe,mm->EMSpagesmapped*0x4000lu, mm); //printf("EMS3\n"); MM_MapEMS(mm); // map in used pages //printf("EMS4\n"); - if(mm->EMSVer>=0x40) mmi->EMSmem = ((dword)mm->EMSpagesmapped)*((dword)mm->freeEMSpages); - else mmi->EMSmem = mm->EMSpagesmapped*0x4000l; + if(mm->EMSVer>=0x40) mmi->EMSmem = ((dword)mm->EMSpagesmapped)*0x4000lu; + else mmi->EMSmem = mm->EMSpagesmapped*0x4000lu; } //