}
if (opt.drmk) {
- /* DRMK entry is different */
+ /* DRMK entry is different than MS-DOS/PC-DOS */
/*
- * A new size, aligned to 16 bytes, with one full extra row to
- * guarantee the needed space and ease other values.
+ * A new size, aligned to 16 bytes to ease use of ds:[bp+28].
+ * We only really need 4 new, usable bytes at the end.
*/
- int tsize = (data[ndata].size + 31) & 0xfffffff0;
+ int tsize = (data[ndata].size + 19) & 0xfffffff0;
regs.ss = regs.fs = regs.gs = 0; /* Used before initialized */
if (!realloc(data[ndata].data, tsize)) {
error("Failed to realloc for DRMK\n");
data[ndata].size = tsize;
/* ds:[bp+28] must be 0x0000003f */
regs.ds = (tsize >> 4) + (opt.seg - 2);
- /* "Patch" into the extra row */
+ /* "Patch" into tail of the new space */
*(int *)(data[ndata].data + tsize - 4) = 0x0000003f;
}