Google
 

Trailing-Edge - PDP-10 Archives - tops10and20_integ_tools_v9_3-aug-86 - tools/crc/browse/ichin.mac
There are no other files named ichin.mac in the archive.
	title	ichin - returns value of byte from string
	search	crcsym,monsym,macsym
	entry	ichin
	external gtbypt
;
;reference from fortran with
;      k=ichin(ierr)
;ierr returns 0 on successful input
;the function returns the ascii value of the character typed in
;
ichin:	push	p,t2			;save t2
	setz	t1,			;want the first argument
	call	gtbypt			;is it a character variable
	skipg	t2			;length=0 if integer
f66:	 jrst   [setzm	0,@(cx)		;clear error return
	        pbin%
	         erjmp	[movei	0,1	;error return
	                move	0,@(cx)
	                seto	0,	;return -1 as well
			jrst	retrn ]
	        move	0,t1		;get byte into ac 0 for func value
	        jrst	retrn	]	;return
chars:	push	p,t3			;save more acc's
	push	p,t4
	push	p,q1
	push	p,q2
	dmove	t4,t1			;save output pointer
	exch	t4,q1			;swap for movslj
	setzm	@1(cx)			;clear error return
	pbin%
	 erjmp	[movei	0,1		;error return
	        move	0,@1(cx)	;1st arg is 2nd in char func !!!!!
		jrst	rest  ]
	move	0,t1			;get i/p byte in 0
	dmove	t1,[  	1 		;length = 1
		    point 7,0,28  ]	;byte pointer to ascii no in acc 0
	movcha	t1, 			;move characters and blank fill
rest:	pop	p,q2			;restore remaining acc's
	pop	p,q1
	pop	p,t4
	pop	p,t3
retrn:	pop	p,t2			;restore t2
	ret
	end