Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50512/mscmac.mac
There are no other files named mscmac.mac in the archive.
	TITLE MSCMAC
	SEARCH UUOSYM
;Miscellaneous assembly language routines for NETSPL

V.MSCM==:100,,2
D.MSCM==:^D150878
;
;Register defs
;
VREG=1
FREG=15
SREG=17
P=17
OPDEF TIMER [CALLI 22]
OPDEF MSTIME [CALLI 23]
OPDEF DATE [CALLI 14]
OPDEF	PJOB [CALLI 30]

;Routines WRNUM & WRNUMA convert a number to an ASCIZ string
;WRNUMA advances the pointer past the ASCII representation of the number
;	so the next character IDPB'ed through it will overwrite the null byte
;	at the end of it.
	;Calling sequence is WRNUM(NUM,RAD,PTR)
	;ARGUMENTS:
	;NUM:		The number
	;RAD:		Radix (do signed conversion if negative)
	;PTR:	For WRNUM:	Byte pointer
;		For WRNUMA:	Address of byte pointer
;				WRNUMA advances the byte pointer past the number
	;Returned value: # of digits written

	P=17
	Q=4
	PT=2			;Pointer to byte pointer
	R=5
	F=3
	V=1			;Returned value here
	DEFINE NUM=<-3(F)>
	DEFINE RAD=<-2(F)>
	DEFINE PTR=<(PT)>

WRNUMA::SKIPA	PT,-1(P)	;Address of pointer in this case
WRNUM::	MOVEI	PT,-1(P)	;Get address of pointer
	SETZ	V,		;No digits written yet
	MOVEI	F,(P)
	SKIPG	RAD
	 JRST	[MOVMS	RAD
		 SKIPL	NUM
		  JRST .+1
		 MOVEI	R,"-"
		 IDPB	R,PTR
		 MOVMS	NUM
		 JRST   .+1]	;If RAD was negative do it signed
	MOVE	Q,NUM
	PUSHJ	P,WRNUM0
	SETZ	R,
	MOVE	Q,PTR
	IDPB	R,Q		;Make ASCIZ string
	POPJ	P,

WRNUM0:
	MOVEM	Q,R		;This is really the low-order word
	SETZ	Q,		;If the number was negative we fixed it already
	JUMPGE	R,.+2		;High bit of low word is sign bit
	 AOJ	Q,		;So we have to mess with it
	DIV	Q,RAD
	HRLM	R,(P)		;Save the remainder
	JUMPE	Q,.+2		;See if anything left
	 PUSHJ	P,WRNUM0	;Recurse to put in correct order
	HLRZ	R,(P)		;Get remainder back
	MOVEI	R,"0"(R)	;Convert to ASCII
	CAILE	R,"9"		;In case he is using HEX
	 MOVEI	R,"@"-"9"(R)	;Make it a letter
	IDPB	R,PTR		;Write it out
	AOJ	V,		;1 more digit was written
	POPJ	P,		;Return

STOP::
	MONRT.
	POPJ	P,		;Return to monitor level

GETSEG::	MOVEM	0,SAVEAC	;Save all registers before GETSEG
		MOVE	0,[1,,SAVEAC+1]
		BLT	0,SAVEAC+17

		MOVE	0,-1(P)		;Get addr of argument list to UUO
		CALLI	0,40	;GETSEG UUO
		HALT	[MOVE P,SAVEAC+P	;Let monitor print error messages
			 MOVE 0,-1(P)		;Set up to try again
			 JRST .-1]
		MOVSI	17,SAVEAC	;Restore ACs
		BLT	17,17
		POPJ	P,

SAVEAC::	BLOCK 20
;
;Routine to do a TIMER UUO
;
;returns system-dependant format time-of-day
TIMER::	TIMER VREG,
	POPJ	P,
;
;Routine to do a MSTIME UUO
;
;returns system-dependant format time-of-day
MSTIME::	MSTIME VREG,
	POPJ	P,
;
;Routine to do a DATE UUO
;
;returns system-dependant format time-of-day
DATE::	DATE VREG,
	POPJ	P,

PJOB::	PJOB VREG,
	POPJ P,

END