From: sparky4 Date: Fri, 22 May 2015 20:05:10 +0000 (-0500) Subject: EMS closing in~ X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=b30d2866a785430f88c6290ba54b988e9461817f;p=16.git EMS closing in~ modified: src/lib/exmm/EMM.EXE modified: src/lib/exmm/FAR.EXE deleted: src/lib/exmm/MEMORY.ASM deleted: src/lib/exmm/MEMORY.OB deleted: src/lib/exmm/W modified: src/lib/exmm/emm.c deleted: src/lib/exmm/f.bat modified: src/lib/exmm/far.c modified: src/lib/exmm/memory.c deleted: src/lib/exmm/memory.ero modified: src/lib/exmm/memory.h modified: src/lib/exmm/x.bat --- diff --git a/src/lib/exmm/EMM.EXE b/src/lib/exmm/EMM.EXE index 6cb3fa41..1c55c916 100644 Binary files a/src/lib/exmm/EMM.EXE and b/src/lib/exmm/EMM.EXE differ diff --git a/src/lib/exmm/FAR.EXE b/src/lib/exmm/FAR.EXE index fe57024b..00353a86 100644 Binary files a/src/lib/exmm/FAR.EXE and b/src/lib/exmm/FAR.EXE differ diff --git a/src/lib/exmm/MEMORY.ASM b/src/lib/exmm/MEMORY.ASM deleted file mode 100644 index 50b665c3..00000000 --- a/src/lib/exmm/MEMORY.ASM +++ /dev/null @@ -1,702 +0,0 @@ -.387 - PUBLIC _OpenEMM - PUBLIC _CloseEMM - PUBLIC _EMMInstalled - PUBLIC _EMMCoreLeft - PUBLIC _EMMalloc - PUBLIC _EMMRealloc - PUBLIC _EMMFree - PUBLIC _MapEMM - PUBLIC _UnmapEMM - PUBLIC _UseEMM - PUBLIC _SaveEMM - EXTRN `F_LXLSH@`:BYTE - EXTRN `F_SCOPY@`:BYTE -MEMORY_TEXT SEGMENT BYTE PUBLIC USE16 'CODE' - ASSUME CS:MEMORY_TEXT, DS:DGROUP, SS:DGROUP -_OpenEMM: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - call far ptr L$65 - or ax,ax - je L$1 - call far ptr L$72 - or ax,ax - jne L$3 -L$1: - xor ax,ax -L$2: - jmp L$5 -L$3: - call far ptr L$76 - mov word ptr L$99,ax - or ax,ax - jne L$4 - jmp L$1 -L$4: - mov ax,1 - jmp L$2 -L$5: - pop ds - pop bp - retf -_CloseEMM: - push bp - mov bp,sp - push si - push ds - mov ax,MEMORY_DATA - mov ds,ax - cmp word ptr L$99,0 - jne L$6 - jmp L$10 -L$6: - xor si,si - jmp L$9 -L$7: - mov bx,si - shl bx,1 - cmp word ptr L$100[bx],0 - je L$8 - mov bx,si - shl bx,1 - push word ptr L$100[bx] - call far ptr L$87 - pop cx - mov bx,si - shl bx,1 - mov word ptr L$100[bx],0 -L$8: - inc si -L$9: - cmp si,40H - jl L$7 - mov word ptr L$99,0 -L$10: - pop ds - pop si - pop bp - retf -_EMMInstalled: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - cmp word ptr L$99,0 - je L$11 - mov ax,1 - jmp L$12 -L$11: - xor ax,ax -L$12: - jmp L$13 -L$13: - pop ds - pop bp - retf -_EMMCoreLeft: - push bp - mov bp,sp - sub sp,6 - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov word ptr -4[bp],0 - mov word ptr -6[bp],0 - mov ah,42H - int 67H - or ah,ah - js L$14 - mov word ptr -2[bp],bx - mov ax,word ptr -2[bp] - xor dx,dx - mov cl,0eH - call far ptr `F_LXLSH@` - mov word ptr -4[bp],dx - mov word ptr -6[bp],ax -L$14: - mov dx,word ptr -4[bp] - mov ax,word ptr -6[bp] - jmp L$15 -L$15: - pop ds - mov sp,bp - pop bp - retf -_EMMalloc: - push bp - mov bp,sp - sub sp,4 - push si - push di - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov di,word ptr 0aH[bp] - mov word ptr -2[bp],0 - mov word ptr -4[bp],0 - cmp word ptr L$99,0 - jne L$18 - les bx,dword ptr 6[bp] - mov word ptr es:[bx],0 -L$16: - xor dx,dx - xor ax,ax -L$17: - jmp L$26 -L$18: - cmp di,1 - jl L$19 - cmp di,3fcH - jle L$20 -L$19: - les bx,dword ptr 6[bp] - mov word ptr es:[bx],0f440H - jmp L$16 -L$20: - xor si,si - jmp L$22 -L$21: - inc si -L$22: - cmp si,40H - jge L$23 - mov bx,si - shl bx,1 - cmp word ptr L$100[bx],0 - jne L$21 -L$23: - cmp si,40H - jne L$24 - les bx,dword ptr 6[bp] - mov word ptr es:[bx],0f443H - jmp L$16 -L$24: - push di - call far ptr L$80 - pop cx - mov bx,si - shl bx,1 - mov word ptr L$100[bx],ax - or ax,ax - jle L$25 - mov ax,word ptr L$99 - mov word ptr -2[bp],ax - mov word ptr -4[bp],0 -L$25: - mov bx,si - shl bx,1 - mov ax,word ptr L$100[bx] - les bx,dword ptr 6[bp] - mov word ptr es:[bx],ax - mov dx,word ptr -2[bp] - mov ax,word ptr -4[bp] - jmp L$17 -L$26: - pop ds - pop di - pop si - mov sp,bp - pop bp - retf -_EMMRealloc: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - xor cx,cx - cmp word ptr L$99,0 - je L$27 - cmp word ptr 8[bp],0 - jl L$27 - cmp word ptr 8[bp],3fcH - jle L$29 -L$27: - xor ax,ax -L$28: - jmp L$31 -L$29: - mov ah,51H - mov bx,word ptr 8[bp] - mov dx,word ptr 6[bp] - int 67H - or ah,ah - js L$30 - mov cx,1 -L$30: - mov ax,cx - jmp L$28 -L$31: - pop ds - pop bp - retf -_EMMFree: - push bp - mov bp,sp - push si - push di - push ds - mov ax,MEMORY_DATA - mov ds,ax - cmp word ptr L$99,0 - jne L$32 - jmp L$40 -L$32: - xor si,si - jmp L$34 -L$33: - inc si -L$34: - cmp si,40H - jge L$35 - mov bx,si - shl bx,1 - mov ax,word ptr L$100[bx] - cmp ax,word ptr 6[bp] - jne L$33 -L$35: - cmp si,40H - jl L$36 - jmp L$40 -L$36: - mov di,10H - jmp L$38 -L$37: - mov bx,si - shl bx,1 - push word ptr L$100[bx] - call far ptr L$87 - pop cx - or ax,ax - je L$38 - jmp L$39 -L$38: - mov ax,di - dec di - or ax,ax - jne L$37 -L$39: - mov bx,si - shl bx,1 - mov word ptr L$100[bx],0 -L$40: - pop ds - pop di - pop si - pop bp - retf -_MapEMM: - push bp - mov bp,sp - push si - push di - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov di,word ptr 0aH[bp] - cmp word ptr L$99,0 - jne L$43 -L$41: - xor ax,ax -L$42: - jmp L$53 -L$43: - xor si,si - jmp L$45 -L$44: - inc si -L$45: - cmp si,40H - jge L$46 - mov bx,si - shl bx,1 - mov ax,word ptr L$100[bx] - cmp ax,word ptr 6[bp] - jne L$44 -L$46: - cmp si,40H - jne L$47 - jmp L$41 -L$47: - push word ptr 6[bp] - call far ptr L$91 - pop cx - cmp ax,di - jl L$48 - cmp di,1 - jl L$48 - cmp di,4 - jle L$49 -L$48: - mov ax,0f440H - jmp L$42 -L$49: - mov si,word ptr 8[bp] - jmp L$52 -L$50: - mov ax,si - sub ax,word ptr 8[bp] - push ax - push si - push word ptr 6[bp] - call far ptr L$84 - add sp,6 - or ax,ax - jne L$51 - jmp L$41 -L$51: - inc si -L$52: - mov ax,word ptr 8[bp] - add ax,di - cmp ax,si - jg L$50 - mov ax,1 - jmp L$42 -L$53: - pop ds - pop di - pop si - pop bp - retf -_UnmapEMM: - push bp - mov bp,sp - sub sp,2 - push si - push di - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov di,word ptr 6[bp] - cmp word ptr L$99,0 - jne L$54 - jmp L$63 -L$54: - xor si,si - jmp L$56 -L$55: - inc si -L$56: - cmp si,40H - jge L$57 - mov bx,si - shl bx,1 - cmp word ptr L$100[bx],di - jne L$55 -L$57: - cmp si,40H - jne L$58 - jmp L$63 -L$58: - mov ax,word ptr 8[bp] - add ax,word ptr 0aH[bp] - mov word ptr -2[bp],ax - cmp word ptr 0aH[bp],1 - jl L$59 - cmp word ptr -2[bp],4 - jle L$60 -L$59: - jmp L$63 -L$60: - mov si,word ptr 8[bp] - jmp L$62 -L$61: - push si - mov ax,0ffffH - push ax - push di - call far ptr L$84 - add sp,6 - inc si -L$62: - cmp si,word ptr -2[bp] - jl L$61 -L$63: - pop ds - pop di - pop si - mov sp,bp - pop bp - retf -_UseEMM: - push bp - mov bp,sp - push si - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov si,word ptr 6[bp] - push si - call far ptr L$94 - pop cx - push word ptr 0aH[bp] - push word ptr 8[bp] - push si - push cs - call near ptr _MapEMM - add sp,6 - jmp L$64 -L$64: - pop ds - pop si - pop bp - retf -_SaveEMM: - push bp - mov bp,sp - push si - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov si,word ptr 6[bp] - push word ptr 0aH[bp] - push word ptr 8[bp] - push si - push cs - call near ptr _UnmapEMM - add sp,6 - push si - call far ptr L$97 - pop cx - pop ds - pop si - pop bp - retf -L$65: - push bp - mov bp,sp - sub sp,14H - push ds - mov ax,MEMORY_DATA - mov ds,ax - lea ax,-0cH[bp] - push ss - push ax - mov ax,offset L$98 - push ds - push ax - mov cx,9 - call far ptr `F_SCOPY@` - push es - mov ax,3567H - int 21H - mov ax,es - mov word ptr -2[bp],ax - pop es - mov ax,word ptr -2[bp] - mov word ptr -12H[bp],ax - mov word ptr -14H[bp],0aH - lea ax,-0cH[bp] - mov word ptr -0eH[bp],ss - mov word ptr -10H[bp],ax - xor dx,dx - jmp L$67 -L$66: - inc dx -L$67: - cmp dx,8 - jge L$68 - les bx,dword ptr -10H[bp] - inc word ptr -10H[bp] - mov al,byte ptr es:[bx] - les bx,dword ptr -14H[bp] - inc word ptr -14H[bp] - cmp al,byte ptr es:[bx] - je L$66 -L$68: - cmp dx,8 - jne L$70 - mov ax,1 -L$69: - jmp L$71 -L$70: - xor ax,ax - jmp L$69 -L$71: - pop ds - mov sp,bp - pop bp - retf -L$72: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov ah,40H - int 67H - or ah,ah - jns L$74 - xor ax,ax -L$73: - jmp L$75 -L$74: - mov ax,1 - jmp L$73 -L$75: - pop ds - pop bp - retf -L$76: - push bp - mov bp,sp - sub sp,2 - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov ah,41H - int 67H - or ah,ah - js L$78 - mov word ptr -2[bp],bx - mov ax,word ptr -2[bp] -L$77: - jmp L$79 -L$78: - xor ax,ax - jmp L$77 -L$79: - pop ds - mov sp,bp - pop bp - retf -L$80: - push bp - mov bp,sp - sub sp,2 - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov ah,43H - mov bx,word ptr 6[bp] - int 67H - or ah,ah - js L$82 - mov word ptr -2[bp],dx - mov ax,word ptr -2[bp] -L$81: - jmp L$83 -L$82: - xor ax,ax - jmp L$81 -L$83: - pop ds - mov sp,bp - pop bp - retf -L$84: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - xor cx,cx - mov ax,word ptr 0aH[bp] - mov ah,44H - mov bx,word ptr 8[bp] - mov dx,word ptr 6[bp] - int 67H - or ah,ah - js L$85 - mov cx,1 -L$85: - mov ax,cx - jmp L$86 -L$86: - pop ds - pop bp - retf -L$87: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov ah,45H - mov dx,word ptr 6[bp] - int 67H - or ah,ah - js L$89 - mov ax,1 -L$88: - jmp L$90 -L$89: - xor ax,ax - jmp L$88 -L$90: - pop ds - pop bp - retf -L$91: - push bp - mov bp,sp - sub sp,2 - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov word ptr -2[bp],0 - mov ah,4cH - mov dx,word ptr 6[bp] - int 67H - or ah,ah - js L$92 - mov word ptr -2[bp],bx -L$92: - mov ax,word ptr -2[bp] - jmp L$93 -L$93: - pop ds - mov sp,bp - pop bp - retf -L$94: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov bx,0f442H - mov ah,47H - mov dx,word ptr 6[bp] - int 67H - or ah,ah - js L$95 - mov bx,1 -L$95: - mov ax,bx - jmp L$96 -L$96: - pop ds - pop bp - retf -L$97: - push bp - mov bp,sp - push ds - mov ax,MEMORY_DATA - mov ds,ax - mov ah,48H - mov dx,word ptr 6[bp] - int 67H - pop ds - pop bp - retf -MEMORY_TEXT ENDS -MEMORY_DATA SEGMENT WORD PUBLIC USE16 'FAR_DATA' -L$98: - DB 45H, 4dH, 4dH, 58H, 58H, 58H, 58H, 30H - DB 0 -L$99: - DB 0, 0 -L$100: - DB 0FH DUP(0,0,0,0,0,0,0,0) - DB 0, 0, 0, 0, 0, 0, 0, 0 - -MEMORY_DATA ENDS - END diff --git a/src/lib/exmm/MEMORY.OB b/src/lib/exmm/MEMORY.OB deleted file mode 100644 index 91bfd040..00000000 Binary files a/src/lib/exmm/MEMORY.OB and /dev/null differ diff --git a/src/lib/exmm/W b/src/lib/exmm/W deleted file mode 100644 index 20380e65..00000000 --- a/src/lib/exmm/W +++ /dev/null @@ -1,49 +0,0 @@ -bcc -mh -c -lh memory.c -Borland C++ Version 3.1 Copyright (c) 1992 Borland International -memory.c: - - Available memory 4145480 -bcc -mh emm.c memory.obj -Borland C++ Version 3.1 Copyright (c) 1992 Borland International -emm.c: -Turbo Link Version 5.1 Copyright (c) 1992 Borland International - - Available memory 4165892 -move emm.exe em0.exe -c:\z\16\src\lib\exmm\emm.exe -> c:\z\16\src\lib\exmm\em0.exe - 1 file moved -move memory.obj memory.ob -c:\z\16\src\lib\exmm\memory.obj -> c:\z\16\src\lib\exmm\memory.ob - 1 file moved -wdis -a memory.ob > memory.asm -wasm -c -mh -0 memory.asm -Open Watcom Assembler Version 1.9 -Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved. -Source code is available under the Sybase Open Watcom Public License. -See http://www.openwatcom.org/ for details. -memory.asm: 702 lines, 0 warnings, 0 errors -wcl -0 -k32768 /l=dos -ecc -mh emm.c memory.obj -Open Watcom C/C++16 Compile and Link Utility Version 1.9 -Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. -Source code is available under the Sybase Open Watcom Public License. -See http://www.openwatcom.org/ for details. - wcc EMM.C -0 -ecc -mh -Open Watcom C16 Optimizing Compiler Version 1.9 -Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. -Source code is available under the Sybase Open Watcom Public License. -See http://www.openwatcom.org/ for details. -EMM.C: 78 lines, included 1998, 0 warnings, 0 errors -Code size: 469 - wlink @__wcl__.lnk -Open Watcom Linker Version 1.9 -Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. -Source code is available under the Sybase Open Watcom Public License. -See http://www.openwatcom.org/ for details. -loading object files -searching libraries -Error! E2028: F_LXLSH@ is an undefined reference -Error! E2028: F_SCOPY@ is an undefined reference -creating a DOS executable -file MEMORY.OBJ(C:\Z\16\SRC\LIB\EXMM\memory.asm): undefined symbol F_LXLSH@ -file MEMORY.OBJ(C:\Z\16\SRC\LIB\EXMM\memory.asm): undefined symbol F_SCOPY@ -Error: Linker returned a bad status diff --git a/src/lib/exmm/emm.c b/src/lib/exmm/emm.c index fb9c6eca..a2080991 100644 --- a/src/lib/exmm/emm.c +++ b/src/lib/exmm/emm.c @@ -14,22 +14,22 @@ */ - #include #include #include +#include #include "memory.h" void TransformData(char *pEmmData, unsigned int len) { - while ( len ) - { - (*pEmmData)++; - pEmmData++; + while(len) + { + (*pEmmData)++; + pEmmData++; - len--; - } + len--; + } } int main(int argc, char *argv[]) @@ -37,18 +37,20 @@ int main(int argc, char *argv[]) byte *pEmmData; int hEData; unsigned long advi; + unsigned long i=0; + char huge *p =(char huge *)(GetEMMSeg0()*0x10000); if(OpenEMM() != SUCCESS) - { // make sure we got EMM + { // make sure we got EMM printf("EMM unavailable.\n"); exit(1); } else - { - printf("Emm %x available\n", EMVer()); - printf("EMS pages available are %lu\n", EMMCoreLeft()); - //printf("EMM Hardware Information %lu\n", EMInfo()); - } + { + printf("Emm %x available\n", EMVer()); + printf("EMS pages available are %lu\n", EMMCoreLeft()); + //printf("EMM Hardware Information %lu\n", EMInfo()); + } printf("b4 EMS pEmmData=%p\n", pEmmData); //printf("b4 EMS *pEmmData=%s\n", *pEmmData); @@ -66,14 +68,25 @@ int main(int argc, char *argv[]) printf("EMS pages available are %lu\n", EMMCoreLeft()); + + printf("Map 1st 4 pages\n"); - //MapEMM(hEData, 0, 4); // load 1st 4 pages into page frame: 0-3 MapEMM(hEData, 0, 4); // load 1st 4 pages into page frame: 0-3 //memset(pEmmData, 0x0e, 64000u); - printf("(advi*EMMPAGESIZE)=%lu\n", advi); - memset(pEmmData, atoi(argv[1]), 65536u);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); +//0000 printf("(advi*EMMPAGESIZE)=%lu\n", advi); + memset(pEmmData, atoi(argv[1]), 0xffff);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); //---- UnmapEMM(hEData, 0, 4); // not absolutely necessary +// printf("*pEmmData=%c\n", *pEmmData); + printf("%p= %c %c %c %c %c %c %c %c\n", pEmmData, +*pEmmData, *(pEmmData+1), *(pEmmData+2), *(pEmmData+3), *(pEmmData+4), *(pEmmData+5), *(pEmmData+6), *(pEmmData+7)); + /*memset(pEmmData, atoi(argv[1]), 0x40001U);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); + printf("*pEmmData=%c\n", *pEmmData); + memset(pEmmData, atoi(argv[1]), 0x40001L);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); printf("*pEmmData=%c\n", *pEmmData); + memset(pEmmData, atoi(argv[1]), 0x40001UL);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); + printf("*pEmmData=%c\n", *pEmmData); + memset(pEmmData, atoi(argv[1]), sizeof(byte)*4);//sizeof(atoi(argv[1])));//((EMMCoreLeft())*EMMPAGESIZE)); + printf("*pEmmData=%c\n", *pEmmData);*/ /*printf("Map next 2 pages\n"); MapEMM(hEData, 4, 2); // map last 2 pages: 4-5 @@ -91,16 +104,30 @@ int main(int argc, char *argv[]) // do stuff with remaining 32K of data TransformData(pEmmData, 32768UL); printf("*pEmmData=%lu\n", *pEmmData);*/ - if(!atoi(argv[2])) + if(atoi(argv[2])) + { + while(p<(char huge *)((GetEMMSeg0()*0x10000)+0xffff) && !kbhit()) + { + if((i%16)==0) printf("%p= %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c\n", p, +*p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5), *(p+6), *(p+7), +*(p+8), *(p+9), *(p+10), *(p+11), *(p+12), *(p+13), *(p+14), *(p+15)); + // (*p)++; + i++; + p++; + } + //free(p); + } + if(!atoi(argv[3])) { - UnmapEMM(hEData, 0, 4); // should unmap before freeing - //printf("after EMS *pEmmData=%c\n", *pEmmData); - printf("Close emm\n"); - EMMFree(hEData); // finished with the file data - CloseEMM(); + UnmapEMM(hEData, 0, 4); // should unmap before freeing + //printf("after EMS *pEmmData=%c\n", *pEmmData); + printf("Close emm\n"); + EMMFree(hEData); // finished with the file data + CloseEMM(); } printf("after EMS pEmmData=%p\n", pEmmData); printf("EMS pages available are %lu\n", EMMCoreLeft()); + printf("GetEMMSeg0=%p\n", GetEMMSeg0()*0x10000); //printf("EMMPAGESIZE=%d\n", EMMPAGESIZE); return 0; } diff --git a/src/lib/exmm/f.bat b/src/lib/exmm/f.bat deleted file mode 100644 index 3b6acd04..00000000 --- a/src/lib/exmm/f.bat +++ /dev/null @@ -1,3 +0,0 @@ -wcp -mh far.c -pause -far.exe diff --git a/src/lib/exmm/far.c b/src/lib/exmm/far.c index 7dcbba54..9d5f8f58 100644 --- a/src/lib/exmm/far.c +++ b/src/lib/exmm/far.c @@ -1,34 +1,36 @@ #include #include -#include +//#include -int main(){ +#include "memory.h" + +int main(int argc, char *argv[]) +{ unsigned long i=0; char near w; - char huge *p =(char far *)0xD0000000; + char huge *p =(char huge *)(GetEMMSeg0()*0x10000);//0xD0000000; //char far *q =(char far *)0x53332225; - printf("1p=%p %ul\n", p, i); - while(p<=(char far *)0xDFFFFFFF/*i<262144UL*/ && !kbhit()) + printf("1p=%p %ul\n", p, GetEMMSeg0()); + //while(!kbhit()){ printf("%p\n", ((GetEMMSeg0()*0x10000)+0x0fffffff)); } + //while(!kbhit()){ printf("%p\n", ((GetEMMSeg0()*0x10000)+0xffff)); } + if(argv[1]) { printf("switch on!\n"); while(!kbhit()){} } + while(p<=(char huge *)((GetEMMSeg0()*0x10000)+0xffff)/*i<262144UL*/ && !kbhit()) { - printf("p=%p=%x %ul\n", p, *p, i); -// *p = i; + if(argv[1]!=NULL) (*p) = i; else + //else printf("%p= %x% %ul\n", p, *p, i); + if((i%8)==0) printf("%p= %c %c %c %c %c %c %c %c\n", p, +*p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5), *(p+6), *(p+7)); // (*p)++; - p++; +// printf(" %p\n", ((GetEMMSeg0()*0x10000)+0x0fffffff)); i++; - } - /*while((_UI16_MAX/2)<=i<(_UI16_MAX) && !kbhit()) - { - printf("*p=%d %d\n",*p, i); - /p = i; - //(*p)++; p++; - i++; - }*/ + } w=104; //printf("*q=%d\n",*q); //printf(" q=%p\n", q); printf(" p=%p\n", p); printf(" w=%d\n", w); printf(" w=%p\n", w); + printf("GetEMMSeg0()=%p\n", GetEMMSeg0()*0x10000); return 0; } diff --git a/src/lib/exmm/memory.c b/src/lib/exmm/memory.c index 38b12255..21b213f8 100644 --- a/src/lib/exmm/memory.c +++ b/src/lib/exmm/memory.c @@ -28,13 +28,13 @@ //static globals -------------------------------- static int ActiveEMList[MAXEMHANDLES]; -static unsigned int EMMSeg; +static unsigned long EMMSeg; //forward declarations --------------------------------- static int EMPresent(void); static int EMReady(void); -static unsigned int GetEMMSeg(void); +static unsigned long GetEMMSeg(void); static int GetEMHandle(int NumPages); static int EMMap(int Handle, int LogPg, int PhyPg); static int FreeEMHandle(int Handle); @@ -308,7 +308,7 @@ EMReady(void) /********************************************************************/ -static unsigned int +static unsigned long GetEMMSeg(void) { unsigned int EMSegment; @@ -328,7 +328,31 @@ GetEMMSeg(void) //NotReady: // return(NOTREADY); -} /* End of GetEMMSeg() */ +} /* End of GetEMMSeg() */ + +/********************************************************************/ + +unsigned long +GetEMMSeg0(void) +{ + unsigned int EMSegment; + + _asm { + mov ah,0x41 /* get EMM page frame segment */ + int 0x67 + or ah,ah + js NotReady /* returns 80, 81, or 84 hex on error */ + mov EMSegment,bx + jmp End + NotReady: + mov EMSegment,NOTREADY + End: + } + return(EMSegment); /*lint !e530 */ + +//NotReady: +// return(NOTREADY); +} /* End of GetEMMSeg0() */ /********************************************************************/ diff --git a/src/lib/exmm/memory.ero b/src/lib/exmm/memory.ero deleted file mode 100644 index 72220273..00000000 --- a/src/lib/exmm/memory.ero +++ /dev/null @@ -1,6 +0,0 @@ -Open Watcom C16 Optimizing Compiler Version 1.9 -Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. -Source code is available under the Sybase Open Watcom Public License. -See http://www.openwatcom.org/ for details. -memory.c: 413 lines, included 1940, 0 warnings, 0 errors -Code size: 1534 diff --git a/src/lib/exmm/memory.h b/src/lib/exmm/memory.h index 6d0ff1dc..3d35d472 100644 --- a/src/lib/exmm/memory.h +++ b/src/lib/exmm/memory.h @@ -24,7 +24,8 @@ extern int EMVer(void); extern unsigned long EMInfo(void); -extern int OpenEMM(void); +extern int OpenEMM(void); +extern unsigned long GetEMMSeg0(void); extern void CloseEMM(void); extern int EMMInstalled(void); extern void far *EMMalloc(int *Handle, int Pages); diff --git a/src/lib/exmm/x.bat b/src/lib/exmm/x.bat index ca0abb37..51fa1edb 100644 --- a/src/lib/exmm/x.bat +++ b/src/lib/exmm/x.bat @@ -7,3 +7,4 @@ rem wasm -c -mh -0 memory.asm rem wcp -ecc -mh emm.c memory.obj \z\borlandc\lib\ch.lib wcc -0 -mh memory.c wcp -mh emm.c memory.obj +wcp -mh far.c memory.obj