Google
 

Trailing-Edge - PDP-10 Archives - bb-x130a-sb - mbr.mac
There are 5 other files named mbr.mac in the archive. Click here to see a list.
	TITLE	MBR -- DO I/O INSTRUCTIONS TO AN RH20 OR RH10
	SUBTTL	G.M. UHLER/GMU


	SEARCH	MACTEN,UUOSYM

	T1==1
	T2==2
	T3==3
	T4==4
	P==17
	PDLLEN==10
	CI.MBE==400
	DO.LDR==1B6
	DO.DRE==1B9

	DEFINE	ERROR(ARG,JMP),<
	JRST	[OUTSTR	[ASCIZ/
?'ARG
/]
IFB  <JMP>,<EXIT>
IFNB <JMP>,<JRST JMP>
]>

	SALL

MBR:	JFCL			;NO CCL ENTRY
	RESET			;RESET THE WORLD
	OUTSTR	[ASCIZ/
Type HELP$G for help
/]
	MOVE	P,PDLPTR	;SETUP A PDL
	PUSHJ	P,GETPRV	;GET USER IOT
BRK::	JRST	DDT##		;GO TO DDT


;HERE ON DI$G TO READ MASSBUS REGISTER INTO RET.

DI::	MOVE	P,PDLPTR	;SETUP STACK
	PUSHJ	P,GETPRV	;GET PRIVS
	MOVSI	T2,777700	;MASK FOR LEGAL VALUES IN REG
	PUSHJ	P,CHKVAL	;CHECK VALUES
	  JRST	BRK		;DONE IF ILLEGAL
	PUSHJ	P,SETUP		;SETUP FOR EXECUTION
	PUSHJ	P,CHKMBE	;CHECK FOR MASSBUS ENABLE ON RH20
	  JRST	BRK		;DONE
	XCT	DODATO		;DO THE DATAO
	IMULI	T1,1		;STALL
	IMULI	T1,1		;...
	XCT	DODATI		;DO THE DATAI
	JRST	BRK		;DONE


;HERE ON DO$G TO WRITE MASSBUS REGISTER

DO::	MOVE	P,PDLPTR	;SETUP STACK
	PUSHJ	P,GETPRV	;GET PRIVS
	MOVE	T2,[777700,,600000] ;GET MASK FOR LEGAL VALUES
	PUSHJ	P,CHKVAL	;CHECK VALUES
	  JRST	BRK		;DONE IF ILLEGAL
	PUSHJ	P,SETUP		;SETUP FOR EXECUTION
	MOVX	T1,DO.LDR	;GET LOAD REGISTER BIT
	IORM	T1,DTOARG	;SET IT
	PUSHJ	P,CHKMBE	;CHECK FOR MASSBUS ENABLE FOR RH20
	  JRST	BRK		;DONE
	XCT	DODATO		;DO THE DATAO
	JRST	BRK		;DONE


;HERE ON CI$G TO READ THE CONI INTO RET.

CI::	MOVE	P,PDLPTR	;SETUP STACK
	PUSHJ	P,GETPRV	;GET PRIVS
	MOVEI	T2,0		;GET MASK FOR LEGAL VALUES
	PUSHJ	P,CHKVAL	;CHECK VALUES
	  JRST	BRK		;DONE IF ERROR
	PUSHJ	P,DVCODE	;SETUP FOR EXECUTION
	XCT	DOCONI		;DO THE CONI
	JRST	BRK		;DONE


;HERE ON CO$G TO DO A CONO TO THE DEVICE.

CO::	MOVE	P,PDLPTR	;SETUP STACK
	PUSHJ	P,GETPRV	;GET PRIVS
	MOVSI	T2,-1		;GET MASK FOR LEGAL VALUES
	PUSHJ	P,CHKVAL	;CHECK VALUES
	  JRST	BRK		;DONE IF ERROR
	PUSHJ	P,DVCODE	;SETUP FOR EXECUTION
	HRRZ	T2,REG		;GET VALUE FOR CONO
	XCT	DOCONO		;DO THE CONO
	JRST	BRK		;DONE


;HERE ON BITS$G TO GIVE A LISTING OF USEFUL BITS

BITS:	OUTSTR	BTSMSG
	JRST	BRK		;DONE
BTSMSG:	ASCIZ\
CONI bits:

