From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:DOS COM and PSP" |
|---|
| claim | "In DOSBox Staging, a file that does not start with MZ or ZM, or that is shorter than the EXE header (zero-byte files are refused), is loaded as a .COM at PSP:0x100 (up to 0xFFFF-256 bytes read), IP=0x100, SP=0xFFFE with a zero word on the stack (SP is (memsize<<4)-2 when fewer than 0x1000 paragraphs are available)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:DOS COM and PSP" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "INT 21h AH=4Bh on a file without an MZ signature" |
|---|
| effect | "iscom is set when the first word is neither 0x5A4D nor 0x4D5A; load at pspseg+16, csip = pspseg:0x100, sssp = pspseg:0xFFFE with 0 written there (smaller when little memory)" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "DOS_Execute: header read of sizeof(EXE_Header); len==0 refused; len < header size sets iscom; signature != MAGIC1/MAGIC2 sets iscom; COM load reads 0xffff-256 bytes at loadseg=pspseg+16; csip = RealMake(pspseg,0x100); sssp = pspseg:0xfffe (or (memsize<<4)-2) with 0 written there. DS/ES/SS register setup not re-read." |
|---|
| repo | "dosbox-staging/dosbox-staging" |
|---|
| commit | "e8b4771a7de58a7d5c6d7c9c5b36c6ab09c6d93d" |
|---|
| path | "src/dos/dos_execute.cpp" |
|---|
| lines | "300-345, 403-408, 451-462" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "COM loading" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T01:42:05.919Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T04:14:03.671Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read DOS_Execute in dosbox-staging dos_execute.cpp whole (lines 295-470): len==0 refused, len < EXE header size or signature not MAGIC1/MAGIC2 sets iscom, COM reads 0xffff-256 bytes at pspseg+16, csip = pspseg:0x100, sssp = pspseg:0xfffe or (memsize<<4)-2 when memsize < 0x1000, zero word written. PCjr special memory handling exists and is not mentioned in the fact." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:03:24.392Z" |
|---|
| summary | "Added the missed branch: a file shorter than the EXE header is also loaded as COM (zero-byte refused). Read DOS_Execute lines 300-345 and 400-470 in dosbox-staging." |
|---|
| changed | | "claim" |
| "evidence replaced" |
|
|---|
|
|
|---|