]> 4ch.mooo.com Git - 16.git/commitdiff
We actually have a working EMS library now~ yay! I am going to experiment and play...
authorsparky4 <sparky4@cock.li>
Fri, 15 May 2015 18:33:19 +0000 (13:33 -0500)
committersparky4 <sparky4@cock.li>
Fri, 15 May 2015 18:33:19 +0000 (13:33 -0500)
new file:   src/lib/exmm/BAKAPEE.EXE
modified:   src/lib/exmm/EMM.EXE
deleted:    src/lib/exmm/MEMORY.MAP
new file:   src/lib/exmm/bakapee.c
modified:   src/lib/exmm/emm.c
modified:   src/lib/exmm/memory.c
modified:   src/lib/exmm/memory.h
modified:   src/lib/exmm/x.bat

src/lib/exmm/BAKAPEE.EXE [new file with mode: 0644]
src/lib/exmm/EMM.EXE
src/lib/exmm/MEMORY.MAP [deleted file]
src/lib/exmm/bakapee.c [new file with mode: 0644]
src/lib/exmm/emm.c
src/lib/exmm/memory.c
src/lib/exmm/memory.h
src/lib/exmm/x.bat

diff --git a/src/lib/exmm/BAKAPEE.EXE b/src/lib/exmm/BAKAPEE.EXE
new file mode 100644 (file)
index 0000000..2606959
Binary files /dev/null and b/src/lib/exmm/BAKAPEE.EXE differ
index 2232aceec19f24af2df5462a2b6e9fa7c69e2e5a..b9f72c3adccdf8df0512399b16c1407470d5d802 100644 (file)
Binary files a/src/lib/exmm/EMM.EXE and b/src/lib/exmm/EMM.EXE differ
diff --git a/src/lib/exmm/MEMORY.MAP b/src/lib/exmm/MEMORY.MAP
deleted file mode 100644 (file)
index 7c39ab4..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-Error: Segment _TEXT exceeds 64K\r
-\r
- Start  Stop   Length Name               Class\r
-\r
- 00000H 004F2H 004F3H MEMORY_TEXT        CODE\r
- 004F3H 40507H 40015H _TEXT              CODE\r
- 504F2H 5057DH 0008CH MEMORY_DATA        FAR_DATA\r
- 50580H 50581H 00002H FSBDTR5_FAR        FAR_DATA\r
- 50590H 50590H 00000H IOSTSTD5_FAR       FAR_DATA\r
- 50590H 505C3H 00034H IOSTSTD6_FAR       FAR_DATA\r
- 505D0H 505D0H 00000H IOSTSTD7_FAR       FAR_DATA\r
- 505D0H 50601H 00032H IOSTSTD8_FAR       FAR_DATA\r
- 50610H 50610H 00000H IOSTSTD9_FAR       FAR_DATA\r
- 50610H 50641H 00032H IOSTSTD10_FAR      FAR_DATA\r
- 50650H 50650H 00000H IOSTSTD11_FAR      FAR_DATA\r
- 50650H 50681H 00032H IOSTSTD12_FAR      FAR_DATA\r
- 50690H 50693H 00004H IOSTSTD13_FAR      FAR_DATA\r
- 506A0H 506A3H 00004H IOSTSTD14_FAR      FAR_DATA\r
- 506B0H 506B3H 00004H IOSTSTD15_FAR      FAR_DATA\r
- 506C0H 506C3H 00004H STDTR5_FAR         FAR_DATA\r
- 506D0H 506D3H 00004H STDTR6_FAR         FAR_DATA\r
- 506E0H 506E3H 00004H STDTR7_FAR         FAR_DATA\r
- 506F0H 506F3H 00004H STDTR8_FAR         FAR_DATA\r
- 50700H 50701H 00002H STDTR9_FAR         FAR_DATA\r
- 50710H 50713H 00004H STSYNC5_FAR        FAR_DATA\r
- 50720H 50723H 00004H STSYNC6_FAR        FAR_DATA\r
- 50730H 50733H 00004H STSYNC7_FAR        FAR_DATA\r
- 50734H 5161BH 00EE8H _DATA              DATA\r
- 5161CH 5161DH 00002H _CVTSEG            DATA\r
- 5161EH 51623H 00006H _SCNSEG            DATA\r
- 51624H 5164DH 0002AH _INIT_             INITDATA\r
- 5164EH 51651H 00004H _BSS               BSS\r
- 51652H 5165DH 0000CH _EXIT_             EXITDATA\r
-\r
-\r
diff --git a/src/lib/exmm/bakapee.c b/src/lib/exmm/bakapee.c
new file mode 100644 (file)
index 0000000..36fd1e1
--- /dev/null
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <stdlib.h>\r
+#include <mem.h>
+
+#include "emmret.h"\r
+#include "emmsize.h"\r
+\r
+#define     CMM                  0\r
+#define     EMM                  1
+
+static int\r
+EMReady(void)\r
+{
+       int EMSready;\r
+       _asm {\r
+               mov     ah,0x40             /* get EM Manager Status */\r
+               int     0x67
+               or      ah,ah\r
+               jns     Ready               /* returns 80, 81, or 84 hex on error */
+               mov             EMSready,FALSE
+               jmp End
+               Ready:
+               mov             EMSready,TRUE
+               End:
+       }\r
+       return(EMSready);\r
+\r
+//Ready:\r
+//    return(TRUE);\r
+}               /* End of EMReady() */
+
+static int\r
+EMVer(void)\r
+{
+       int EMSver;\r
+       _asm {
+               mov     ah,0x46\r
+               int     0x67
+               mov EMSver,ax\r
+       }
+       return(EMSver);\r
+}
+
+int main()
+{
+       int pee;
+       int rpee;
+       pee=EMVer();
+       rpee=EMReady();
+       printf("%x\n", pee);
+       printf("%x\n", rpee);
+       return 0;
+}
index f76a59e1bcb74592ad40a7be6b8f9a78fc6a2e01..60238150aeece26c4ca2b568da95b9eee7a69efd 100644 (file)
@@ -41,7 +41,7 @@ void main(void)
       exit(1);\r
       }\r
    else\r
