.;
.;	ETHERADD.CMD - Compute Ethernet address given the DECnet node number
.;
.;	 1-NOV-1988 08:42:58
.;
	.enable control-z
	.sets h "0123456789ABCDEF"
	.sets sa p1
	.if sa <> "" .goto 2
.1:
	.asks sa What is the node number
	.ift <EOF> .goto 4
	.if sa = "" .goto 4
	.if sa <> "?" .goto 2
	; Enter the node number in the form "area.node" where "area" is assumed
	; to be 1 if not given.
	.goto 1
.2:
	.parse sa "." sa sn
	.if sn <> "" .goto 3
	.sets sn sa
	.sets sa "1"
.3:
	.setn a 'sa'.
	.if a < 1. .or .if a > 63. .goto 1
	.setn n 'sn'.
	.if n < 1. .or .if n > 1023. .goto 1
	.setn b a*1024.+n
	.setn b1 b&17+1
	.sets s1 h[b1:b1]
	.setn b2 (b/20)&17+1
	.sets s2 h[b2:b2]
	.setn b3 (b/400)&17+1
	.sets s3 h[b3:b3]
	.setn b4 (b/10000)&17+1
	.sets s4 h[b4:b4]
;
; DECnet address 'a'.'n'  =  Ethernet address AA-00-04-00-'s2''s1'-'s4''s3'
;
	.if p1 = "" .goto 1

.4:
	.disable display
	.exit