1B18	400000	Data bus parity error
1B19	200000	Exception
1B20	100000	Long word count
1B21	040000	Short word count
1B22	020000	Channel error
1B23	010000	Drive response error
1B24	004000	Register access error
1B25	002000	Channel ready
1B26	001000	Data overrun
1B27	000400	Massbus enable
1B28	000200	Attention active
1B29	000100	SCR full
1B30	000040	Attention interrupt enable
1B31	000020	PCR full
1B32	000010	Command done
7B35	000007	PI assignment

CONO bits:

1B24	004000	Clear register access error
1B25	002000	Massbus init
1B26	001000	Transfer error clear
1B27	000400	Massbus enable
1B28	000200	Reset command list pointer
1B29	000100	Delete SCR
1B30	000040	Attention interrupt enable
1B31	000020	Stop transfer
1B32	000010	Clear done
7B35	000007	PI assignment

DATAI bits:

77B5	770000,,000000	Register select code
1B6	004000,,000000	Load register
1B7	002000,,000000	Reset command list pointer
1B8	001000,,000000	Control bus parity error
1B9	004000,,000000	Disable register access error
1B10	002000,,000000	Transfer received
7B17	000007,,000000	Drive select code
1B19	000000,,200000	CBUS parity bit for external registers,
			Disable transfer error stop for internal

DATAO bits:

77B5	770000,,000000	Register select code
1B6	004000,,000000	Load register
1B7	002000,,000000	Reset command list pointer
1B9	000400,,000000	Disable register access error
1B10	002000,,000000	Store status
7B17	000007,,000000	Drive select code
1B19	000000,,200000	Disable transfer error stop

Register select codes:

0  Control register		1  Status register
2  Error register		3  Maintenance register
4  Attention summary register	5  Desired address register
6  Drive type register

70 SBAR		71 STCR		72 PBAR		73 PTCR
74 IVIR		75 RR
\


;HERE ON HELP$G TO GIVE A LITTLE HELP.

HELP:	OUTSTR	HLPMSG
	JRST	BRK
HLPMSG:	ASCIZ\
Type	CI$G to do CONI into RET
	CO$G to do CONO from RH(REG)
	DI$G to read massbus register specified by LH(REG) into RET
	DO$G to write massbus register specified by LH(REG) with
	     value specified by RH(REG)
	HELP$G to type this text
	BITS$G to give a listing of CONI/DATAI bits

Locations of interest are:
	KON	Must be set to the RH10/RH20 device code
		(540-574,270-274,360)
	UNIT	Must be set to the unit number on the RH20,
		i.e., the drive select field for the DATAx.
		If set to a SIXBIT name, KON and UNIT will be
		set to the appropriate values for the unit.
	REG	Set to Register,,Value for DI and DO;
		       0,,Value for CO;
		       Ignored for CI
	RET	CI and DI return values here
\


;ROUTINE TO GET USRIOT WITH TRPSET.
;CALL:	PUSHJ	P,GETPRV
;RETURN CPOPJ ALWAYS

GETPRV:	MOVEI	T1,0		;ARGUMENT FOR TRPSET
	TRPSET	T1,		;GET USRIOT
	  ERROR	<TRPSET failed>
	POPJ	P,		;RETURN


;ROUTINE TO CHECK THE VALUES OF KON, UNIT, AND REG TO MAKE SURE
;THAT THEY ARE LEGAL.
;CALL:	MOVE	T2,MASK FOR REG
;	PUSHJ	P,CHKVAL
;RETURN CPOPJ IF ERROR
;	CPOPJ1 IF SUCCESSFUL

CHKVAL:	MOVE	T4,UNIT		;GET UNIT NUMBER
	TDNN	T4,[-1,,777770]	;IS IT A NUMBER
	JRST	CHKVA1		;YES
	MOVEI	T3,.DIAKU	;FUNCTION FOR DIAG.
	MOVE	T1,[2,,T3]	;POINT AT BLOCK
	DIAG.	T1,		;IS IT A SIXBIT NAME?
	  ERROR	<Illegal unit number in UNIT>,CPOPJ
	HLRZM	T1,KON		;STORE DEVICE CODE
	TLZ	T1,-1		;CLEAR DEVICE CODE
	LSH	T1,-3		;RIGHT JUSTIFY UNIT NUMBER
	ANDI	T1,7		;MASK IT OFF
	HRRZM	T1,UNIT		;STORE THAT
