+++ /dev/null
-.387\r
- PUBLIC _OpenEMM\r
- PUBLIC _CloseEMM\r
- PUBLIC _EMMInstalled\r
- PUBLIC _EMMCoreLeft\r
- PUBLIC _EMMalloc\r
- PUBLIC _EMMRealloc\r
- PUBLIC _EMMFree\r
- PUBLIC _MapEMM\r
- PUBLIC _UnmapEMM\r
- PUBLIC _UseEMM\r
- PUBLIC _SaveEMM\r
- EXTRN `F_LXLSH@`:BYTE\r
- EXTRN `F_SCOPY@`:BYTE\r
-MEMORY_TEXT SEGMENT BYTE PUBLIC USE16 'CODE'\r
- ASSUME CS:MEMORY_TEXT, DS:DGROUP, SS:DGROUP\r
-_OpenEMM:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- call far ptr L$65 \r
- or ax,ax \r
- je L$1 \r
- call far ptr L$72 \r
- or ax,ax \r
- jne L$3 \r
-L$1:\r
- xor ax,ax \r
-L$2:\r
- jmp L$5 \r
-L$3:\r
- call far ptr L$76 \r
- mov word ptr L$99,ax \r
- or ax,ax \r
- jne L$4 \r
- jmp L$1 \r
-L$4:\r
- mov ax,1 \r
- jmp L$2 \r
-L$5:\r
- pop ds \r
- pop bp \r
- retf \r
-_CloseEMM:\r
- push bp \r
- mov bp,sp \r
- push si \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- cmp word ptr L$99,0 \r
- jne L$6 \r
- jmp L$10 \r
-L$6:\r
- xor si,si \r
- jmp L$9 \r
-L$7:\r
- mov bx,si \r
- shl bx,1 \r
- cmp word ptr L$100[bx],0 \r
- je L$8 \r
- mov bx,si \r
- shl bx,1 \r
- push word ptr L$100[bx] \r
- call far ptr L$87 \r
- pop cx \r
- mov bx,si \r
- shl bx,1 \r
- mov word ptr L$100[bx],0 \r
-L$8:\r
- inc si \r
-L$9:\r
- cmp si,40H \r
- jl L$7 \r
- mov word ptr L$99,0 \r
-L$10:\r
- pop ds \r
- pop si \r
- pop bp \r
- retf \r
-_EMMInstalled:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- cmp word ptr L$99,0 \r
- je L$11 \r
- mov ax,1 \r
- jmp L$12 \r
-L$11:\r
- xor ax,ax \r
-L$12:\r
- jmp L$13 \r
-L$13:\r
- pop ds \r
- pop bp \r
- retf \r
-_EMMCoreLeft:\r
- push bp \r
- mov bp,sp \r
- sub sp,6 \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov word ptr -4[bp],0 \r
- mov word ptr -6[bp],0 \r
- mov ah,42H \r
- int 67H \r
- or ah,ah \r
- js L$14 \r
- mov word ptr -2[bp],bx \r
- mov ax,word ptr -2[bp] \r
- xor dx,dx \r
- mov cl,0eH \r
- call far ptr `F_LXLSH@` \r
- mov word ptr -4[bp],dx \r
- mov word ptr -6[bp],ax \r
-L$14:\r
- mov dx,word ptr -4[bp] \r
- mov ax,word ptr -6[bp] \r
- jmp L$15 \r
-L$15:\r
- pop ds \r
- mov sp,bp \r
- pop bp \r
- retf \r
-_EMMalloc:\r
- push bp \r
- mov bp,sp \r
- sub sp,4 \r
- push si \r
- push di \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov di,word ptr 0aH[bp] \r
- mov word ptr -2[bp],0 \r
- mov word ptr -4[bp],0 \r
- cmp word ptr L$99,0 \r
- jne L$18 \r
- les bx,dword ptr 6[bp] \r
- mov word ptr es:[bx],0 \r
-L$16:\r
- xor dx,dx \r
- xor ax,ax \r
-L$17:\r
- jmp L$26 \r
-L$18:\r
- cmp di,1 \r
- jl L$19 \r
- cmp di,3fcH \r
- jle L$20 \r
-L$19:\r
- les bx,dword ptr 6[bp] \r
- mov word ptr es:[bx],0f440H \r
- jmp L$16 \r
-L$20:\r
- xor si,si \r
- jmp L$22 \r
-L$21:\r
- inc si \r
-L$22:\r
- cmp si,40H \r
- jge L$23 \r
- mov bx,si \r
- shl bx,1 \r
- cmp word ptr L$100[bx],0 \r
- jne L$21 \r
-L$23:\r
- cmp si,40H \r
- jne L$24 \r
- les bx,dword ptr 6[bp] \r
- mov word ptr es:[bx],0f443H \r
- jmp L$16 \r
-L$24:\r
- push di \r
- call far ptr L$80 \r
- pop cx \r
- mov bx,si \r
- shl bx,1 \r
- mov word ptr L$100[bx],ax \r
- or ax,ax \r
- jle L$25 \r
- mov ax,word ptr L$99 \r
- mov word ptr -2[bp],ax \r
- mov word ptr -4[bp],0 \r
-L$25:\r
- mov bx,si \r
- shl bx,1 \r
- mov ax,word ptr L$100[bx] \r
- les bx,dword ptr 6[bp] \r
- mov word ptr es:[bx],ax \r
- mov dx,word ptr -2[bp] \r
- mov ax,word ptr -4[bp] \r
- jmp L$17 \r
-L$26:\r
- pop ds \r
- pop di \r
- pop si \r
- mov sp,bp \r
- pop bp \r
- retf \r
-_EMMRealloc:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- xor cx,cx \r
- cmp word ptr L$99,0 \r
- je L$27 \r
- cmp word ptr 8[bp],0 \r
- jl L$27 \r
- cmp word ptr 8[bp],3fcH \r
- jle L$29 \r
-L$27:\r
- xor ax,ax \r
-L$28:\r
- jmp L$31 \r
-L$29:\r
- mov ah,51H \r
- mov bx,word ptr 8[bp] \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$30 \r
- mov cx,1 \r
-L$30:\r
- mov ax,cx \r
- jmp L$28 \r
-L$31:\r
- pop ds \r
- pop bp \r
- retf \r
-_EMMFree:\r
- push bp \r
- mov bp,sp \r
- push si \r
- push di \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- cmp word ptr L$99,0 \r
- jne L$32 \r
- jmp L$40 \r
-L$32:\r
- xor si,si \r
- jmp L$34 \r
-L$33:\r
- inc si \r
-L$34:\r
- cmp si,40H \r
- jge L$35 \r
- mov bx,si \r
- shl bx,1 \r
- mov ax,word ptr L$100[bx] \r
- cmp ax,word ptr 6[bp] \r
- jne L$33 \r
-L$35:\r
- cmp si,40H \r
- jl L$36 \r
- jmp L$40 \r
-L$36:\r
- mov di,10H \r
- jmp L$38 \r
-L$37:\r
- mov bx,si \r
- shl bx,1 \r
- push word ptr L$100[bx] \r
- call far ptr L$87 \r
- pop cx \r
- or ax,ax \r
- je L$38 \r
- jmp L$39 \r
-L$38:\r
- mov ax,di \r
- dec di \r
- or ax,ax \r
- jne L$37 \r
-L$39:\r
- mov bx,si \r
- shl bx,1 \r
- mov word ptr L$100[bx],0 \r
-L$40:\r
- pop ds \r
- pop di \r
- pop si \r
- pop bp \r
- retf \r
-_MapEMM:\r
- push bp \r
- mov bp,sp \r
- push si \r
- push di \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov di,word ptr 0aH[bp] \r
- cmp word ptr L$99,0 \r
- jne L$43 \r
-L$41:\r
- xor ax,ax \r
-L$42:\r
- jmp L$53 \r
-L$43:\r
- xor si,si \r
- jmp L$45 \r
-L$44:\r
- inc si \r
-L$45:\r
- cmp si,40H \r
- jge L$46 \r
- mov bx,si \r
- shl bx,1 \r
- mov ax,word ptr L$100[bx] \r
- cmp ax,word ptr 6[bp] \r
- jne L$44 \r
-L$46:\r
- cmp si,40H \r
- jne L$47 \r
- jmp L$41 \r
-L$47:\r
- push word ptr 6[bp] \r
- call far ptr L$91 \r
- pop cx \r
- cmp ax,di \r
- jl L$48 \r
- cmp di,1 \r
- jl L$48 \r
- cmp di,4 \r
- jle L$49 \r
-L$48:\r
- mov ax,0f440H \r
- jmp L$42 \r
-L$49:\r
- mov si,word ptr 8[bp] \r
- jmp L$52 \r
-L$50:\r
- mov ax,si \r
- sub ax,word ptr 8[bp] \r
- push ax \r
- push si \r
- push word ptr 6[bp] \r
- call far ptr L$84 \r
- add sp,6 \r
- or ax,ax \r
- jne L$51 \r
- jmp L$41 \r
-L$51:\r
- inc si \r
-L$52:\r
- mov ax,word ptr 8[bp] \r
- add ax,di \r
- cmp ax,si \r
- jg L$50 \r
- mov ax,1 \r
- jmp L$42 \r
-L$53:\r
- pop ds \r
- pop di \r
- pop si \r
- pop bp \r
- retf \r
-_UnmapEMM:\r
- push bp \r
- mov bp,sp \r
- sub sp,2 \r
- push si \r
- push di \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov di,word ptr 6[bp] \r
- cmp word ptr L$99,0 \r
- jne L$54 \r
- jmp L$63 \r
-L$54:\r
- xor si,si \r
- jmp L$56 \r
-L$55:\r
- inc si \r
-L$56:\r
- cmp si,40H \r
- jge L$57 \r
- mov bx,si \r
- shl bx,1 \r
- cmp word ptr L$100[bx],di \r
- jne L$55 \r
-L$57:\r
- cmp si,40H \r
- jne L$58 \r
- jmp L$63 \r
-L$58:\r
- mov ax,word ptr 8[bp] \r
- add ax,word ptr 0aH[bp] \r
- mov word ptr -2[bp],ax \r
- cmp word ptr 0aH[bp],1 \r
- jl L$59 \r
- cmp word ptr -2[bp],4 \r
- jle L$60 \r
-L$59:\r
- jmp L$63 \r
-L$60:\r
- mov si,word ptr 8[bp] \r
- jmp L$62 \r
-L$61:\r
- push si \r
- mov ax,0ffffH \r
- push ax \r
- push di \r
- call far ptr L$84 \r
- add sp,6 \r
- inc si \r
-L$62:\r
- cmp si,word ptr -2[bp] \r
- jl L$61 \r
-L$63:\r
- pop ds \r
- pop di \r
- pop si \r
- mov sp,bp \r
- pop bp \r
- retf \r
-_UseEMM:\r
- push bp \r
- mov bp,sp \r
- push si \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov si,word ptr 6[bp] \r
- push si \r
- call far ptr L$94 \r
- pop cx \r
- push word ptr 0aH[bp] \r
- push word ptr 8[bp] \r
- push si \r
- push cs \r
- call near ptr _MapEMM \r
- add sp,6 \r
- jmp L$64 \r
-L$64:\r
- pop ds \r
- pop si \r
- pop bp \r
- retf \r
-_SaveEMM:\r
- push bp \r
- mov bp,sp \r
- push si \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov si,word ptr 6[bp] \r
- push word ptr 0aH[bp] \r
- push word ptr 8[bp] \r
- push si \r
- push cs \r
- call near ptr _UnmapEMM \r
- add sp,6 \r
- push si \r
- call far ptr L$97 \r
- pop cx \r
- pop ds \r
- pop si \r
- pop bp \r
- retf \r
-L$65:\r
- push bp \r
- mov bp,sp \r
- sub sp,14H \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- lea ax,-0cH[bp] \r
- push ss \r
- push ax \r
- mov ax,offset L$98 \r
- push ds \r
- push ax \r
- mov cx,9 \r
- call far ptr `F_SCOPY@` \r
- push es \r
- mov ax,3567H \r
- int 21H \r
- mov ax,es \r
- mov word ptr -2[bp],ax \r
- pop es \r
- mov ax,word ptr -2[bp] \r
- mov word ptr -12H[bp],ax \r
- mov word ptr -14H[bp],0aH \r
- lea ax,-0cH[bp] \r
- mov word ptr -0eH[bp],ss \r
- mov word ptr -10H[bp],ax \r
- xor dx,dx \r
- jmp L$67 \r
-L$66:\r
- inc dx \r
-L$67:\r
- cmp dx,8 \r
- jge L$68 \r
- les bx,dword ptr -10H[bp] \r
- inc word ptr -10H[bp] \r
- mov al,byte ptr es:[bx] \r
- les bx,dword ptr -14H[bp] \r
- inc word ptr -14H[bp] \r
- cmp al,byte ptr es:[bx] \r
- je L$66 \r
-L$68:\r
- cmp dx,8 \r
- jne L$70 \r
- mov ax,1 \r
-L$69:\r
- jmp L$71 \r
-L$70:\r
- xor ax,ax \r
- jmp L$69 \r
-L$71:\r
- pop ds \r
- mov sp,bp \r
- pop bp \r
- retf \r
-L$72:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov ah,40H \r
- int 67H \r
- or ah,ah \r
- jns L$74 \r
- xor ax,ax \r
-L$73:\r
- jmp L$75 \r
-L$74:\r
- mov ax,1 \r
- jmp L$73 \r
-L$75:\r
- pop ds \r
- pop bp \r
- retf \r
-L$76:\r
- push bp \r
- mov bp,sp \r
- sub sp,2 \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov ah,41H \r
- int 67H \r
- or ah,ah \r
- js L$78 \r
- mov word ptr -2[bp],bx \r
- mov ax,word ptr -2[bp] \r
-L$77:\r
- jmp L$79 \r
-L$78:\r
- xor ax,ax \r
- jmp L$77 \r
-L$79:\r
- pop ds \r
- mov sp,bp \r
- pop bp \r
- retf \r
-L$80:\r
- push bp \r
- mov bp,sp \r
- sub sp,2 \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov ah,43H \r
- mov bx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$82 \r
- mov word ptr -2[bp],dx \r
- mov ax,word ptr -2[bp] \r
-L$81:\r
- jmp L$83 \r
-L$82:\r
- xor ax,ax \r
- jmp L$81 \r
-L$83:\r
- pop ds \r
- mov sp,bp \r
- pop bp \r
- retf \r
-L$84:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- xor cx,cx \r
- mov ax,word ptr 0aH[bp] \r
- mov ah,44H \r
- mov bx,word ptr 8[bp] \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$85 \r
- mov cx,1 \r
-L$85:\r
- mov ax,cx \r
- jmp L$86 \r
-L$86:\r
- pop ds \r
- pop bp \r
- retf \r
-L$87:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov ah,45H \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$89 \r
- mov ax,1 \r
-L$88:\r
- jmp L$90 \r
-L$89:\r
- xor ax,ax \r
- jmp L$88 \r
-L$90:\r
- pop ds \r
- pop bp \r
- retf \r
-L$91:\r
- push bp \r
- mov bp,sp \r
- sub sp,2 \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov word ptr -2[bp],0 \r
- mov ah,4cH \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$92 \r
- mov word ptr -2[bp],bx \r
-L$92:\r
- mov ax,word ptr -2[bp] \r
- jmp L$93 \r
-L$93:\r
- pop ds \r
- mov sp,bp \r
- pop bp \r
- retf \r
-L$94:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov bx,0f442H \r
- mov ah,47H \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- or ah,ah \r
- js L$95 \r
- mov bx,1 \r
-L$95:\r
- mov ax,bx \r
- jmp L$96 \r
-L$96:\r
- pop ds \r
- pop bp \r
- retf \r
-L$97:\r
- push bp \r
- mov bp,sp \r
- push ds \r
- mov ax,MEMORY_DATA \r
- mov ds,ax \r
- mov ah,48H \r
- mov dx,word ptr 6[bp] \r
- int 67H \r
- pop ds \r
- pop bp \r
- retf \r
-MEMORY_TEXT ENDS\r
-MEMORY_DATA SEGMENT WORD PUBLIC USE16 'FAR_DATA'\r
-L$98:\r
- DB 45H, 4dH, 4dH, 58H, 58H, 58H, 58H, 30H\r
- DB 0\r
-L$99:\r
- DB 0, 0\r
-L$100:\r
- DB 0FH DUP(0,0,0,0,0,0,0,0)\r
- DB 0, 0, 0, 0, 0, 0, 0, 0\r
-\r
-MEMORY_DATA ENDS\r
- END\r
+++ /dev/null
-bcc -mh -c -lh memory.c\r
-Borland C++ Version 3.1 Copyright (c) 1992 Borland International\r
-memory.c:\r
-\r\r
- Available memory 4145480\r\r
-bcc -mh emm.c memory.obj\r
-Borland C++ Version 3.1 Copyright (c) 1992 Borland International\r
-emm.c:\r
-Turbo Link Version 5.1 Copyright (c) 1992 Borland International\r
-\r\r
- Available memory 4165892\r\r
-move emm.exe em0.exe\r
-c:\z\16\src\lib\exmm\emm.exe -> c:\z\16\src\lib\exmm\em0.exe\r
- 1 file moved\r
-move memory.obj memory.ob\r
-c:\z\16\src\lib\exmm\memory.obj -> c:\z\16\src\lib\exmm\memory.ob\r
- 1 file moved\r
-wdis -a memory.ob > memory.asm\r
-wasm -c -mh -0 memory.asm\r
-Open Watcom Assembler Version 1.9\r
-Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.\r
-Source code is available under the Sybase Open Watcom Public License.\r
-See http://www.openwatcom.org/ for details.\r
-memory.asm: 702 lines, 0 warnings, 0 errors\r
-wcl -0 -k32768 /l=dos -ecc -mh emm.c memory.obj\r
-Open Watcom C/C++16 Compile and Link Utility Version 1.9\r
-Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.\r
-Source code is available under the Sybase Open Watcom Public License.\r
-See http://www.openwatcom.org/ for details.\r
- wcc EMM.C -0 -ecc -mh\r
-Open Watcom C16 Optimizing Compiler Version 1.9\r
-Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.\r
-Source code is available under the Sybase Open Watcom Public License.\r
-See http://www.openwatcom.org/ for details.\r
-EMM.C: 78 lines, included 1998, 0 warnings, 0 errors\r
-Code size: 469\r
- wlink @__wcl__.lnk\r
-Open Watcom Linker Version 1.9\r
-Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.\r
-Source code is available under the Sybase Open Watcom Public License.\r
-See http://www.openwatcom.org/ for details.\r
-loading object files\r
-searching libraries\r
-Error! E2028: F_LXLSH@ is an undefined reference\r
-Error! E2028: F_SCOPY@ is an undefined reference\r
-creating a DOS executable\r
-file MEMORY.OBJ(C:\Z\16\SRC\LIB\EXMM\memory.asm): undefined symbol F_LXLSH@\r
-file MEMORY.OBJ(C:\Z\16\SRC\LIB\EXMM\memory.asm): undefined symbol F_SCOPY@\r
-Error: Linker returned a bad status\r
\r
*/\r
\r
-\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <mem.h>\r
+#include <conio.h>
\r
#include "memory.h"\r
\r
void TransformData(char *pEmmData, unsigned int len)\r
{\r
- while ( len )\r
- {\r
- (*pEmmData)++;\r
- pEmmData++;\r
+ while(len)\r
+ {\r
+ (*pEmmData)++;\r
+ pEmmData++;\r
\r
- len--;\r
- }\r
+ len--;\r
+ }\r
}\r
\r
int main(int argc, char *argv[])\r
byte *pEmmData;
int hEData;
unsigned long advi;
+ unsigned long i=0;
+ char huge *p =(char huge *)(GetEMMSeg0()*0x10000);
\r
if(OpenEMM() != SUCCESS)\r
- { // make sure we got EMM\r
+ { // make sure we got EMM\r
printf("EMM unavailable.\n");\r
exit(1);\r
}\r
else
- {\r
- printf("Emm %x available\n", EMVer());
- printf("EMS pages available are %lu\n", EMMCoreLeft());
- //printf("EMM Hardware Information %lu\n", EMInfo());
- }\r
+ {\r
+ printf("Emm %x available\n", EMVer());
+ printf("EMS pages available are %lu\n", EMMCoreLeft());
+ //printf("EMM Hardware Information %lu\n", EMInfo());
+ }\r
printf("b4 EMS pEmmData=%p\n", pEmmData);
//printf("b4 EMS *pEmmData=%s\n", *pEmmData);
printf("EMS pages available are %lu\n", EMMCoreLeft());
+
+
printf("Map 1st 4 pages\n");\r
- //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\r
//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);*/
\r
/*printf("Map next 2 pages\n");\r
MapEMM(hEData, 4, 2); // map last 2 pages: 4-5\r
// do stuff with remaining 32K of data\r
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]))
{\r
- UnmapEMM(hEData, 0, 4); // should unmap before freeing
- //printf("after EMS *pEmmData=%c\n", *pEmmData);\r
- printf("Close emm\n");\r
- EMMFree(hEData); // finished with the file data\r
- CloseEMM();
+ UnmapEMM(hEData, 0, 4); // should unmap before freeing
+ //printf("after EMS *pEmmData=%c\n", *pEmmData);\r
+ printf("Close emm\n");\r
+ EMMFree(hEData); // finished with the file data\r
+ 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;
}\r
+++ /dev/null
-wcp -mh far.c
-pause\r
-far.exe\r
#include<stdio.h>
#include <conio.h>
-#include <limits.h>
+//#include <limits.h>
-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;
}
//static globals --------------------------------\r
\r
static int ActiveEMList[MAXEMHANDLES];\r
-static unsigned int EMMSeg;\r
+static unsigned long EMMSeg;\r
\r
//forward declarations ---------------------------------\r
static int EMPresent(void);\r
static int EMReady(void);\r
-static unsigned int GetEMMSeg(void);\r
+static unsigned long GetEMMSeg(void);\r
static int GetEMHandle(int NumPages);\r
static int EMMap(int Handle, int LogPg, int PhyPg);\r
static int FreeEMHandle(int Handle);\r
\r
/********************************************************************/\r
\r
-static unsigned int\r
+static unsigned long\r
GetEMMSeg(void)\r
{\r
unsigned int EMSegment;\r
\r
//NotReady:\r
// return(NOTREADY);\r
-} /* End of GetEMMSeg() */\r
+} /* End of GetEMMSeg() */
+
+/********************************************************************/\r
+\r
+unsigned long\r
+GetEMMSeg0(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
+ jmp End
+ NotReady:
+ mov EMSegment,NOTREADY
+ End:\r
+ }\r
+ return(EMSegment); /*lint !e530 */\r
+\r
+//NotReady:\r
+// return(NOTREADY);\r
+} /* End of GetEMMSeg0() */\r
\r
/********************************************************************/\r
\r
+++ /dev/null
-Open Watcom C16 Optimizing Compiler Version 1.9\r
-Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.\r
-Source code is available under the Sybase Open Watcom Public License.\r
-See http://www.openwatcom.org/ for details.\r
-memory.c: 413 lines, included 1940, 0 warnings, 0 errors\r
-Code size: 1534\r
extern int EMVer(void);
extern unsigned long EMInfo(void);
-extern int OpenEMM(void);\r
+extern int OpenEMM(void);
+extern unsigned long GetEMMSeg0(void);\r
extern void CloseEMM(void);\r
extern int EMMInstalled(void);\r
extern void far *EMMalloc(int *Handle, int Pages);\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
+wcp -mh far.c memory.obj\r