-      printf("Emm available\n");\r
+      printf("Emm %x available\n", EMVer());\r
 \r
    pEmmData = (char *)EMMalloc(&hEData, 6);  // get 6 * 16K bytes - 96K\r
    if ( pEmmData == NULL )\r
index 423c89ef8c1d191f182311b5ebbe63a9fa998ca7..75b8664629107d2579ea0ba872430eb746553cb5 100644 (file)
@@ -3,11 +3,13 @@
  *      Module:     All Modules\r
  *      Author(s):  Chris Somers\r
  *      Date:       December 1, 1992\r
- *      Version:    V.1.1\r
+ *      Version:    V.1.1w\r
 \r
         minor mods by Alex Russell to simplify\r
 \r
         Must use memory model with FAR code\r
+
+               Open Watcom patch by sparky4~
 \r
  */\r
 \r
@@ -29,7 +31,7 @@ static int  ActiveEMList[MAXEMHANDLES];
 static unsigned int  EMMSeg;\r
 \r
  //forward declarations ---------------------------------\r
-\r
+
 static int  EMPresent(void);\r
 static int  EMReady(void);\r
 static unsigned int  GetEMMSeg(void);\r
@@ -39,7 +41,21 @@ static int  FreeEMHandle(int Handle);
 static int  GetNumPages(int Handle);\r
 static int  EMStateSave(int Handle);\r
 static void EMStateRestore(int Handle);\r
-\r
+
+/********************************************************************/
+
+int\r
+EMVer(void)\r
+{
+       int EMSver;\r
+       _asm
+       {
+               mov             ah,0x46\r
+               int             0x67
+               mov             EMSver,ax\r
+       }
+       return(EMSver);\r
+}\r
 \r
 /********************************************************************/\r
 int\r
