]> 4ch.mooo.com Git - 16.git/commitdiff
wwww
authorsparky4 <sparky4@cock.li>
Thu, 2 Jul 2015 22:44:38 +0000 (17:44 -0500)
committersparky4 <sparky4@cock.li>
Thu, 2 Jul 2015 22:44:38 +0000 (17:44 -0500)
modified:   exmmtest.exe
modified:   src/lib/16_ca.c
modified:   src/lib/16_mm.c

exmmtest.exe
src/lib/16_ca.c
src/lib/16_mm.c

index c3e45c28f4ecd9be3f69f716b6cd372ffa28196a..5f74fc421fa666b13d655702949c0ca542d091cc 100644 (file)
Binary files a/exmmtest.exe and b/exmmtest.exe differ
index e2963290a8a8f40d2e42861c58e6d252245a76a7..fe76ec2c4ad5f8ef5184824ca3b6556708715766 100644 (file)
@@ -216,43 +216,47 @@ void CAL_GetGrChunkLength (int chunk)
 ==========================\r
 */\r
 \r
-boolean CA_FarRead (int handle, byte huge *dest, dword length)\r
+boolean CA_FarRead(int handle, byte huge *dest, dword length)\r
 {\r
        boolean flag;\r
        dword fat=0;
        word segm=0;\r
-       while(length>0xffffl)
+       if(length>0xfffflu)
        {
-               fat=length-0xffffl;
-               segm++;\r
+               segm=(length%0xfffflu)-1;
+               fat=segm*0xfffflu;
+               length-=fat;\r
 //             printf("CA_FarRead doesn't support 64K reads yet!\n");\r
        }
-\r
-       __asm\r
+
+       if(!fat&&!segm)
        {\r
-               push    ds\r
-               mov     bx,[handle]\r
-               mov     cx,[WORD PTR length]\r
-               mov     dx,[WORD PTR dest]\r
-               mov     ds,[WORD PTR dest+2]\r
-               mov     ah,0x3f                         // READ w/handle\r
-               int     21h\r
-               pop     ds\r
-               jnc     good\r
-               mov     errno,ax\r
-               mov     flag,0\r
-               jmp End\r
+               __asm\r
+               {\r
+                       push    ds\r
+                       mov     bx,[handle]\r
+                       mov     cx,[WORD PTR length]\r
+                       mov     dx,[WORD PTR dest]\r
+                       mov     ds,[WORD PTR dest+2]\r
+                       mov     ah,0x3f                         // READ w/handle\r
+                       int     21h\r
+                       pop     ds\r
+                       jnc     good\r
+                       mov     errno,ax\r
+                       mov     flag,0\r
+                       jmp End\r
 good:\r
-               cmp     ax,[WORD PTR length]\r
-               je      done\r
-//             errno = EINVFMT;                        // user manager knows this is bad read\r
-               mov     flag,0\r
-               jmp End\r
+                       cmp     ax,[WORD PTR length]\r
+                       je      done\r
+//                     errno = EINVFMT;                        // user manager knows this is bad read\r
+                       mov     flag,0\r
+                       jmp End\r
 done:\r
-               mov     flag,1\r
+                       mov     flag,1\r
 End:\r
-       }\r
-       return flag;\r
+               }\r
+       return flag;
+       }else return 0;//todo: EXPAND!!!\r
 }\r
 \r
 \r
@@ -266,43 +270,47 @@ End:
 ==========================\r
 */\r
 \r
-boolean CA_FarWrite (int handle, byte huge *source, dword length)\r
+boolean CA_FarWrite(int handle, byte huge *source, dword length)\r
 {\r
        boolean flag;\r
        dword fat=0;
        word segm=0;\r
-       while(length>0xffffl)
+       if(length>0xfffflu)
        {
-               fat=length-0xffffl;
-               segm++;\r
+               segm=(length%0xfffflu)-1;
+               fat=segm*0xfffflu;
+               length-=fat;\r
 //             printf("CA_FarRead doesn't support 64K reads yet!\n");\r
        }\r
-\r
-       __asm\r
+
+       if(!fat&&!segm)
        {\r
-               push    ds\r
-               mov     bx,[handle]\r
-               mov     cx,[WORD PTR length]\r
-               mov     dx,[WORD PTR source]\r
-               mov     ds,[WORD PTR source+2]\r
-               mov     ah,0x40                 // WRITE w/handle\r
-               int     21h\r
-               pop     ds\r
-               jnc     good\r
-               mov     errno,ax\r
-               mov flag,0\r
-               jmp End\r
+               __asm\r
+               {\r
+                       push    ds\r
+                       mov     bx,[handle]\r
+                       mov     cx,[WORD PTR length]\r
+                       mov     dx,[WORD PTR source]\r
+                       mov     ds,[WORD PTR source+2]\r
+                       mov     ah,0x40                 // WRITE w/handle\r
+                       int     21h\r
+                       pop     ds\r
+                       jnc     good\r
+                       mov     errno,ax\r
+                       mov flag,0\r
+                       jmp End\r
 good:\r
-               cmp     ax,[WORD PTR length]\r
-               je      done\r
-       //errno = ENOMEM;                               // user manager knows this is bad write\r
-               mov     flag,0\r
-               jmp End\r
+                       cmp     ax,[WORD PTR length]\r
+                       je      done\r
+                       //errno = ENOMEM;                               // user manager knows this is bad write\r
+                       mov     flag,0\r
+                       jmp End\r
 done:\r
-               mov     flag,1\r
+                       mov     flag,1\r
 End:\r
-       }\r
-       return flag;\r
+               }\r
+       return flag;
+       }else return 0;\r
 }\r
 \r
 \r
index 8df8cb4d90ce3c12d3392de2ca4409468350fa97..7ca7cea1e731dbc89551b0b7db8dfd811cf9532e 100644 (file)
@@ -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");\r
        }
 
-
+//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;
        }
 
 //