From: sparky4 Date: Thu, 2 Jul 2015 16:51:16 +0000 (-0500) Subject: starting to port cache system .-. X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=56ee8ef55f51e619a256c01e06643a3055fde39a;p=16.git starting to port cache system .-. modified: exmmtest.exe modified: src/lib/16_ca.c modified: src/lib/16_mm.c --- diff --git a/exmmtest.exe b/exmmtest.exe index 138b13c0..3b7d54ae 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 29df8f63..c5d983fc 100644 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -90,7 +90,7 @@ void (*finishcachebox) (void); ============================================================================= */ -extern long far CGAhead; +/*extern long far CGAhead; extern long far EGAhead; extern byte CGAdict; extern byte EGAdict; @@ -128,13 +128,13 @@ SDMode oldsoundmode; void CAL_DialogDraw (char *title,unsigned numcache); void CAL_DialogUpdate (void); -void CAL_DialogFinish (void); +void CAL_DialogFinish (void);*/ void CAL_CarmackExpand (unsigned far *source, unsigned far *dest, unsigned length); -#ifdef THREEBYTEGRSTARTS -#define FILEPOSSIZE 3 +/*#ifdef THREEBYTEGRSTARTS +#define FILEPOSSIZE 3*/ //#define GRFILEPOS(c) (*(long far *)(((byte far *)grstarts)+(c)*3)&0xffffff) long GRFILEPOS(int c) { @@ -218,25 +218,31 @@ void CAL_GetGrChunkLength (int chunk) */ boolean CA_FarRead (int handle, byte far *dest, long length) -{ +{ + union REGS CPURegs; if (length>0xffffl) printf("CA_FarRead doesn't support 64K reads yet!\n"); - -asm push ds -asm mov bx,[handle] -asm mov cx,[WORD PTR length] -asm mov dx,[WORD PTR dest] -asm mov ds,[WORD PTR dest+2] -asm mov ah,0x3f // READ w/handle -asm int 21h -asm pop ds -asm jnc good - errno = _AX; - return false; + + __asm + { + push ds + mov bx,[handle] + mov cx,[WORD PTR length] + mov dx,[WORD PTR dest] + mov ds,[WORD PTR dest+2] + mov ah,0x3f // READ w/handle + int 21h + pop ds + jnc good + } + errno = CPURegs.x.ax; + return false; + __asm + { good: -asm cmp ax,[WORD PTR length] -asm je done - errno = EINVFMT; // user manager knows this is bad read + cmp ax,[WORD PTR length] + je done + errno = EINVFMT; // user manager knows this is bad read return false; done: return true; diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 45411033..9802e4d8 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -335,16 +335,14 @@ void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi) { unsigned base,size; +getmemory: __asm { mov ax,0x4310 int 0x2f mov [WORD PTR XMSaddr],bx mov [WORD PTR XMSaddr+2],es // function pointer to XMS driver - } -getmemory: - __asm - { + mov ah,XMS_ALLOCUMB mov dx,0xffff // try for largest block possible call [DWORD PTR XMSaddr]