@@ -80,22 +96,25 @@ EMMInstalled(void)
 unsigned long\r
 EMMCoreLeft(void)\r
 {\r
-    unsigned      Pages;\r
-    unsigned long RtnVal = 0UL;\r
-\r
-    _asm {\r
-        mov     ah,0x42             /* get EMM free page count */\r
-        int     0x67\r
-        or      ah,ah\r
-        js      InternalError       /* returns 80, 81, or 84 hex on error */\r
-        mov     Pages,bx            /* number of unallocated 16K pages */
+       unsigned      Pages;\r
+       unsigned long RtnVal = 0UL;
+       unsigned short interr=0;\r
+\r
+       _asm {\r
+               mov     ah,0x42             /* get EMM free page count */\r
+               int     0x67\r
+               or      ah,ah\r
+               js      InternalError       /* returns 80, 81, or 84 hex on error */\r
+               mov     Pages,bx            /* number of unallocated 16K pages */
+               jmp End
                InternalError:
-               ret\r
-    }\r
-    RtnVal = ((unsigned long)Pages << 14);  /* Pages * 16K rtns bytes*/\r
+               mov             interr,1
+               End:
+       }
+       if(!interr)
+       RtnVal = ((unsigned long)Pages << 14);  /* Pages * 16K rtns bytes*/\r
 \r
-//InternalError:\r
-    return(RtnVal);\r
+       return(RtnVal);\r
 }               /* End of EMMCoreLeft() */\r
 \r
 /********************************************************************/\r
@@ -131,25 +150,24 @@ EMMalloc(int *Handle, int Pages)
 int\r
 EMMRealloc(int Handle, int Pages)\r
 {\r
-    int     RtnCode = FALSE;\r
-\r
-    if (!EMMSeg || (Pages < 0) || (Pages > 1020)) {\r
-        return (FALSE);\r
-    }\r
-    _asm {\r
-        mov     ah,0x51             /* change # of pages */\r
-        mov     bx,Pages\r
-        mov     dx,Handle\r
-        int     0x67\r
-        or      ah,ah\r
-        js      NoGo                /* returns 80 to 88 hex on error */
+       int     RtnCode = FALSE;\r
+\r
+       if (!EMMSeg || (Pages < 0) || (Pages > 1020)) {\r
+               return (FALSE);\r
+       }\r
+       _asm {\r
+               mov     ah,0x51             /* change # of pages */\r
+               mov     bx,Pages\r
+               mov     dx,Handle\r
+               int     0x67\r
+               or      ah,ah\r
+               js      NoGo                /* returns 80 to 88 hex on error */
+               mov             RtnCode,TRUE
                NoGo:
-               ret\r
-    }\r
-    RtnCode = TRUE;\r
+       }\r
 \r
 //NoGo:\r
-    return(RtnCode);\r
+       return(RtnCode);\r
 }               /* End of EMMRealloc() */\r
 \r
 /********************************************************************/\r
@@ -253,16 +271,20 @@ EMPresent(void)
 \r
 static int\r
 EMReady(void)\r
