VOGONS


First post, by dgriffi

User metadata
Rank Newbie
Rank
Newbie

Would someone please explain why a program would run fine with DOSBox, but crash on real hardware? There are currently three versions of Frotz (infocom game interpreter) for 16-bit DOS. 2.32, 2.43, and 2.44. All of these work fine in DOSBox. The first one works fine on real hardware, but the latter two crash after three moves and fewer than ten moves into a game. Any ideas on what's going on? I'm the developer of Frotz, by the way.

>go east
Forest look dark. Pig probably some place in there, but Grunk not know which way
to go. Not want end up lost in forest with no pig.

>go west
dos mem corrupt, first_mcb=0277
prev 0899:0000|4D 9A 08 80 64 E9 91 03 46 52 4F 54 5A 00 00 M?.?d??.FROTZ...
notM26D1A:0000|58 60 1D EA 23 25 FC A5 7B 54 1E 70 23 f2 6B X`..?#%??{T.p#?k

PANIC: before 4a: MCB chain corrupted
System halted

Reply 1 of 8, by Tertz

User metadata
Rank Oldbie
Rank
Oldbie

As it's not a problems of DOSBox, the general idea is to ask Infocom or other developers of text games. Different hardware and its settings have different limits and compatibility (try to increase free conventional memory, for example).

DOSBox CPU Benchmark
Yamaha YMF7x4 Guide

Reply 2 of 8, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Are you writing outside some buffers maybe ? That would be my first guess if you end up with a broken MCB chain.

Water flows down the stream
How to ask questions the smart way!

Reply 3 of 8, by Jorpho

User metadata
Rank l33t++
Rank
l33t++

Booting MS-DOS in DOSBox and checking whether the program still crashes might be a good idea for diagnostic purposes.

Reply 4 of 8, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
dgriffi wrote:

...

... woah, you're following me around the Internet! 🤣

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 5 of 8, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie
dos mem corrupt, first_mcb=0277
prev 0899:0000|4D 9A 08 80 64 E9 91 03 46 52 4F 54 5A 00 00 M?.?d??.FROTZ...
notM26D1A:0000|58 60 1D EA 23 25 FC A5 7B 54 1E 70 23 f2 6B X`..?#%??{T.p#?k

PANIC: before 4a: MCB chain corrupted
System halted

Don't know if it's any help, but the cryptic "before 4a" message means that the crash occured at the start of the int21/ah=4a handler. "prev" is the last good block, and "notMZ" is the bad block (where the first byte is neither 'M' or 'Z').
The failing address (26D1A:0000) strikes me as odd. I don't believe int21 has any business dealing with memory all the way up there. This would imply that the previous block, occupied by FROTZ, is impossibly large.

Bytes 3 and 4 (80 64) are the block size, and 0889+6480+1=6D0A, not 26D1A. (but then I have no idea if that's the right way to calculate it)

Reply 6 of 8, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author
jwt27 wrote:

Bytes 3 and 4 (80 64) are the block size, and 0889+6480+1=6D0A, not 26D1A. (but then I have no idea if that's the right way to calculate it)

That's the correct way to calculate the next MCB segment, but you started with 0889 instead of 0899. The "2" may be a mis-transcribed "Z", if the message should indeed say "notMZ".

Is this error message from FreeDOS?

Reply 7 of 8, by jwt27

User metadata
Rank Oldbie
Rank
Oldbie
ripsaw8080 wrote:
jwt27 wrote:

Bytes 3 and 4 (80 64) are the block size, and 0889+6480+1=6D0A, not 26D1A. (but then I have no idea if that's the right way to calculate it)

That's the correct way to calculate the next MCB segment, but you started with 0889 instead of 0899. The "2" may be a mis-transcribed "Z", if the message should indeed say "notMZ".

Oops, you're right. In that case, the address would be correct, and FROTZ may be writing beyond its own memory space.

ripsaw8080 wrote:

Is this error message from FreeDOS?

Yes.

/*
* Check the MCB chain for allocation corruption
*/
COUNT DosMemCheck(void)
{
REG mcb FAR *p;
REG mcb FAR *pprev = 0;

/* Initialize */
p = para2far(first_mcb);

/* Search through memory blocks */
while (p->m_type != MCB_LAST) /* not all MCBs touched */
{
/* check for corruption */
if (p->m_type != MCB_NORMAL)
{
put_string("dos mem corrupt, first_mcb=");
put_unsigned(first_mcb, 16, 4);
hexd("\nprev ", pprev, 16);
hexd("notMZ", p, 16);
return DE_MCBDESTRY;
}

/* not corrupted - but not end, bump the pointer */
pprev = p;
p = nxtMCB(p);
}
return SUCCESS;
}
      /* Set memory block size */
case 0x4a:
if (DosMemCheck() != SUCCESS)
panic("before 4a: MCB chain corrupted");

if ((rc = DosMemChange(lr.ES, lr.BX, &lr.BX)) < 0)
{
#if 0
if (cu_psp == lr.ES)
{
psp FAR *p = MK_FP(cu_psp, 0);
p->ps_size = lr.BX + cu_psp;
}
#endif
if (DosMemCheck() != SUCCESS)
panic("after 4a: MCB chain corrupted");
goto error_exit;
}
lr.AX = lr.ES; /* Undocumented MS-DOS behaviour expected by BRUN45! */
break;

Does dosbox perform this MCB consistency check on int21/4a too?

Reply 8 of 8, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author
jwt27 wrote:

Does dosbox perform this MCB consistency check on int21/4a too?

DOSBox 0.74 usually hangs in an infinite loop on the next memory block operation after the MCB chain is broken. SVN has an error exit instead of the hang. So, to answer your question, 0.74: sorta, SVN: yes.