Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
File Control Block
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Program Segment Prefix & Program Initialisation == Every DOS executable started from the shell ([[COMMAND.COM]]) was provided with a pre-filled 256-byte long data structure called the ''[[Program Segment Prefix]]'' (PSP). Relevant fields within this structure include:<ref name="Programacion_Ensamblador_MSDOS"/> {|class="wikitable" |- ! Offset !! Byte<br/>size !! Contents |- | 0x02 |align=right| 2 || Available memory for the program in 16-byte chunks. |- | 0x2C |align=right| 2 || Segment address containing the program's environment variables. |- | 0x5C |align=right| 16 || Prepared FCB for first command line argument (unopened). |- | 0x6C |align=right| 20 || Prepared FCB for second command line argument (unopened). |- | 0x80 |align=right| 1 || Length of command line. |- | 0x81 |align=right| 127 || Command line contents. |} This data structure could be found at the beginning of the data segment whose address was provided by DOS at program start in the DS and ES segment registers. Besides providing the program's command line verbatim at address 0x81, DOS also tried to construct two FCB's corresponding to the first two words in the command line, the purpose being to save work for the programmer in the common case where these words were filenames to operate on. Since these FCB's remained unopened, no problem would ensue even if these command line words did not refer to files. The initial address for the DTA was set to overlay the area in the PSP (at address 0x80) where the command line arguments were stored, such that a program needed to parse this area for command line arguments before invoking DOS functions that made use of the DTA (such as reading in a file record), unless the program took care to change the address of the DTA to some other memory region (or not use the DTA/FCB functions altogether, which soon became deprecated in favour of file handles).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)