A brief history of PSP With kind permission from Franz Glaser, I present some history of the program segment prefix which he posted on the comp.lang.asm.x86 newsgroup. I came across this message and found it very interesting, and I hope you will too. ______________________________________________________________________ From: Ing. Franz Glaser Subject: Re: PSP Date: Wednesday, March 17, 1999 6:59 AM tunney wrote: > > Someone want to explain(point me in the direction of a site that will) PSP > to me? You will find the necessary information in Ralph Brown's interrupt descriptions. There are several URL's with downloadable .ZIP's and html sites. Links are found in the "information" chapter of the TP-links: http://www.geocities.com/SiliconValley/2926/tpf.html 0000H ... reset = INT 20H 0002H ... end segment of program 0005H ... INT 21H faking BDOS system call 000AH ... copy of INT 22H 000EH ... copy of INT 23H 0012H ... copy of INT 24H ......... reserved for 20 file handles 002CH ... segadr of local environment ......... reserved 005CH ... FCB1 006CH ... FCB2 .... 0080H ... length byte of parameter string (PL/M - Pascal style) The PSP is the segment address which is treated by DOS as the "process descriptor" of the running program. It holds various pointers to error- and other exit vectors. Let me tell you something about history. The 100H start address of application programs was first introduced by the famous Intellec computer, running with an 8080. It was simply the "bottom" memory area of the available 64kB memory space. Since the reset location of the 8080 was 0000H an application simply jumped to 0000 to reset (~reboot) the computer. The BDOS system call was at address 0005, and this was continued with CP/M and is still available with DOS! A CP/M program had lots of "CALL 5" system calls :-) Btw.: The Intellec (and CP/M) had the famous IOBYTE at address 0003. It allowed I/O redirection on a very "sophisticated" :-) level. CP/M introduced the parameter string at 80H in a PL/M and Pascal type string with length byte. At Address 005CH was the first filename and at 006CH was the second filename, parsed by the system when a program was invoked with parameters. They are initialized as the first 10 bytes of an FCB. Still available on DOS, if you run FCB mode file operations. If FCB1 is used immediately, FCB2 is overwritten. It must be copied to another location with enough space before file open. DOS introduced additional locations in this area, like the list of 20 file handles and the SET-environment segment pointer at 002CH. When the 8086 was introduced the PSP was relocated from physical memory location 00000 to an appropriate segment address. .COM programs still have the 64kB memory layout which had the CP/M .COM programs, but of course relocated to the proper segment address. A typical .COM program is not aware of segmentation, it behalves like running on an 8080 / Z80 computer. MSDOS was a quick and dirty modified operating system upgraded from CP/M. There was a translator program available which converted 8080 ASM code to 8086 ASM code. This converter was not very intelligent, so the MSDOS system calls had to be copies of CP/M system calls. In MSDOS version 2 the Unix - style file handles were first introduced, permitting subdirectory names and thus long pathnames. -- Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria ++43-7219-7035 Muehlviertler Elektronik Glaser. Industrial control and instrumentation ----------------------------------------------------------------------- http://members.eunet.at/meg-glaser mailto:meg-glaser@eunet.at http://www.geocities.com/~franzglaser http://members.xoom.com/f_glaser