-{\r
-    _asm {\r
-        mov     ah,0x40             /* get EM Manager Status */\r
-        int     0x67\r
-        or      ah,ah\r
-        jns     Ready               /* returns 80, 81, or 84 hex on error */
+{
+       int EMSready;\r
+       _asm {\r
+               mov     ah,0x40             /* get EM Manager Status */\r
+               int     0x67
+               or      ah,ah\r
+               jns     Ready               /* returns 80, 81, or 84 hex on error */
+               mov             EMSready,FALSE
+               jmp End
                Ready:
-               ret\r
-    }\r
-    return(FALSE);\r
+               mov             EMSready,TRUE
+               End:
+       }\r
+       return(EMSready);\r
 \r
 //Ready:\r
 //    return(TRUE);\r
@@ -273,18 +295,20 @@ EMReady(void)
 static unsigned int\r
 GetEMMSeg(void)\r
 {\r
-    unsigned int     EMSegment;\r
-\r
-    _asm {\r
-        mov     ah,0x41             /* get EMM page frame segment */\r
-        int     0x67\r
-        or      ah,ah\r
-        js      NotReady            /* returns 80, 81, or 84 hex on error */\r
-        mov     EMSegment,bx
+       unsigned int     EMSegment;\r
+\r
+       _asm {\r
+               mov     ah,0x41             /* get EMM page frame segment */\r
+               int     0x67\r
+               or      ah,ah\r
+               js      NotReady            /* returns 80, 81, or 84 hex on error */\r
+               mov     EMSegment,bx
+               jmp End
                NotReady:
-               ret\r
-    }\r
-    return(EMSegment);              /*lint !e530 */\r
+               mov     EMSegment,NOTREADY
+               End:\r
+       }\r
+       return(EMSegment);              /*lint !e530 */\r
 \r
 //NotReady:\r
 //    return(NOTREADY);\r
@@ -295,19 +319,21 @@ GetEMMSeg(void)
 static int\r
 GetEMHandle(int NumPages)\r
 {\r
-    int     NewHandle;\r
-\r
-    _asm {\r
-        mov     ah,0x43             /* get handle and allocate EM */\r
-        mov     bx,NumPages         /* number of 16K pages to allocate */\r
-        int     0x67\r
-        or      ah,ah               /* returns 80 to 89 hex on error */\r
-        js      NoHandle\r
-        mov     NewHandle,dx        /* retrieve handle */
+       int     NewHandle;\r
+\r
+       _asm {\r
+               mov     ah,0x43             /* get handle and allocate EM */\r
+               mov     bx,NumPages         /* number of 16K pages to allocate */\r
+               int     0x67\r
+               or      ah,ah               /* returns 80 to 89 hex on error */\r
+               js      NoHandle\r
+               mov     NewHandle,dx        /* retrieve handle */
+               jmp End
                NoHandle:
-               ret\r
-    }\r
-    return(NewHandle);\r
+               mov             NewHandle,NO_DATA
+               End:\r
+       }\r
+       return(NewHandle);\r
 \r
 //NoHandle:\r
 //    return(NO_DATA);\r
@@ -318,40 +344,46 @@ GetEMHandle(int NumPages)
 static int\r
 EMMap(int Handle, int LogPg, int PhyPg)\r
 {\r
-    int     RtnCode = NO_DATA;\r
-\r
-    _asm {\r
-        mov     ax,PhyPg            /* physical page: 0 - 3 in AL only */\r
-        mov     ah,0x44             /* map logical to physical page */\r
-        mov     bx,LogPg            /* logical page: 0 - 1020 */\r
-        mov     dx,Handle\r
-        int     0x67\r
-        or      ah,ah               /* returns 80 to 8B hex on error */\r
-        js      NoMapping
+       int     RtnCode = NO_DATA;\r
+\r
+       _asm {\r
+               mov     ax,PhyPg            /* physical page: 0 - 3 in AL only */\r
+               mov     ah,0x44             /* map logical to physical page */\r
+               mov     bx,LogPg            /* logical page: 0 - 1020 */\r
+               mov     dx,Handle\r
+               int     0x67\r
+               or      ah,ah               /* returns 80 to 8B hex on error */\r
+               js      NoMapping
+               mov             RtnCode,SUCCESS
+//             jmp End
                NoMapping:
-               ret\r
-    }\r
-    RtnCode = SUCCESS;\r
+//             End:\r
+       }\r
+//    RtnCode = SUCCESS;\r
 \r
 //NoMapping:\r
-    return(RtnCode);\r
+       return(RtnCode);\r
 }               /* End of EMMap() */\r
 \r
 /********************************************************************/\r
 \r
 static int\r
 FreeEMHandle(int Handle)\r
-{\r
-    _asm {\r
-        mov     ah,0x45             /* free handle and deallocate EM */\r
-        mov     dx,Handle\r
-        int     0x67\r
-        or      ah,ah               /* returns 80 to 86 hex on error */\r
-        js      NotFreed
+{
+       int FreeEMShandle;\r
+       _asm {\r
+               mov     ah,0x45             /* free handle and deallocate EM */\r
+               mov     dx,Handle\r
+               int     0x67\r
+               or      ah,ah               /* returns 80 to 86 hex on error */\r
+               js      NotFreed
+               mov             FreeEMShandle,SUCCESS
+               jmp End
                NotFreed:                           /* must retry if unsuccessful */
-               ret\r
-    }\r
-    return(SUCCESS);\r
+               mov             FreeEMShandle,NO_DATA
+               End:\r
+       }\r
+       return(FreeEMShandle);\r
 \r
 //NotFreed:                           /* must retry if unsuccessful */\r
 //    return(NO_DATA);\r
@@ -362,21 +394,22 @@ FreeEMHandle(int Handle)
 static int\r
 GetNumPages(int Handle)\r
 {\r
-    int     NumPages = 0;\r
-\r
-    _asm {\r
-        mov     ah,0x4C             /* get allocated pages for Handle */\r
-        mov     dx,Handle\r
-        int     0x67\r
-        or      ah,ah               /* returns 80 to 84 hex on error */\r
-        js      BadHandle\r
-        mov     NumPages,bx
+       int     NumPages = 0;\r
+\r
+       _asm {\r
+               mov     ah,0x4C             /* get allocated pages for Handle */\r
+               mov     dx,Handle\r
+               int     0x67\r
+               or      ah,ah               /* returns 80 to 84 hex on error */\r
+               js      BadHandle\r
+               mov     NumPages,bx
+//             jmp End
                BadHandle:
-               ret\r
-    }
+//             End:\r
+       }
 \r
 //BadHandle:\r
-    return(NumPages);\r
+       return(NumPages);\r
 }               /* End of GetNumPages() */\r
 \r
 /********************************************************************/\r
@@ -384,17 +417,17 @@ GetNumPages(int Handle)
 static int\r
 EMStateSave(int Handle)\r
 {\r
-    int     RtnCode = NO_MEMORY;\r
-    _asm {\r
-        mov     ah,0x47             /* save page map under Handle */\r
-        mov     dx,Handle\r
-        int     0x67\r
-        or      ah,ah\r
-        js      Unsaved             /* out of save space error */
+       int     RtnCode = NO_MEMORY;\r
+       _asm {\r
+               mov     ah,0x47             /* save page map under Handle */\r
+               mov     dx,Handle\r
+               int     0x67\r
+               or      ah,ah\r
+               js      Unsaved             /* out of save space error */
+               mov             RtnCode,SUCCESS
                Unsaved:
-               ret\r
-    }\r
-    RtnCode = SUCCESS;\r
+       }\r
+//    RtnCode = SUCCESS;\r
 \r
 //Unsaved:\r
     return(RtnCode);\r
index 8abc7d6bb70c71bf3c11400e9ba9a42f7d5c7bd0..9cd266b25e983d3d28f6f6ca93af121e0f1b4289 100644 (file)
@@ -18,7 +18,8 @@
 \r
 #define     CMM                  0\r
 #define     EMM                  1\r
-\r
+
+extern int EMVer(void);
 extern int      OpenEMM(void);\r
 extern void     CloseEMM(void);\r
 extern int      EMMInstalled(void);\r
index 81079d7c2a13a0dd4f63d2967e4d2e2a395c6ea6..ca0abb3726ea8254370f0dd0183f16ca14934bab 100644 (file)
@@ -1,7 +1,9 @@
-bcc -mh -c memory.c
-bcc -mh emm.c memory.obj
-move emm.exe em0.exe
-move memory.obj memory.ob
-wdis -a memory.ob > memory.asm
-wasm -c -mh -0 memory.asm
-wcp -ecc -mh emm.c memory.obj \z\borlandc\lib\ch.lib
\ No newline at end of file
+rem bcc -mh -c memory.c\r
+rem bcc -mh emm.c memory.obj\r
+rem move emm.exe em0.exe\r
+rem move memory.obj memory.ob\r
+rem wdis -a memory.ob > memory.asm\r
+rem wasm -c -mh -0 memory.asm\r
+rem wcp -ecc -mh emm.c memory.obj \z\borlandc\lib\ch.lib\r
+wcc -0 -mh memory.c\r
+wcp -mh emm.c memory.obj\r