Google
 

Trailing-Edge - PDP-10 Archives - BB-F493Z-DD_1986 - 10,7/dcnmcb/datml.m11
There are 15 other files named datml.m11 in the archive. Click here to see a list.
	.TITLE	MCB data base building macros
	.IDENT	/003050/
	.ENABL	LC
;
;
;                    COPYRIGHT (c) 1980, 1981, 1982
;                    DIGITAL EQUIPMENT CORPORATION
;
;     This software is furnished under a license and may  be  used
;     and copied only in accordance with the terms of such license
;     and with the inclusion of the above copyright notice.   This
;     software  or any other copies thereof may not be provided or
;     otherwise made available to any other person.  No  title  to
;     and ownership of the software is hereby transferred.
;
;     The information  in  this  software  is  subject  to  change
;     without  notice  and should not be construed as a commitment
;     by DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL assumes no responsibility for the use or reliability
;     of  its  software  on  equipment  which  is  not supplied by
;     DIGITAL.
;
;++
; Macros for creating MCB data base
;
; The data base binary file is  built  the  same  way  as  a
; process,  except that the partition base is  specified  as
; zero.  It has the following structure:
;
;	+-----------------------+
;	!    Identification     !
;	+-----------------------+
;	!  Primary load block   !
;	+-----------------------+
;	! Secondary load blocks !
;	+-         and         -+
;	!      Data blocks      !
;	+-----------------------+
;
; The identification block provides  verification  that  the
; file is indeed a data base binary file,  and includes  the
; version of the MCB macro set that  the  file  was  created
; with.
;
; The primary load  block  contains  loader  commands  which
; define  the  first  allocation  for  either  a  single  or
; multiplex data base,  and points to secondary load  blocks
; for the formatting of this memory area.
;
; Secondary load blocks describe the  data  to  insert  into
; allocated memory areas and optionally  do  further  memory
; allocations (which could be formatted by load blocks).
;
; Data blocks are refered to by  load  blocks,  and  contain
; constant text to be copied into the allocated areas.
;
;                        ------
;
; All allocations can be made either from the DSR  which  is
; always mapped to the process,  or from  an  unmapped  core
; partition which is only accessable  by  mapping  the  area
; into APR 6.  Primary allocations must  correspond  to  the
; use of the data base,  and thus must be from the  DSR  for
; all cases except for non-driver DLC data bases.
;
; In the descriptions that follow, addresses are relative to
; the beginning of the identification block, and offsets are
; relative to  the  beginning  of  the  memory  block  being
; formatted.
;
; If a load block address is zero,  the allocated  block  is
; assumed to be zeroed,  and no other data  need  be  loaded
; into it.
;
;                        ------
;
; Identification block:
;
;	+-------------------+
;	!  Radix-50 "MCB"   !
;	+---------+---------+
;	!  Minor  !  Major  !
;	+---------+---------+
;
; The major and minor versions will correspond to the "major.minor"
; of the target MCB system.
;
;                        ------
;
; The load blocks will be composed of loader commands:
;
;	+---------+---------+
;	!    0    !    0    !
;	+---------+---------+
;
; Cmd	Description
; ---	-----------
;   0	End of load block
;
;	+---------+---------+
;	!  var #  !   cmd   !
;	+---------+---------+
;	! offset into table !
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;   1	Move variable to word
;   2	Move variable to byte
;   3	Add variable to word
;   4	Add variable to byte
;
;	+---------+---------+
;	!    0    !   cmd   !
;	+---------+---------+
;	! offset into table !
;	+-------------------+
;	!      length       !
;	+-------------------+
;	!data block address !
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;   5	Move text
;
;	+---------+---------+
;	!    0    !   cmd   !
;	+---------+---------+
;	! offset into table !
;	+-------------------+
;	!      length       !
;	+-------------------+
;	!load block address !
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;   6	Verify offset
;
;	+---------+---------+
;	!    0    !   cmd   !
;	+---------+---------+
;	! offset into table !
;	+-------------------+
;	!verification offset!
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;  10	Allocate DSR, move address, and load
;  11	Allocate pool, move bias/address, and load
;
;	+---------+---------+
;	!  var1   !   cmd   !
;	+---------+---------+
;	!      length       !
;	+-------------------+
;	!load block address !
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;  20	Allocate data base from DSR,
;	load, and move address to SLTs until
;	var1 changes
;  21	Allocate data base from pool,
;	load, and move bias/address to SLTs
;	until var1 changes
;
;	+---------+---------+
;	!  var1   !   cmd   !
;	+---------+---------+
;	!         !  var2   !
;	+---------+---------+
;	!  control length   !
;	+-------------------+
;	!load block address !
;	+-------------------+
;	!    unit length    !
;	+-------------------+
;	!load block address !
;	+-------------------+
;
; Cmd	Description
; ---	-----------
;  30	Allocate multiplexor data base from DSR
;	base on number of units specified by the var2,
;	load control table, then repeat:
;	load unit table, and move address to SLTs
;	until var1 changes.
;  31	Allocate multiplexor data base from pool
;	base on number of units specified by the var2,
;	load control table, then repeat:
;	load unit table, and move bias/address to SLTs
;	until var1 changes.
;
; Variables:
;
; Var	Description
; ---	-----------
;   1	Current table base virtual address
;
;  10	Current line index (from L.LIX)
;  11	Current controller (from L.CTL)
;  12	Current unit (from L.UNT)
;  13	Current tributary (from L.TRB)
;
;  20	Number of system lines
;  21	Number of controllers on device
;  22	Number of units on controller
;  23	Number of tributaries on unit
;
;  30	Controller characteristics
;   .	 (#0 = CSR)
;   .	 (#1 = interrupt vector)
;   .	 (#2 = interrupt priority)
;  37
;
;  40	Unit characteristics
;   .	 (#0 = secondary CSR)
;   .
;   .
;  47
;
;  50	Tributary characteristics
;   .	 (#0 = Current station address)
;   .
;   .
;  57	
;
;--

;+
; Psect management
;-

;
; Begin a load block psect
;

	.MACRO	BLK$B
	.IRP	n,<\$$LVL>
$$L'n	= $$BLK
	.ENDM
$$LVL	= $$LVL+1
$$BLK	= $$NXT
$$NXT	= $$NXT+1
	.IRP	n,<\$$BLK>
	.PSECT	$$B'n
$BB'n	= .
	.ENDM
	DAT$B	\$$BLK
	.ENDM	BLK$B

;
; Terminate a load block psect
;

	.MACRO	BLK$E
	DAT$E	\$$BLK
	.IRP	n,<\$$BLK>
	.PSECT	$$B'n
$BL'n	= .-$BB'n
	.ENDM
$$LVL	= $$LVL-1
	.IRP	n,<\$$LVL>
$$BLK	= $$L'n
	.ENDM
	BLK$P
	.ENDM	BLK$E

;
; Enter the current load block psect
;

	.MACRO	BLK$P
	.IRP	n,<\$$BLK>
	.PSECT	$$B'n
	.ENDM
	.ENDM	BLK$P

;
; Get the offset into the current data block
;

	.MACRO	DAT$A	s
	.IRP	n,<\$$BLK>
s	= .-$DB'n
	.ENDM
	.ENDM	DAT$A

;
; Begin a data block
;

	.MACRO	DAT$B	n
	BLK$P
	.BYTE	5,0
	.WORD	0,$DL'n,$DB'n
	.PSECT	$$D'n
$DB'n	= .
	.ENDM	DAT$B

;
; Terminate a data block
;

	.MACRO	DAT$E	n
	.PSECT	$$D'n
$DL'n	= .-$DB'n
	.ENDM	DAT$E

	.MACRO	DAT$P
	.IRP	n,<\$$BLK>
	.PSECT	$$D'n
	.ENDM
	.ENDM	DAT$P

;+
; Top level user directives
;-

;
; Delcare a single-entry data base
;

	.MACRO	DAT$	m,t
	.MCALL	DAT$DF
	DAT$DF
	.IF	B,<m>
$$CMD	= 0
	.IFF
$$CMD	= 20
	.IRP	s,<DSR,COR>
	.IIF	IDN,<m>,<s>,.MEXIT
$$CMD	= $$CMD+1
	.ENDM
	.IF	LE,22-$$CMD
	.ERROR	;"m" is invalid argument, assuming "DSR"
$$CMD	= 20
	.ENDC
	.ENDC
$$VAR	= 12
	.IF	NB,<t>
	.IRP	s,<UNT,TRB>
	.IIF	IDN,<t>,<s>,.MEXIT
$$VAR	= $$VAR+1
	.ENDM
	.IF	LE,14-$$VAR
	.ERROR	;"t" is invalid argument, assuming "UNT"
$$VAR	= 12
	.ENDC
	.ENDC
	BLK$B
	.IRP	n,<\$$BLK>
	.PSECT	$$B0
	.BYTE	$$CMD,$$VAR
	.WORD	$DL'n,$BB'n
	.ENDM
$$TOP	= 0
	DAT$P
	.ENDM	DAT$

;
; Declare a multiplex data base
;

	.MACRO	MPX$	m,t
	.MCALL	DAT$DF
	DAT$DF
$$CMD	= 30
	.IF	NB,<m>
	.IRP	s,<DSR,COR>
	.IIF	IDN,<m>,<s>,.MEXIT
$$CMD	= $$CMD+1
	.ENDM
	.IF	LE,32-$$CMD
	.ERROR	;"m" is invalid argument, assuming "DSR"
$$CMD	= 30
	.ENDC
	.ENDC
$$VAR	= 12
	.IF	NB,<t>
	.IRP	s,<UNT,TRB>
	.IIF	IDN,<t>,<s>,.MEXIT
$$VAR	= $$VAR+1
	.ENDM
	.IF	LE,14-$$VAR
	.ERROR	;"t" is invalid argument, assuming "UNT"
$$VAR	= 12
	.ENDC
	.ENDC
	BLK$B
	.PSECT	$$B0
	.IRP	n,<\$$VAR+10>
	.BYTE	$$CMD,$$VAR,n,0
	.ENDM
	.IRP	n,<\$$BLK>
	.WORD	$DL'n,$BB'n
	.ENDM
$$TOP	= 1
	DAT$P
	.ENDM	MPX$

;
; Declare the data base macros
; and set the identification block.
;

	.MACRO	DAT$DF
	.MCALL	DSR$W,COR$D,END$
	.MCALL	DAT$B,DAT$E,DAT$P
	.MCALL	BLK$B,BLK$E,BLK$P
	.MCALL	LIX$W,LIX$B
	.MCALL	CTL$W,CTL$B
	.MCALL	UNT$W,UNT$B
	.MCALL	TRB$W,TRB$B
	.MCALL	STA$W,STA$B
	.MCALL	CHR$W,CHR$B
	.MCALL	CSR$W,LST$D
	.MCALL	TMB$X,SYN$X
	.MCALL	TMB$,SYN$
$$BLK	= 0
$$LVL	= 0
$$NXT	= 1
	.PSECT	IDENT
	.RAD50	/MCB/
	.BYTE	3,2
	.ENDM	DAT$DF

;
; Terminate formatting of an allocated memory block and
; return to previous block
;

	.MACRO	END$	var
	.IF	NB,<var>
	DAT$A	$$DSP
	BLK$P
	.BYTE	6,0
	.WORD	$$DSP,var
	.IFF
	BLK$P
	.ENDC
	.BYTE	0,0
	.IF	NE,$$LVL
	BLK$E
	.ENDC
	.IF	EQ,$$LVL
	.IF	NE,$$TOP
$$TOP	= 0
	BLK$B
	.IRP	n,<\$$BLK>
	.PSECT	$$B0
	.WORD	$DL'n,$BB'n
	.ENDM
	.ENDC
	.ENDC
	.IF	NE,$$LVL
	DAT$P
	.ENDC
	.ENDM	END$

;+
; Secondary user directives
;-

;
; Store device characteristic(s) in byte(s)
;

	.MACRO	CHR$B	t,list
	.IF	B,<list>
	.PRINT	; The CHR$B macro has changed; consult documentation
	.PRINT	; I will expand it the old way for you...
	.IRP	n,<t>
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,40+n
	.WORD	$$DSP
	DAT$P
	.ENDM
	.IFF
$$VAR	= 30
	.IRP	s,<CTL,UNT,TRB>
	.IIF	IDN,<t>,<s>,.MEXIT
$$VAR	= $$VAR+10
	.ENDM
	.IF	LE,60-$$VAR
	.ERROR	;"t" is invalid argument, assuming "UNT"
$$VAR	= 40
	.ENDC
	.IRP	n,<list>
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,$$VAR+n
	.WORD	$$DSP
	DAT$P
	.ENDM
	.ENDC
	.ENDM	CHR$B

;
; Store device characteristic(s) in word(s)
;

	.MACRO	CHR$W	t,list
	.IF	B,<list>
	.PRINT	; The CHR$W macro has changed; consult documentation
	.PRINT	; I will expand it the old way for you...
	.IRP	n,<t>
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,40+n
	.WORD	$$DSP
	DAT$P
	.ENDM
	.IFF
$$VAR	= 30
	.IRP	s,<CTL,UNT,TRB>
	.IIF	IDN,<t>,<s>,.MEXIT
$$VAR	= $$VAR+10
	.ENDM
	.IF	LE,60-$$VAR
	.ERROR	;"t" is invalid argument, assuming "UNT"
$$VAR	= 40
	.ENDC
	.IRP	n,<list>
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,$$VAR+n
	.WORD	$$DSP
	DAT$P
	.ENDM
	.ENDC
	.ENDM	CHR$W

;
; Allocate block from core and store bias/address
;

	.MACRO	COR$D	l
	DAT$A	$$DSP
	.BLKW	2
	.IF	NB,<l>
	BLK$P
	.BYTE	11,0
	.WORD	$$DSP,l,0
	DAT$P
	.IFF
	BLK$P
	.IRP	n,<\$$NXT>
	.BYTE	11,0
	.WORD	$$DSP,$DL'n,$BB'n
	.ENDM
	BLK$B
	.ENDC
	.ENDM	COR$D

;
; Store device CSR in word
;

	.MACRO	CSR$W	add
	DAT$A	$$DSP
	.WORD	add
	BLK$P
	.BYTE	3,30
	.WORD	$$DSP
	DAT$P
	.ENDM	CSR$W

;
; Store controller number in byte
;

	.MACRO	CTL$B
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,11
	.WORD	$$DSP
	DAT$P
	.ENDM	CTL$B

;
; Store controller number in word
;

	.MACRO	CTL$W
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,11
	.WORD	$$DSP
	DAT$P
	.ENDM	CTL$W

;
; Allocate block from DSR and store address
;

	.MACRO	DSR$W	l
	DAT$A	$$DSP
	.BLKW	1
	.IF	NB,<l>
	BLK$P
	.BYTE	10,0
	.WORD	$$DSP,l,0
	DAT$P
	.IFF
	BLK$P
	.IRP	n,<\$$NXT>
	.BYTE	10,0
	.WORD	$$DSP,$DL'n,$BB'n
	.ENDM
	BLK$B
	.ENDC
	.ENDM	DSR$W

;
; Store line index in byte
;

	.MACRO	LIX$B
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,10
	.WORD	$$DSP
	DAT$P
	.ENDM	LIX$B

;
; Store line index in word
;

	.MACRO	LIX$W
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,10
	.WORD	$$DSP
	DAT$P
	.ENDM	LIX$W

;
; Set up list-head in doubleword
;

	.MACRO	LST$D
	.WORD	0
	DAT$A	$$DSP
	.WORD	$$DSP-2
	BLK$P
	.BYTE	3,1
	.WORD	$$DSP
	DAT$P
	.ENDM	LST$D

;
; Store physical station address in byte
;

	.MACRO	STA$B
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,50
	.WORD	$$DSP
	DAT$P
	.ENDM	STA$B

;
; Store physical station address in word
;

	.MACRO	STA$W
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,50
	.WORD	$$DSP
	DAT$P
	.ENDM	STA$W

;
; Set up a SYNCH block
;

	.MACRO	SYN$
	.PRINT	; The SYN$ macro has been renamed to SYN$X
	.PRINT	; I will call it for you...
	SYN$X
	.ENDM	SYN$

	.MACRO	SYN$X
	.WORD	0,0,0
	.ENDM	SYN$X

;
; Set up a timer block
;

	.MACRO	TMB$	t
	.PRINT	; The TMB$ macro has been renamed to TMB$X
	.PRINT	; I will call it for you...
	TMB$X	t
	.ENDM	TMB$

	.MACRO	TMB$X	t
	.BLKW	1
	.BYTE	6,0
	DAT$A	$$DSP
	.WORD	$$DSP-4
	BLK$P
	.BYTE	3,1
	.WORD	$$DSP
	DAT$P
	.BLKW	4
	.WORD	t
	.WORD	0
	.ENDM	TMB$X

;
; Store tributary number in byte
;

	.MACRO	TRB$B
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,13
	.WORD	$$DSP
	DAT$P
	.ENDM	TRB$B

;
; Store tributary number in word
;

	.MACRO	TRB$W
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,13
	.WORD	$$DSP
	DAT$P
	.ENDM	TRB$W

;
; Store unit number in byte
;

	.MACRO	UNT$B
	DAT$A	$$DSP
	.BLKB	1
	BLK$P
	.BYTE	2,12
	.WORD	$$DSP
	DAT$P
	.ENDM	UNT$B

;
; Store unit number in word
;

	.MACRO	UNT$W
	DAT$A	$$DSP
	.BLKW	1
	BLK$P
	.BYTE	1,12
	.WORD	$$DSP
	DAT$P
	.ENDM	UNT$W

;
; Verify an address
;

	.MACRO	VFY$	var
	DAT$A	$$DSP
	BLK$P
	.BYTE	6,0
	.WORD	$$DSP,var
	DAT$P
	.ENDM	VFY$