Google
 

Trailing-Edge - PDP-10 Archives - bb-d868b-bm_tops20_v3a_2020_dist - 3a-sources/sbscom.mac
There are 4 other files named sbscom.mac in the archive. Click here to see a list.
TITLE	SBSCOM  --  Common module for Sub-Systems Components
SUBTTL	Chuck O'Toole	8 Aug 76

	SEARCH	SBSMAC		;PARAMETER FILE

	INTERN	%%.SBS		;VERSION OF SBSMAC



;COPYRIGHT (C) 1976, 1977, 1978 BY
;DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
;
;
;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.

;	Entry points found in SBSCOM

INTERN	.ZPAGA	;Zero a page given its address in S1
INTERN	.ZPAGN	;Zero a page given its page number in S1

INTERN	.SAVE1	;Co-routine to save P1
INTERN	.SAVE2	;Co-routine to save P1,P2
INTERN	.SAVE3	;Co-routine to save P1,P2,P3
INTERN	.SAVE4	;Co-routine to save P1,P2,P3,P4
INTERN	.SAVET	;Co-routine to save T1,T2,T3,T4
INTERN	.SV13	;Co-routine to save 13 (use SAVE Macro)
INTERN	.SV14	;Co-routine to save 14 (use SAVE Macro)
INTERN	.SV15	;Co-routine to save 15 (use SAVE Macro)
INTERN	.SV16	;Co-routine to save 16 (use SAVE Macro)
INTERN	.CALL1	;Saves P1 then calls subroutine pointed to by S1
INTERN	.CALL2	;Saves P1,P2 then calls subroutine pointed to by S1
INTERN	.CALL3	;Saves P1,P2,P3 then calls subroutine pointed to by S1
INTERN	.CALL4	;Saves P1,P2,P3,P4 then calls subroutine pointed to by S1
INTERN	.TRUE	;Set S1 = .TRUE.
INTERN	.FALSE	;Set S1 = .FALSE.

INTERN	.POPJ,.POPJ1,.T1PJ,.T2PJ,.T3PJ


	SALL
SUBTTL	.ZPAGA - .ZPAGN  --  Zero out a page

;ROUTINES TO COMPLETELY ZERO A PAGE OF MEMORY.  .ZPAGA IS
;	CALLED WITH THE ADDRESS OF THE FIRST WORD OF THE PAGE
;	IN S1 AND .ZPAGN IS CALLED WITH THE PAGE NUMBER IN S1.

.ZPAGN:	PG2ADR	S1			;CONVERT PAGE NUMBER TO ADR

.ZPAGA:	MOVS	S2,S1			;GET START,,0 IN S2
	HRRI	S2,1(S1)		;GET START,,START+1 IN S2
	SETZM	0(S1)			;CLEAR OUT THE FIRST WORD
	BLT	S2,777(S1)		;ZERO THE PAGE
	POPJ	P,			;AND RETURN
;THESE ROUTINES ACT AS CO-ROUTINES WITH THE ROUTINES WHICH CALL THEM,
;	THEREFORE NO CORRESPONDING "RESTORE" ROUTINES ARE NEEDED. WHEN
;	THE CALLING ROUTINE RETURNS TO ITS CALLER, IT ACTUALLY RETURNS
;	VIA THE RESTORE ROUTINES AUTOMATICALLY.

.SAVE1:	EXCH	P1,(P)		;SAVE P1 GET CALLERS ADDRESS
	PUSH	P,.+3		;SAVE RETURN ADDRESS FOR CALLER
	HRLI	P1,-1(P)	;MAKE IT LOOK LIKE RESULT OF JSA
	JRA	P1,(P1)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-1(P)		;SKIP RETURN
	JRST	RES1		;RESTORE P1

.SAVE2:	EXCH	P1,(P)		;SAVE P1 GET CALLERS ADDRESS
	PUSH	P,P2		;SAVE P2
	PUSH	P,.+3		;SAVE RETURN ADDRESS
	HRLI	P1,-2(P)	;SETUP FOR THE JRA
	JRA	P1,(P1)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-2(P)		;SKIP RETURN
	JRST	RES2		;RESTORE P2,P1

.SAVE3:	EXCH	P1,(P)		;SAVE P1 GET RETURN ADDRESS
	PUSH	P,P2		;SAVE P2
	PUSH	P,P3		;SAVE P3
	PUSH	P,.+3		;SAVE RETURN ADDRESS
	HRLI	P1,-3(P)	;SETUP FOR JRA
	JRA	P1,(P1)		;AND CALL THE CALLER
	  CAIA	.		;NON-SKIP
	AOS	-3(P)		;SKIP RETURN
	JRST	RES3		;AND RESTORE P3,P2,P1

.SAVE4:	EXCH	P1,(P)		;SAVE P1 GET RETURN ADDRESS
	PUSH	P,P2		;SAVE P2
	PUSH	P,P3		;SAVE P3
	PUSH	P,P4		;SAVE P4
	PUSH	P,.+3		;SAVE RETURN ADDRESS
	HRLI	P1,-4(P)	;SETUP FOR RETURN
	JRA	P1,(P1)		;AND RETURN
	  CAIA	.		;NON-SKIP RETURN
	AOS	-4(P)		;SKIP RETURN
