Skip to content

Commit

Permalink
Confirmed, code works
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Jun 9, 2024
1 parent bc94aef commit b33321f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/dos/dos_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static bool DOS_MultiplexFunctions(void) {
}
return true;
case 0x1216: /* GET ADDRESS OF SYSTEM FILE TABLE ENTRY */
/* Apparently used by Dunkle Schatten 2 for whatever reason */
// reg_bx is a system file table entry, should coincide with
// the file handle so just use that
LOG(LOG_DOSMISC,LOG_ERROR)("Some BAD filetable call used bx=%X",reg_bx);
Expand All @@ -154,6 +155,9 @@ static bool DOS_MultiplexFunctions(void) {
* smaller table "pieces" connected by a linked list */
unsigned int rel_entry = reg_bx;

//DEBUG
// LOG_MSG("handle=%u rel=%u initsft=%08x",reg_bx,rel_entry,(unsigned int)sftrealpt);

while (1) {
/* DWORD +0 <next link or 0xFFFFFFFF>
* WORD +4 <number of entries in table> */
Expand All @@ -168,10 +172,16 @@ static bool DOS_MultiplexFunctions(void) {
return true;
}
sftptr=Real2Phys(sftrealpt);

//DEBUG
// LOG_MSG("handle=%u rel=%u nextsft=%08x",reg_bx,rel_entry,(unsigned int)sftrealpt);
}

uint32_t sftofs = SftHeaderSize + rel_entry*SftEntrySize;

//DEBUG
// LOG_MSG("handle=%u rel=%u finalsft=%08x",reg_bx,rel_entry,(unsigned int)sftrealpt);

if (Files[reg_bx]) mem_writeb(sftptr+sftofs, (uint8_t)(Files[reg_bx]->refCtr));
else mem_writeb(sftptr+sftofs,0);

Expand Down

0 comments on commit b33321f

Please sign in to comment.