CP/M-86 3.1/4.1 Data Segment

The address of the CP/M data segment is returned in ES:BX by the S_SYSDAT call (9Ah). It is laid out as follows:

Although the CP/M-86 3.1 BDOS doesn't appear to implement the S_SYSDAT call, its data segment is in a very similar format. Fields that only apply to one or the other version will be marked [v3 only] or [v4 only].

See also: CP/M-86 4.1 XIOS data area.

Offset	Size	Data		Description
============================================================================
00	DW	cpmfunc_0	; Addresses in the code segment of BDOS 
	DW	cpminit_0	; function handlers. The "func" ones are
	DW	cpmfunc_2	; live; all the "init" handlers consist of
	DW	cpminit_0	; single "retn" instructions. BDOS 4.1 doesn't
	...			; even call them, though BDOS 3.1 does at 
	DW	cpminit_12	; boot time.
1C	DB	build_date	; [v3] ASCII, 12 bytes - eg '* 11/16/83 *' 
				; [v4] ASCII, 8 bytes - eg  '08-05-86'
24	DD	bootfunc2	; [v4 only] If this address is nonzero, 
				; then it is the address of a function that 
				; should be called on boot; perhaps support 
				; for another module like the DOS emulator, 
				; or for Resident System Processes.
				; All existing systems seem to have 0 here.
28	DD	bios_entry	; Far pointer to the XIOS main entry.
2C	DD	bios_init	; Far pointer to the XIOS cold boot routine.	
30	DD	bdos		; Far pointer to the internal BDOS call 
				; handler (which should be entered with DS
				; already pointing at this segment and a 
				; local stack).
34	DD	int_dispatch	; Far pointer to a routine called by the 
				; XIOS when the system tick occurs.
38	DD	int_setflag	; Far pointer to a routine called by the
				; XIOS when a system flag changes.
3C	DD	int_charscan	; Far pointer to a routine called by the
				; XIOS when keyboard input occurs.
40	DD	dosmod		; [v4 only] Far pointer to the DOS emulator 
				; cold boot function, if present. Else zero. 
				; [v3] unused.
44	DW	ccpdseg		; (in the boot file) Paragraph address of
				; the CCP data segment.
				; This is a standard CP/M-86 zero page, ie.
				; it starts with the following data:
				;		DW ccp_codeseg_len
				;		DB 0
				;		DW ccp_codeseg_base_para
				;		DB 0
				;		DW ccp_dataseg_len
				;		DB 0
				;		DW ccp_dataseg_base_para
				;
				; Once the boot file has loaded, this word
				; seems to be used to track memory allocations.
46	DW	osbaseseg	; First paragraph used by the system file
				; (ie, the BDOS code segment)
48	DW	osendseg	; First paragraph not used by the system file
				; (ie, end of the BDOS data segment)
4A	DW	fgproc	; Segment of process table entry for 
				; foreground process (offset will be 0) 
4C	DW	sysflaglist	; List of processes waiting on system flags
4E	DW	rlr	; Segment of process table entry for
				; current process
				; (rlr stands for Ready List Root)
50	DW	proctable ; Segment of process table
52	DW	waitproc	; Segment of processes waiting in process queues? 
54	DW	?
56	DB	prcount	 	; Number of processes in the system, 1-4.
57	DW	bdosver		; BDOS version, 1031h, 1033h or 1041h
				; (see Interrupt List, AX=4452h)
59	BYTE	using_8087	; System variable 140. Set to 0FFh if a process
				; is using the 8087.
5A	DS	4		; CP/M search path - up to 4 drives, terminated
				; with 0FFh if fewer than 4 present.
				; 0 for default drive, 1-16 for A: to P:
5E	DB	tempdrive	; Drive for temporary files
5F	DW	tod_day		; Days since 31-12-1977
61	DB	tod_hr		; Time, hours (BCD)
62	DB	tod_min		; Time, minutes (BCD)
63	DB	tod_sec		; Time, seconds (BCD)
64	DB	curx		; Current screen X-coordinate
65	DB	con_width	; Screen width - 1
66	DB	con_len		; Screen height - 1
67	DB	pagemode	; Should programs pause every screenful?
68	DW	unknown
6A	DS	8		; Process queue for disk subsystem.
				; Format of process queue is:
	
				;	DW	offset of next process queue,
				;               0 for last.
				;	DW	segment of process that owns 
				; 		this subsystem, 0 for none.
				;	DW	head of linked list of 
				;		processes waiting for this
				;		subsystem, 0 for none.
				;	DW	0	;?
				
72	DS	8		; Process queue for program loader
7A	DS	8		; Process queue for disk/filesystem access
82	DS	8		; Process queue for the error handler 
				; (the code that prints 
				; "BDOS function=x file=f")
8A	DS	8		; Process queue for memory manager

John Elliott 1-1-2005