aboutsummaryrefslogtreecommitdiffstats
path: root/drvlib.c
diff options
context:
space:
mode:
authorJaroslav Hensl <emulator@emulace.cz>2023-04-10 14:53:37 +0200
committerJaroslav Hensl <emulator@emulace.cz>2023-04-10 14:53:37 +0200
commit503e91046f60a86823629d43e64e2d0fcc006549 (patch)
tree7f4815da1ae1a94ede4d35aeb32b7ec2b32427e2 /drvlib.c
downloadvmdisp9x-503e91046f60a86823629d43e64e2d0fcc006549.tar.gz
public release
Diffstat (limited to 'drvlib.c')
-rw-r--r--drvlib.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drvlib.c b/drvlib.c
new file mode 100644
index 0000000..f25db8a
--- /dev/null
+++ b/drvlib.c
@@ -0,0 +1,48 @@
+#include <string.h>
+#include "winhack.h"
+
+#include "drvlib.h"
+#include "dpmi.h"
+
+#pragma code_seg( _INIT )
+
+void drv_memcpy(void __far *dst, void __far *src, long size)
+{
+ unsigned char __far *psrc = src;
+ unsigned char __far *pdst = dst;
+
+
+ while(size-- > 0)
+ {
+ *pdst = *psrc;
+
+ psrc++;
+ pdst++;
+ }
+}
+
+
+void __far *drv_malloc(DWORD dwSize, DWORD __far *lpLinear)
+{
+ WORD wSel;
+ DWORD dwLin;
+
+ wSel = DPMI_AllocLDTDesc(1);
+ if(!wSel)
+ return NULL;
+
+ /* Map the framebuffer physical memory. */
+ dwLin = DPMI_AllocMemBlk(dwSize);
+
+ if(dwLin)
+ {
+ DPMI_SetSegBase(wSel, dwLin);
+ DPMI_SetSegLimit(wSel, dwSize - 1);
+
+ *lpLinear = dwLin;
+
+ return wSel :> 0;
+ }
+
+ return NULL;
+}