Merge pull request #2 from lpproj/underdesk

fix for fat16 build and DBCS
This commit is contained in:
PerditionC 2015-04-13 07:24:09 -04:00
commit 6e1274b1b3
4 changed files with 35 additions and 6 deletions

View File

@ -1563,6 +1563,24 @@ err:printf("%s has invalid format\n", filename);
subf_data.length = /* MS-DOS "CTYINFO" is up to 38 bytes */
min(subf_data.length, sizeof(struct CountrySpecificInfo));
}
if (hdr[i].id == 7)
{
if (subf_data.length == 0)
{
/* if DBCS table (in country.sys) is empty, clear internal table */
*(DWORD *)(subf_data.buffer) = 0L;
fmemcpy((BYTE FAR *)(table[hdr[i].id].p), subf_data.buffer, 4);
}
else
{
fmemcpy((BYTE FAR *)(table[hdr[i].id].p) + 2, subf_data.buffer, subf_data.length);
/* write length */
*(UWORD *)(subf_data.buffer) = subf_data.length;
fmemcpy((BYTE FAR *)(table[hdr[i].id].p), subf_data.buffer, 2);
}
continue;
}
fmemcpy((BYTE FAR *)(table[hdr[i].id].p) + 2, subf_data.buffer,
/* skip length ^*/ subf_data.length);
}

View File

@ -868,10 +868,8 @@ dispatch:
rc = DosGetCountryInformation(cntry, FP_DS_DX);
if (rc >= SUCCESS)
{
/* HACK FIXME */
if (cntry == (UWORD) - 1)
cntry = 1;
/* END OF HACK */
cntry = nlsInfo.actPkg->cntry;
lr.AX = lr.BX = cntry;
}
}

View File

@ -122,6 +122,7 @@ _nlsCollHardcoded:
GLOBAL _nlsDBCSHardcoded
_nlsDBCSHardcoded:
?table7:
DB 000h, 000h, 000h, 000h
DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
DB 000h, 000h
GLOBAL _hcTablesEnd
_hcTablesEnd:

View File

@ -53,7 +53,7 @@ large portions copied from task.c
#define BUFSIZE 32768u
#define KERNEL_START 0x10 /* the kernel code really starts here at 60:10 */
#define KERNEL_START 0x16 /* the kernel code really starts here at 60:16 */
typedef struct {
UWORD off, seg;
@ -97,6 +97,7 @@ static int exeflat(const char *srcfile, const char *dstfile,
FILE *src, *dest;
short silentdone = 0;
int compress_sys_file;
UWORD realentry;
if ((src = fopen(srcfile, "rb")) == NULL)
{
@ -198,6 +199,16 @@ static int exeflat(const char *srcfile, const char *dstfile,
printf("\nProcessed %d relocations, %d not shown\n",
header->exRelocItems, silentdone);
realentry = KERNEL_START;
if (buffers[0][0] == 0xeb /* jmp short */)
{
realentry = buffers[0][1] + 2;
}
else if (buffers[0][0] == 0xe9 /* jmp near */)
{
realentry = ((UWORD)(buffers[0][2]) << 8) + buffers[0][1] + 3;
}
if ((dest = fopen(dstfile, "wb+")) == NULL)
{
printf("Destination file %s could not be created\n", dstfile);
@ -250,8 +261,9 @@ static int exeflat(const char *srcfile, const char *dstfile,
for (i = 0; i < 3; i++)
dhdr[i] = 0xffff;
/* strategy will jump to us, interrupt never called */
dhdr[3] = KERNEL_START;
dhdr[3] = realentry; /* KERNEL_START; */
fwrite(dhdr, sizeof(dhdr), 1, dest);
printf("KERNEL_START = 0x%04x\n", realentry);
}
fclose(dest);
return compress_sys_file;