Format of PSP:
Offset Size Description
00h 2 BYTEs program exit point (INT 20h instruction)
02h WORD memory size in paragraphs
04h BYTE unused
05h 5 BYTEs CP/M entry point (FAR jump to 000C0h)
BUG: (DOS 2+) PSPs created by INT 21/AH=4Bh point at 000BEh
06h WORD CP/M compatibility--size of first segment for .COM files
0Ah DWORD terminate address (old INT 22h)
0Eh DWORD break address (old INT 23h)
12h DWORD critical error handler (old INT 24h)
16h WORD parent PSP segment
18h 20 BYTEs DOS 2+ open file table, FFh = unused
2Ch WORD DOS 2+ environment segment (see below)
2Eh DWORD DOS 2+ process's SS:SP on entry to last INT 21 call
32h WORD DOS 3+ max open files
34h DWORD DOS 3+ open file table address
38h DWORD DOS 3+ pointer to previous PSP (default FFFFFFFFh in 3.x)
used by SHARE in DOS 3.3
3Ch 20 BYTEs unused by DOS versions <= 4.01
50h 3 BYTEs DOS function dispatcher (FAR routine)--CDh 21h CBh
53h 9 BYTEs unused
5Ch 16 BYTEs FCB 1 (see AH=0Fh), filled in from first commandline
argument (when opened, overwrites following FCB)
6Ch 20 BYTEs FCB 2 (see AH=0Fh), filled in from second commandline
argument (when opened, overwrites part of command tail)
80h 128 BYTEs command tail / default DTA buffer
command tail is BYTE for length of tail, N BYTEs for the tail,
followed by a BYTE containing 0Dh
DATA SEGMENT
STRING DB 'Hello world!$'
DATA ENDS
STACK SEGMENT PARA STACK 'STACK'
DB 100 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
MAIN PROC FAR
PUSH DS
MOV AX,0
PUSH AX
MOV AX,DATA
MOV DS,AX
MOV DX,OFFSET STRING
MOV AH,9
INT 21H
RET
MAIN ENDP
CODE ENDS
END MAIN