Google
 

Trailing-Edge - PDP-10 Archives - bb-h138f-bm - 7-sources/rtlmsc.mac
There are 3 other files named rtlmsc.mac in the archive. Click here to see a list.
TITLE RTLMSC -- Assorted utility routines for the RTL

;
;	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1984, 1986.
;	ALL RIGHTS RESERVED.
;
;	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 THAT IS NOT SUPPLIED BY DIGITAL.
;

; Edit History

; This module is new in version 1.1

; Version 1.1

;.EDIT 50	Formally go to version 1.1, update copyright, insert V1.1
;			development changes (previously V2)
;		DDB,15-Jan-85,SPR:NONE
;.EDIT 55	Add RL$2BG -- convert two-word byte-pointer to OWG.
;		DDB,10-JUN-85,SPR:NONE
;.EDIT 56	Change RL$LBG calling sequence to DYN$LINKAGE.
;		DDB,13-JUN-85,SPR:NONE

SEARCH DDBSYM, MONSYM, MACSYM
SEARCH DYNSYM

SALL

EXTERNAL RTLERR
SUBTTL RL$LBG -- Convert local byte pointer to one-word global

; This is the routine form of the GETBP macro in DYNSYM; it takes a
; one-word local or global byte pointer (a local byte pointer is
; interpreted as pointing to a string local to the section the pointer
; is fetched from) and returns a one-word global byte pointer to the
; same string. This works only for strings of 6, 7, 8, and 9 bits
; (those that might conceivably work with ASCII text).

; GETBP assumes things are clean; this routine, in contrast, checks 
; extensively for errors.

; Arguments:
;	T1/	30-bit address of a byte pointer (local or one-word global)
;		(NOT an EFIW, no indexing or indirection allowed)

; Preserves registers 6-17

; Returns:
; [56] Change linkage to be compatible with DYN$LINKAGE
;	T0/	One-word global byte pointer

; Errors:
;	RL$IBF	Illegal byte pointer format: !BP
;	RL$IBS	Illegal byte size in !BP
;	RL$IBP	Illegal byte position in !BP

	SEGMENT CODE

RL$LBG::
	MOVE T0, (T1)		;Get byte pointer itself
	LDB T3, [POINTR T0, BP%POS] ;Get P (or P, S) field
	CAILE T3, 44
	  JRST LBGEXI		;[56] Already global
	TLNE T0, 37		;Any indexing or indirection?
	  JRST [PUSH P, T0	;Yes, naughty naughty
				;The byte pointer we didn't like
		PUSH P, [1]	;Arg count
		PUSH P, [RL$IBF] ;Where's the fire?
		JRST RTLERR]
; [56]	HRR T1, T0		;Make 30 bit address for byte pointer
	LDB T2, [POINTR T0, BP%SIZ] ;Get size field
	CAIL T2, ^D6		;Minimum byte size
	CAILE T2, ^D9		;Maximum byte size
	  JRST [PUSH P, T0	;Illegal byte size
				;The byte pointer with illegal byte size
		PUSH P, [1]
		PUSH P, [RL$IBS]
		JRST RTLERR]
	HLL T0, T1		;[56] Make 30 bit address for byte pointer
				;[56] in T0
	IDIV T3, T2		;P/S (remainder in T4)
	CAME T4, [EXP 0, 1, 4, 0]-6(T2)	;Check remainder
	  JRST [PUSH P, T0	;Position invalid
				;The byte pointer with invalid position
		PUSH P, [1]
		PUSH P, [RL$IBP]
		JRST RTLERR]
	SUBI T2, 6		;S-6
	IMULI T2, 7		;(S-6)*7 (No more than 7 byte positions for a 
				;given size in one-word global pointers)
	ADD T2, T3		;(S-6)*7 + P/S
	MOVE T2, LBGBPT(T2)	;Get PS field for global into register
	DPB T2, [POINTR T0, BP%POS] ;[56] Set PS field of global

LBGEXI:	RET			;Done

; Table of P&S field values for various P and S values (index into this table
; is computed as (S-6)*7 + P/S (integer division).

; The zero entries cannot be reached because of the error checks above.

LBGBPT:	53			;S=6 P=0
	52			;S=6 P=6
	51			;S=6 P=14
	50			;S=6 P=22
	47			;S=6 P=30
	46			;S=6 P=36
	45			;S=6 P=44
	66			;S=7 P=1
	65			;S=7 P=10
	64			;S=7 P=17
	63			;S=7 P=26
	62			;S=7 P=35
	61			;S=7 P=44
	0			;No entry
	60			;S=8 P=4
	57			;S=8 P=14
	56			;S=8 P=24
	55			;S=8 P=34
	54			;S=8 P=44
	0			;No entry
	0			;No entry
	73			;S=9 P=0
	72			;S=9 P=11
	71			;S=9 P=22
	70			;S=9 P=33
	67			;S=9 P=44
SUBTTL RL$2BG -- Convert two-word global byte pointer to one-word global

; [55] Added

; This routine takes a two-word global byte pointer and returns a
; one-word global byte pointer to the same string. This works only for
; strings of 6, 7, 8, and 9 bits (those that might conceivably work
; with ASCII text).

; A one-word local or global pointer may also be provided; it is returned
; unaltered.

; This routine checks extensively for errors.

; Arguments:
;	T1,T2/	A two-word byte pointer
;		(no indexing or indirection allowed)

; Preserves registers 6-17

; Returns:
;	T0/	One-word global byte pointer

; Errors:
;	RL$IBF	Illegal byte pointer format: !BP
;	RL$IBS	Illegal byte size in !BP
;	RL$IBP	Illegal byte position in !BP

	SEGMENT CODE

RL$2BG::
	LDB T3, [POINTR T1, BP%POS] ;Get P or P&S
	CAIG T3,44		;Skip if global
	  TXNN T1, BP%2WD	;Skip if two-word
	    JRST TBGUS1
	MOVE T0, T2		;Get address word
	LDB T2, [POINTR T1, BP%SIZ] ;Get size field
	TXNE T0, 77B5		;Any indexing or indirection?
	  JRST [PUSH P, T1	;Yes, naughty naughty
				;First word of BP
		PUSH P, T0	;Second word of BP
		PUSH P, [2]	;Arg count
		PUSH P, [RL$IBF]
		JRST RTLERR]

; Check size field
	CAIL T2, ^D6		;Minimum byte size
	CAILE T2, ^D9		;Maximum byte size
	  JRST [PUSH P, T1	;Illegal byte size
				;First word of pointer
		PUSH P, T0	;Second word of pointer
		PUSH P, [2]
		PUSH P, [RL$IBS]
		JRST RTLERR]

	IDIV T3, T2		;P/S (remainder in T4)
	CAME T4, [EXP 0, 1, 4, 0]-6(T2)	;Check remainder
	  JRST [PUSH P, T1	;Position invalid
				;First word of pointer
		PUSH P, T0	;Second word of pointer
		PUSH P, [2]
		PUSH P, [RL$IBP]
		JRST RTLERR]
	SUBI T2, 6		;S-6
	IMULI T2, 7		;(S-6)*7 (No more than 7 byte positions for a 
				;given size in one-word global pointers)
	ADD T2, T3		;(S-6)*7 + P/S
	MOVE T2, LBGBPT(T2)	;Get PS field for global into register
	DPB T2, [POINTR T0, BP%POS] ;Set PS field of global

TBGEXI:	RET			;Done

TBGUS1:	MOVE T0, T1
	JRST TBGEXI

	END