Google
 

Trailing-Edge - PDP-10 Archives - BB-FB49A-RM - sources/blspsi.mac
There are no other files named blspsi.mac in the archive.
;<WEBBER>BLSPSI.MAC 8-May-80 12:30, Edit by WHEELER
;Changed references to .ENT0., .EXT0 to ENT0, EXT0 to correspond to new OTS
;<WEBBER>BLSPSI.MAC.24, 12-Mar-79 14:11, Edit by WEBBER
;Changed WAIT in PSIWAI and PSIRST to DISMS for 50 ms
;<WEBBER>BLSPSI.MAC.19, 22-Feb-79 09:47:52, Edit by GUNN
;Changed table sizes to be decimal 36 from octal 36
;Added code to check for valid channel number in PSIINT
	TITLE	BLSPSI	BLISS-36 Interface To TOPS-20 PSI Service

; Copyright (c) 1983, 1984, 1985 by
; DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts 01754
;
; 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.
;++
; FACILITY:     TOPS-20 Priority Software Interrupt System.
;
; ABSTRACT:	This module provides the interface for BLISS-36 program
;		to the TOPS-20 PSI system.
;
; ENVIRONMENT:  TOPS-20 Operating Systems, user mode.
;
; AUTHOR:       Lee Webber,		CREATION DATE: February 22, 1979.
;
; MODIFIED BY:
;
; 	, : VERSION
; 01	-
;--

	SEARCH	MONSYM,MACSYM
	SALL				;Keep listing clean looking
	TWOSEG

;
; Register definitions
;
RV=1
FP=15
SP=17

	RELOC	400000
	SUBTTL	PSIINT Initialize Interrupt Vector

;	Call PSIINT for each routine that will service an interrupt
;	occurring in the specified channel at the specified priority
;	level. PSIINT modifies "CHNTAB" so that the routine will be
;	invoked on an interrupt.
;
;	The routine, when entered, will have the channel number on
;	which the interrupt is occurring on the stack. No register
;	except the stack pointer need be preserved.
;
;	Calling sequence
;
;		CC = PSIINT (PRIORITY, ROUTINE, CHANNEL);

PSIINT::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get channel
	CAIL	1,0			;Check for valid channel number
	CAILE	1,^D35			;Inrange 0-35 OK
	JRST	BAD			;Fail on bad channel number
	MOVEI	2,DISPAT		;Get own servicer address
	ADDI	2,(1)			;Add the channel number call is for
	MOVEM	2,CHNTAB(1)		;Store in table for monitor
	MOVE	2,-3(FP)		;Get caller's servicer routine address
	MOVEM	2,BLSTAB(1)		;Store in table for own servicer
	MOVE	2,-4(FP)		;Get priority
	HRLM	2,CHNTAB(1)		;And put in table for monitor
GOOD:	MOVEI	RV,1			;Return value is successful
	JRST	EXT0			;Return to caller
BAD:	SETZM	RV			;Return value is failure
	JRST	EXT0			;Return to caller
	SUBTTL	PSISIR Setup Interrupt Channels

;	Sets the channel and priority level table addresses for
;	specified process.
;
;	Calling sequence
;
;		CC = PSISIR (PROCESS_HANDLE);

PSISIR::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get process handle
	MOVE	2,[LEVTAB,,CHNTAB]	;Get tables for monitor
	SIR
	ERJMP	BAD			;Failed
	JRST	GOOD			;Successful
	SUBTTL	PSIEIR Enable Interrupt System

;	Enables the software interrupt system for a process.
;
;	Calling sequence
;
;		CC = PSIEIR (PROCESS_HANDLE);

PSIEIR::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get process handle
	EIR
	ERJMP	BAD			;Failed
	JRST	GOOD			;Successful
	SUBTTL	PSIAIC Activate Interrupt Channel

;	Activates specific software interrupt channels.
;
;	Calling sequence
;
;		CC = PSIAIC (PROCESS_HANDLE, CHANNELS_BIT_MAP);

PSIAIC::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	2,-2(FP)		;Get channel bit map
	MOVE	1,-3(FP)		;Get process handle
	AIC
	ERJMP	BAD			;Failed
	JRST	GOOD			;Successful
	SUBTTL	Interrupt Handler Interface

HANDLR:	AOS	PTR			;In case I get interrupted here
	POP	SP,@PTR			;Save entry address
	HRRZS	@PTR			; (minus flags)
	PUSH	SP,16			;Get a work register
	MOVEI	16,15			;Set up to save all registers
	PUSH	SP,(16)			;Preserve register on stack
	SOJGE	16,.-1			;and again... until AC0 has been
	MOVE	1,@PTR			;Subtract entry vector base address
	SUBI	1,DISPAT+1		; from actual entry address
	PUSH	SP,1			;Put channel number on the stack
	PUSHJ	SP,@BLSTAB(1)		;Give control to BLISS routine

	POP	SP,1			;Get channel number off of stack
	SETZM	16			;Prepare to pop all register
	POP	SP,(16)			;Restore AC
	AOS	16			;Get next AC
	CAIE	16,16			;Restored AC15 yet ?
	JRST	.-3			;No, go pop again
	POP	SP,16			;Now restore AC16
	SOS	PTR			;Restore 'FRAME' of entry vector
	DEBRK				;Return to interrupted routine
	SUBTTL	PSIATI Assign Terminal Interrupt Codes