CHKVA1:	MOVE	T1,KON		;GET DEVICE CODE
	TLNN	T1,-1		;IS IT ILLEGAL?
	TRNE	T1,3		;...
	JRST	KONERR		;YES
	SETOM	RH20		;ASSUME RH20
	CAIL	T1,540		;IS IT IN RANGE?
	CAILE	T1,574		;...
	CAIA			;NO, CHECK FOR RH10
	JRST	CHKVA3		;YES
	CAIL	T1,270		;RH10?
	CAILE	T1,274		;...
	CAIA			;NO, CHECK LAST
	JRST	CHKVA2		;YES
	CAIN	T1,360		;LAST OF 3 RH10'S?
	JRST	CHKVA2		;YES
KONERR:	ERROR	<Device code illegal in KON>,CPOPJ
CHKVA2:	SETZM	RH20		;MARK AS RH10
CHKVA3:	TDNE	T2,REG		;LEGAL VALUE FOR REG?
	ERROR	<Illegal register specified in REG>,CPOPJ
CPOPJ1:	AOS	0(P)		;GIVE SKIP RETURN
CPOPJ:	POPJ	P,		;RETURN


;ROUTINE TO STORE THE DEVICE CODE IN ALL THE I/O INSTRUCTIONS.
;CALL:	PUSHJ	P,DVCODE
;RETURN CPOPJ ALWAYS

DVCODE:	HRRZ	T1,KON		;GET DEVICE CODE
	LSH	T1,-2		;ONLY 7 BITS
	DPB	T1,[POINT 7,DOCONI,9] ;STORE IN ALL 4 I/O INTRUCTIONS
	DPB	T1,[POINT 7,DOCONO,9]
	DPB	T1,[POINT 7,DODATI,9]
	DPB	T1,[POINT 7,DODATO,9]
	POPJ	P,		;RETURN


;ROUTINE TO BUILD THE DATAO WORD FROM THE VALUES SPECIFIED IN REG AND
;UNIT.
;CALL:	PUSHJ	P,SETUP
;RETURN CPOPJ ALWAYS

SETUP:	PUSHJ	P,DVCODE	;SETUP THE DEVICE CODES
	HLLZ	T1,REG		;GET REGISTER
	LSH	T1,^D12		;POSITION IT
	HRRZ	T2,UNIT		;GET UNIT
	TLO	T1,<(DO.DRE)>(T2) ;SET DISABLE RAE AND SET DS
	HRR	T1,REG		;GET THE VALUE IF ANY
	MOVEM	T1,DTOARG	;STORE IT
	POPJ	P,		;RETURN


;ROUTINE TO CHECK TO SEE IF MASSBUS ENABLE IS ON IN THE CONI IF THE
;DEVICE IS AN RH20.
;CALL:	PUSHJ	P,CHKMBE
;RETURN CPOPJ IF NOT
;	CPOPJ1 IF IT IS OR NOT AN RH20

CHKMBE:	SKIPN	RH20		;IS DEVICE AN RH20?
	JRST	CPOPJ1		;NO, GIVE SKIP RETURN
	XCT	DOCONI		;GET CONI
	MOVX	T1,CI.MBE	;GET THE BIT
	TDNE	T1,RET		;IS IT ON?
	AOS	0(P)		;YES, GIVE SKIP RETURN
	POPJ	P,		;RETURN


;I/O INSTRUCTIONS XCT'ED BY THE PROGRAM. THE DEVICE CODE IS SETUP
;FROM KON BY DVCODE.

DODATI:	DATAI	0,RET
DODATO:	DATAO	0,DTOARG
DOCONI:	CONI	0,RET
DOCONO:	CONO	0,(T2)

KON::	-1			;DEVICE CODE
UNIT::	0			;UNIT NUMBER
RET::	-1			;VALUE RETURNED HERE
REG::	0			;REGISTER,,VALUE TO READ/WRITE
DTOARG:	BLOCK	1		;BUILD ARG FOR DATAO
RH20:	BLOCK	1		;-1 IF RH20, 0 IF RH10
PDLPTR:	IOWD	PDLLEN,PDL	;POINTER TO PDL
PDL:	BLOCK	PDLLEN		;PDL

	END	MBR