Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-03 - decus/20-0079/suport.mac
There are no other files named suport.mac in the archive.
        TITLE	ASEM20
	RELOC
SEARCH MONSYM,MACSYM
;
; Timer and date routines for BALM MLG, Jan, 1978
;
ENTRY TIMC
CR=015
LF=012
;
;	CALL TIMC(MILLSECS)
;
TIMC:	;
	MOVNI	1,5
	RUNTM
	IMULI	1,^D1000
	IDIV	1,2
	MOVEM	1,@0(16)
	POPJ	17,
;
;
;	from LOCF(I)	This returns the address of I
;
;  LOCF(I) returns the address of its integer argument
;  LOCF8(I) returns the address of its REAL argument
;  LOCF16(I) returns the address of its DOUBLE PRECISION argument
ENTRY	LOCF
ENTRY	LOCF8
ENTRY	LOCF16
LOCF:
LOCF8:
LOCF16:	
	MOVEI	0,@0(16)
	RET
;
;
;	from CALL MOVE(IA,IASTRT,IB,IBSTRT,NCHAR)
;
;		This moves NCHAR characters (starting at character IBSTRT
;		in the string IB) to the string IA (positioned starting
;		at character IASTRT).
;
;		Some Fortran compilers have this built-in.
;
;   There is a Fortran version of the subroutine, commented out, in the
;   MEMRY.FOR module.
;
ENTRY	MOVE
MOVE:	
	MOVE	1,@3(16)	;R1 <= IBSTRT
	MOVEI	0,@2(16)	;R0 <= ADDR(IB)
	MOVEI	3,0		;R3 <= LOOP FLAG, WILL BECOME IB POINTER
MOV1:	SUBI	1,1
	IDIVI	1,8
	LSH	1,1		;R1 <= (I%STRT-1)/8*2, GUARANTEED EVEN NUMBER
	ADD	1,0
	MOVN	0,2
	CAIGE	2,5		;CHARACTER IN SECOND WORD?
	JUMPA	,.+3
	ADDI	1,1		;DECREMENT BYTE COUNTER AND
	ADDI	0,5		;INCREMENT WORD ADDRESS IF IN SECOND WORD
	IMULI	0,7
	ADDI	0,35
	HRLI	1,700
	DPB	0,POS		;BYTE POINTER
	SUBI	2,7		;R1 <= BYTE POINTER & R2 <= BYTE COUNTER
	JUMPN	3,MOV2		;LOOP BACK IF FLAG IS ZERO, OTHERWISE
	MOVE	3,1		;REPEAT FOR OTHER SET OF POINTERS
	MOVE	4,2
	MOVE	1,@1(16)
	MOVEI	0,@0(16)
	JUMPA	,MOV1
MOV2:	MOVE	5,@4(16)	;R5 <= NCHAR
	JUMPLE	5,MOV5		;IF NCHAR=<0, FINISHED
MOV3:	LDB	0,3		;THIS IS THE ACTUAL BYTE MOVEMENT
	DPB	0,1
	IBP	1		;AND THEN THE POINTERS GET INCREMENTED
	IBP	3
MOV5:	SOJG	5,MOV3		;DECREMENT NCHAR AND SEE IF ZERO YET
	RET
POS:	POINT	6,1,5
;
;  FORTRAN-callable subroutine to convert lowercase characters
;  to uppercase in an 80-character string of 7-bit ASCII bytes
;  stored in 10A8 format.
;  Calling convention:
;	DOUBLE PRECISION STRING
;	DIMENSION STRING(10)
;	...
;	CALL CASCNV(STRING)
;	...
;
;
;  Greg Maxey  August, 1981
;
	ENTRY CASCNV
;
;  Registers 13 - 15 are used as workspace.
CNTR==13	; Character counter.
CHR==14		; The character to be converted.
BYTPTR==15	; Byte pointer into the string.
;
CASCNV:	PUSH	17,13	; Save registers on stack...
	PUSH	17,14
	PUSH	17,15
	; Build a byte pointer to the string.
	HRLI	BYTPTR,440700	; Point before the 1st 7-bit byte.
	HRR	BYTPTR,(16)	; R16 points to addr. of the string.
	; Run a counter down from 100.  This takes into account the
	; two "extra" bytes per doubleword, which are blank anyway.
	MOVEI	CNTR,^D100
	; Increment byte pointer and fetch byte into CHR.
CNVCHR::  ILDB	CHR,BYTPTR
	; If CHR is not a lowercase character, don't change it.
	CAIL	CHR,"a"
	CAILE	CHR,"z"
	JRST	NOTLC
	; Turn off 2nd bit of byte to make it uppercase, and store.
	TRZ	CHR,^B0100000
	DPB	CHR,BYTPTR
NOTLC::  SOJG	CNTR,CNVCHR	; Count, test CNTR, and loop.
	POP	17,15	; Restore registers...
	POP	17,14
	POP	17,13
	POPJ	17,	; Return.
	END