;	Routine to activate terminal interrupt for character code.
;
;	Calling sequence
;
;		PSIATI (CHAR_CODE, CHANNEL);

PSIATI::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get interrupt channel in RH
	HRL	1,-3(FP)		;Get char code in LH
	ATI				;Tell monitor
	JRST	EXT0			;Return to caller.
	SUBTTL	PSIDIC Deactivate Interrupt Channel

;	Disable interrupt channels for specified process.
;
;	Calling sequence
;
;		PSIDIC (CHANNEL_BIT_MAP, PROCESS_HANDLE);

PSIDIC::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get process handle
	MOVE	2,-3(FP)		;Get channel mask
	DIC
	JRST	EXT0			;Return to caller
	SUBTTL	PSICIS Clear Interrupt System

;	Clear the software interrupt system for current process.
;
;	Calling sequence
;
;		PSICIS ();

PSICIS::JSP	5,ENT0			;Do BLISS's prologue
	CIS
	JRST	EXT0			;Return to caller
	SUBTTL	PSISKP Test Software Interrupt System

;	Test to see if the software interrupt system is enabled for
;	the specified process. Return TRUE if the software interrupt
;	system is enabled.
;
;	Calling sequence
;
;		CC = PSISKP (PROCESS_HANDLE);

PSISKP::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get process handle
	SKPIR
	SKIPA	RV,[EXP 0]		;Not enabled
	MOVEI	RV,1			;Enabled
	JRST	EXT0			;Return to caller
	SUBTTL	PSIDIR Disable Interrupt System

;	Disables the software interrupt system for specified process.
;
;	Calling sequence
;
;		PSIDIR (PROCESS_HANDLE);

PSIDIR::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get process handle
	DIR
	JRST	EXT0			;Return to caller
	SUBTTL	PSIDTI Deassign Terminal Interrupt Code

;	Deassigns a terminal interrupt code.
;
;	Calling sequence
;
;		PSIDTI (CHAR_CODE, CHANNEL);

PSIDTI::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,-2(FP)		;Get channel in RH
	HRL	1,-3(FP)		;Get character in LH
	DTI
	JRST	EXT0			;Return to caller
	SUBTTL	PSIWAI Suspend The Current Process

;	Suspends the current process for 50 ms.
;
;	Calling sequence
;
;		PSIWAI ();

PSIWAI::JSP	5,ENT0			;Do BLISS's prologue
	PUSH	SP,1			;Save parameter register
	MOVEI	1,^D50			;Wait for 50ms
	DISMS				; or until wakened
	JFCL				; (no op)
	POP	SP,1
	JRST	EXT0			;Return to caller
	SUBTTL	PSIRST Resume Suspended Process

;	Called from an interrupt routine, resumes the suspended
;	process if it is at a DISMS.
;
;	Calling sequence
;
;		PSIRST ();

PSIRST::JSP	5,ENT0			;Do BLISS's prologue
	MOVE	1,@PTR			;Calculate the channel number
	SUBI	1,DISPAT
	HLRZ	1,CHNTAB(1)		;Pick up the priority on the channel
	MOVE	2,@LEVTAB-1(1)		; and the PC of the interrupted routine
	MOVE	2,-1(2)			;If the last instruction
	CAMN	2,[DISMS]		; issued was a "DISMS",
	AOS	@LEVTAB-1(1)		; increment the PC word
	JRST	EXT0			;Return to caller
	SUBTTL	Entry And Exit Points

ENT0::	PUSH	SP,FP
	HRRZ	FP,SP
	JRST	0(5)

EXT0::	POP	SP,FP
	RET
	SUBTTL	Data Segments

	RELOC	0

PSIBEG::EXP	0			;Begin of PSI data segment
BLSTAB:	REPEAT	^D36,<EXP 0>		;Dispatch to BLISS routines
CHNTAB:	REPEAT	^D36,<EXP 0>		;Dispatch to own servers
LEVTAB:	XWD	0,PC1
	XWD	0,PC2
	XWD	0,PC3
PC1:	EXP	0
PC2:	EXP	0
PC3:	EXP	0
DISPAT:	REPEAT	^D36,<PUSHJ SP,HANDLR>	;Create entry table (so we can figure
					;out which channnel was interrupted)

PTR:	EXP	ADDR3-1			;Pointer to where to save entry
					;address when a high priority interrupt
					;occurs
ADDR3:	EXP	0
ADDR2:	EXP	0
ADDR1:	EXP	0
PSIEND::EXP	0			;End of PSI data segment

	END
; Local Modes:
; Mode:MACRO
; Auto Save Mode:2
; Comment Column:40
; Comment Rounding:+1
; End: