LONG SEEK actually use lower 32 bits of 64 bit value (not 16 bits)

This commit is contained in:
Kenneth J Davis 2021-08-08 14:37:07 -04:00
parent b7bcef73a1
commit 1bb536c383
2 changed files with 10 additions and 2 deletions

View File

@ -317,6 +317,13 @@ typedef signed long LONG;
#define LONG long
#endif
#if USHRT_MAX == 0xFFFF
# define loword(v) ((unsigned short)(v))
#else
# define loword(v) (0xFFFF & (unsigned)(v))
#endif
#define hiword(v) loword ((v) >> 16u)
#define MK_UWORD(hib,lob) (((UWORD)(hib) << 8u) | (UBYTE)(lob))
#define MK_ULONG(hiw,low) (((ULONG)(hiw) << 16u) | (UWORD)(low))

View File

@ -2207,11 +2207,12 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs FAR *pr)
case 0x42: /* 64-bit move file pointer */
{
/* r.(DS:DX) points to 64-bit file position instead of r.(CX:DX) being 32-bit file position */
UWORD FAR *filepos = MK_FP(r.DS, r.DX);
UDWORD FAR *filepos = MK_FP(r.DS, r.DX);
if (*(filepos+1) != 0) /* we currently only handle lower 32 bits, upper 32 bits must be 0 */
goto error_invalid;
r.BP = (UWORD)r.CL;
r.CX = *filepos;
r.CX = hiword(*filepos);
r.DX = loword(*filepos);
/* fall through to 32-bit move file pointer (0x28) */
}
case 0x28: /* move file pointer */