RES4:	POP	P,P4		;RESTORE P4
RES3:	POP	P,P3		;RESTORE P3
RES2:	POP	P,P2		;RESTORE P2
RES1:	POP	P,P1		;RESTORE P1
	POPJ	P,		;AND RETURN
.SAVET:	EXCH	T1,(P)		;SAVE T1 AND GET RETURN ADDRESS
	PUSH	P,T2		;SAVE T2
	PUSH	P,T3		;SAVE T3
	PUSH	P,T4		;SAVE T4
	PUSH	P,.+3		;SAVE RETURN ADDRESS
	HRLI	T1,-4(P)	;SETUP FOR JRA
	JRA	T1,(T1)		;AND CALL THE CALLER
	  CAIA	.		;RETURN HERE ON NON-SKIP
	AOS	-4(P)		;RETURN HERE ON SKIP
	POP	P,T4		;RESTORE T4
.T3PJ:	POP	P,T3		;RESTORE T3
.T2PJ:	POP	P,T2		;RESTORE T2
.T1PJ:	POP	P,T1		;RESTORE T1
	POPJ	P,		;AND RETURN

.POPJ1:	AOS	(P)		;CAUSE A SKIP
.POPJ:	POPJ	P,		;AND RETURN

.FALSE:	TDZA	S1,S1		;SET S1 = 0 AND SKIP
.TRUE:	SETO	S1,		;GET .TRUE.
	POPJ	P,		;AND RETURN


;THESE ROUTINES ARE USED WHEN FOR EXAMPLE, A TOP-LEVEL ROUTINE IS GOING TO CALL
;	ANOTHER ONE (e.g. Q$LOGOUT CALLING Q$CREATE) AND THE 'Px' REGS NEED TO BE SAVED

;CALLED WITH S1 = THE ROUTINE TO CALL AFTER SAVING THE APPROPRIATE REGS

.CALL1:	PUSHJ	P,.SAVE1	;SAVE P1 FIRST
	JRST	(S1)		;NOW CALL THE SPECIFIED ROUTINE

.CALL2:	PUSHJ	P,.SAVE2	;SAVE P1,P2 FIRST
	JRST	(S1)		;NOW CALL THE SPECIFIED ROUTINE

.CALL3:	PUSHJ	P,.SAVE3	;SAVE P1,P2,P3 FIRST
	JRST	(S1)		;NOW CALL THE SPECIFIED ROUTINE

.CALL4:	PUSHJ	P,.SAVE4	;SAVE P4,P2,P3,P4 FIRST
	JRST	(S1)		;NOW CALL THE SPECIFIED ROUTINE
; THESE ROUTINES ARE CALLED BY THE SAVE MACRO FOR ABSOLUTE AC'S
;	13,14,15, & 16. THE MACRO FIGURES OUT WHICH ONE

.SV13:	EXCH	13,(P)		;SAVE 13 GET CALLERS ADDRESS
	PUSH	P,.+3		;SAVE RETURN ADDRESS FOR CALLER
	HRLI	13,-1(P)	;MAKE IT LOOK LIKE RESULT OF JSA
	JRA	13,(13)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-1(P)		;SKIP RETURN
	POP	P,13		;RESTORE 13
	POPJ	P,		;AND RETURN

.SV14:	EXCH	14,(P)		;SAVE 14 GET CALLERS ADDRESS
	PUSH	P,.+3		;SAVE RETURN ADDRESS FOR CALLER
	HRLI	14,-1(P)	;MAKE IT LOOK LIKE RESULT OF JSA
	JRA	14,(14)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-1(P)		;SKIP RETURN
	POP	P,14		;RESTORE 14
	POPJ	P,		;AND RETURN

.SV15:	EXCH	15,(P)		;SAVE 15 GET CALLERS ADDRESS
	PUSH	P,.+3		;SAVE RETURN ADDRESS FOR CALLER
	HRLI	15,-1(P)	;MAKE IT LOOK LIKE RESULT OF JSA
	JRA	15,(15)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-1(P)		;SKIP RETURN
	POP	P,15		;RESTORE 15
	POPJ	P,		;AND RETURN

.SV16:	EXCH	16,(P)		;SAVE 16 GET CALLERS ADDRESS
	PUSH	P,.+3		;SAVE RETURN ADDRESS FOR CALLER
	HRLI	16,-1(P)	;MAKE IT LOOK LIKE RESULT OF JSA
	JRA	16,(16)		;CALL THE CALLER
	  CAIA	.		;NON-SKIP RETURN
	AOS	-1(P)		;SKIP RETURN
	POP	P,16		;RESTORE 16
	POPJ	P,		;AND RETURN
	XLIST		;FORCED OUT LITERAL POOL HERE
	LIT
	LIST
	SALL

	END