Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0066/star36.snb
There are 2 other files named star36.snb in the archive. Click here to see a list.
**
************************************
** MACHINE DEPENDENT* 360          *
************************************
**
INIT	BSIZE = 8
	HSIZE = 16
	WSIZE = 32
	ADDR.WORD = 4
	JUMPLOC = FILLTAB( TABLE(14,5) ,
.		'GOTO,GOTO"<-[,LA"<-,L"+,A"-,S"!,O"'
.		'/&/,N"&,N"X!,X"'
.		'/,D"*,M"MOD,MOD"<-<-,SLL"->->,SRL"'
.		'\,LCR"'
.		)
	LOGOP = FILLTAB( TABLE(11) ,
.		'<=,NH"\>,NH">=,NL"\<,NL"<,L"\>=,L"'
.		'>,H"\<=,H"=,E"\=,NE"<>,"'
.		)
	SC = '$'
	VER = VER '0  STAR360'
	SW.REG =
	SW.DEBUG = '+'
	BASE.REG = '5'
	R0 = '6' ; R1 = '7'
	REENT.REG = '13'
	DEFINE('DO.OP()')
	DEFINE('GENONE(OP)')
	DEFINE('GENONER(OP,R.ADDR)','GENONE')
	DEFINE('GENTWO(OP)')
	DEFINE('GETROFF(LAB)')
	DEFINE('LOAD.L()')
	DEFINE('LOAD.R2(L.ADDR,L.F,R0)','LOAD.L')
	DEFINE('STORE.L()')
	DEFINE('STORE.L2(R0)','STORE.L')
					:(RETURN)
**
BEGIN	STARTLAB = LABEL
	T1 = SIZE(STARTLAB)
	ASS(STARTLAB,'CSECT')
	ASSNL('USING','*,15')
	L1 = GETLAB()
	ASSNL('B',L1)
	ASSNL('DC','AL1(' T1 ')')
	ASSNL('DC','CL' T1 "'" STARTLAB "'")
	DIFFER(SW.REENT)		:F(BENR)
	DS('$SAVE',72)
	ASS(L1,'STM','14,12,12(13)')
	ASSNL('LA','2,' STARTLAB '+4095')
	ASSNL('USING',STARTLAB '+4095,2')
	( DIFFER(OPERAND) ASSNL('BAL','14,$$STORE') )
	ASSNL('L','0,$$REENT')
	ASSNL('GETMAIN','R,LV=(0)')
	STARTOP = DIFFER(OPERAND) OPERAND
	ASSNL('ST','13,4(1)')
	ASSNL('ST','1,8(13)')
	ASSNL('LR','13,1')
	ASSNL('LR','1,15')
	ASSNL('USING',STARTLAB ',1')
	ASSNL('DROP','15')
					:(BEBOTH)
BENR	ASS('$SAVE','DS','18F')
	ASS(L1,'STM','14,12,12(13)')
	( DIFFER(OPERAND) ASSNL('ST','1,' OPERAND) )
	ASSNL('ST','13,$SAVE+4')
	ASSNL('LR','14,13')
	ASSNL('LA','13,$SAVE')
	ASSNL('USING','$SAVE,13')
	ASSNL('ST','13,8(14)')
	STARTLAB = '$SAVE'
	ASSNL('LA','2,' STARTLAB '+4095')
	ASSNL('USING',STARTLAB '+4095,2')
BEBOTH	( DIFFER(SW.DEBUG) ASSNL('CALL','FERRCK') )
					:(RETURN)
**
FINISH	DIFFER(SW.REENT)		:F(FINNR)
	ASSNL('LR','1,13')
.		ASSNL('L','13,4(13)') ASSNL('L','0,$$REENT')
.		ASSNL('FREEMAIN','R,LV=(0),A=(1)')
.		ASSNL('LM','14,12,12(13)')
	( DIFFER(STARTOP) ASSNL('BR','14')
.		ASS('$$STORE','ST','1,' GETROFF(STARTOP)) )
	ASSNL('BR','14')
	ASSNL('DS','0D')
	ASS('$$REENT','DC','A(' TOTSTORE ')')
					:(FIBOTH)
FINNR	ASSNL('L','13,$SAVE+4')
	ASSNL('LM','14,12,12(13)')
	ASSNL('BR','14')
	ASSNL('DS','0D')
DSLOOP	SAVEDS BREAK.TAB =
.		ASS(T1,'DS',(T2 / 4) 'F')	:S(DSLOOP)
DCLOOP	SAVEDC BREAK.TAB = ASS(T1,"DC","C'" T2 "'"
.		"," 4 - REMDR(SIZE(T2),4) "X'00'")	:S(DCLOOP)
FIBOTH	( ASSNL('LTORG') ASSNL('END') )	:(RETURN)
**
COMMENT STATE LEN(69) . T1 = PUT('*' T1) :S(COMMENT)
	PUT('*' STATE)			:(RETURN)
**
RADIX					:(RETURN)
**
STATSRT	DIFFER(SW.DEBUG) \(
.		DIFFER(OPCODE,'DO') DIFFER(OPCODE,'IF')
.		DIFFER(OPCODE,'IFANY') DIFFER(OPCODE,'CALLS')
.		) ASS(LABEL,'LA','0,' STATENO)
.					:S(RETURN)
	( DIFFER(OPCODE,'BEGIN') GENLAB(LABEL) )	:(RETURN)
**
GENTWO	LOAD.L()
	DO.OP()
	( DIFFER(OP,'C') STORE.L() )	:(RETURN)
**
GENONE	R.ADDR POS(0) '#' =		:S(GOTLIT1)
	LOAD.R2(R.ADDR,R.F,R1)
	R.ADDR = '0(' R1 ')'
GOTLIT1 LOAD.L()
	( IDENT(R.F,'Y') ASSNL('SLA',R0 ',24') ASSNL('SRA',R0 ',24') )
	ASSNL(OP,R0 ',' R.ADDR)
	( DIFFER(OP,'LTR') STORE.L() )	:(RETURN)
**
CALLSRT 				:(RETURN)
**
GENCALL CALLLAB = DIFFER(SW.REENT) GETROFF(CALLLAB)
	( NE(NARG,0) ASSNL('LA','1,' CALLLAB) DS(CALLLAB,NARG * 4) )
	ASSNL('CALL',LOC)		:(RETURN)
**
GENLOG	IDENT(OP,'')			:S(GENLB)
	IDENT(L.F,'1')			:S(GENL1)
	( DIFFER(R.ADDR,'#0') GENTWO('C') )	:S(GENLB)
	DIFFER(R.F,'Y')			:S(GENLTR)
	( DIFFER(OP,'E') DIFFER(OP,'NE') )	:F(GENL1)
GENLTR	R.A = R.ADDR ; R.ADDR = 128
	OP = IDENT(OP,'NL') 'E'		:S(GENL1A)
	OP = IDENT(OP,'L') 'NE'		:S(GENL1A)
	GENONER('LTR', '#' R0)
GENLB	ASSNL('B' OP,LOC)		:(RETURN)
GENL1	R.A = R.ADDR ; R.ADDR = TAB.MASK(R.ENTRY)
GENL1A	ASSNL('TM',L.ADDR ',' R.ADDR)
	IDENT(R.A,'#0') 		:S(GENLB)
	OP = IDENT(R.A,'#1') IDENT(OP,'E') 'NE' :S(GENLB)
	OP = IDENT(R.A,'#1') IDENT(OP,'NE') 'E' :S(GENLB)
	ERROR('BIT TESTS SUPPORT ONLY (EQ,NE) FOR (0,1)') :(RETURN)
**
ASS	T1 = IDENT(T2) DIFFER(T1) T1 ' EQU *'	:S(ASS1)
ASS1	T4 = T4 SAVECOM
	SAVECOM =
	T2 = GE(SIZE(T2),6) T2 ' '
	T3 ',(' = ',0('
	T3 POS(0) '(' = '0('
	T3 = DIFFER(T4) RPAD(T3,20) ' ;' T4
	PUT( RPAD(T1,9) RPAD(T2,6) T3 )	 	:(RETURN)
**
GENLOAD	ASSNL('L',R ',' ADDR)		:(RETURN)
**
GETREG	GETREG = WHEN + 2		:(RETURN)
**
TABSTM	MASK = CKTYPE(LF,'1')
.		2 ** (BSIZE - REMDR(LOW,BSIZE) - 1)
	MASK = CKTYPE(LF,'Y') 255
	OFF = OFF + (LOW / BSIZE)	:(RETURN)
**
LOAD.L	R.ADDR POS(0) '#' =			:F(NOTLIT)
	R.ADDR = CONVERT(R.ADDR,'INTEGER')	:F(NOTINT)
	R.ADDR = L.ADDR
.		LE(R.ADDR,4095) GE(R.ADDR,0)
.		DIFFER(OP,'C') DIFFER(OP,'S') DIFFER(OP,'D')
.		ASSNL('LA',R0 ',' R.ADDR)	:S(RETURN)
	R.ADDR = '=A(' R.ADDR ')'
	R.F = 'W'
NOTINT	( IDENT(OP,'L') ASSNL('L',R0 ',' R.ADDR) )	:S(RETURN)
NOTLIT	( IDENT(L.F,'W') ASSNL('L',R0 ',' L.ADDR) )	:S(RETURN)
	( IDENT(L.F,'Y') ASSNL('IC',R0 ',' L.ADDR) )	:S(RETURN)
	( IDENT(L.F,'H') ASSNL('LH',R0 ',' L.ADDR) )	:(RETURN)
**
DO.OP	( IDENT(R.F,'W') ASSNL(OP,R0 ',' R.ADDR) )	:S(RETURN)
	( \(DIFFER(OP,'M') DIFFER(OP,'D') )
.		ERROR('NON-WORD MULTIPLY OR DIVIDE NONFUNCTIONAL') )
	IDENT(R.F,'Y')			:F(DO.OP1)
	ASSNL('IC',R1 ',' R.ADDR)
	( DIFFER(OP,'L') ASSNL('SLDL',R0 ',24')
.		ASSNL('SRA',R0 ',24') ASSNL('SRA',R1 ',24') )
	ASSNL(OP 'R',R0 ',' R1)			:(RETURN)
DO.OP1	( IDENT(R.F,'H') ASSNL(OP 'H',R0 ',' R.ADDR) )	:S(RETURN)
	ERROR('UNSUPPORTED MODE')		:(RETURN)
**
STORE.L OFFLOC(L.ADDR)
	( IDENT(L.F,'W') ASSNL('ST',R0 ',' L.ADDR) )	:S(RETURN)
	( IDENT(L.F,'Y') ASSNL('STC',R0 ',' L.ADDR) )	:S(RETURN)
	( IDENT(L.F,'H') ASSNL('STH',R0 ',' L.ADDR) )	:S(RETURN)
	ERROR('UNSUPPORTED MODE')			:(RETURN)
**
GETROFF GETROFF = REENT.OFF<LAB> '(' REENT.REG ')'	:(RETURN)
********
** OPTIMIZATION
********
CKREGD	DIFFER(SW.OPT2) 		:(RETURN)
********
** OPERATIONS
********
O.LA	CKTYPET(TF,'B',R.TYPE)		:F(O.L)
	ASSNL('LA',R0 ',' R.ADDR)
	STORE.L()			:(RETURN)
**
O.L	IDENT(L.F,'1')			:S(MOV1)
	( LOAD.R2(R.ADDR,R.F,R0) STORE.L() )     :(RETURN)
MOV1	R.A = R.ADDR ; R.ADDR =  TAB.MASK(L.ENTRY)
	CR = L.ADDR ',255-' R.ADDR
	R.ADDR = L.ADDR ',' R.ADDR
	( IDENT(R.A,'#0') ASSNL('NI',CR) )	:S(RETURN)
	( IDENT(R.A,'#1') ASSNL('OI',R.ADDR) )  :S(RETURN)
	ASSNL('NI',CR)
	ASSNL('TM',R.A ',' TAB.MASK(R.ENTRY))
	LAB = GETLAB()
	ASSNL('BE',LAB)
	( ASSNL('OI',R.ADDR) GENLAB(LAB) )	:(RETURN)
**
O.S	( IDENT(R.ADDR,'#1') GENONER('BCTR','#0') ) :S(RETURN)F(O.TWO)
**
O.GOTO	ASSNL('B',LEFT)				:(RETURN)
**
O.LCR	R.ADDR = '#0'
O.SLL
O.SRL
O.ONE	GENONE(OP)			:(RETURN)
**
O.MOD	OP = 'D'
	DIFFER(L.F,'W')			:S(O.TWO)
	( LOAD.L() ASSNL('SRDA',R0 ',32') DO.OP() STORE.L() ) :(RETURN)
**
O.D	DIFFER(L.F,'W')			:S(O.TWO)
	( LOAD.L() ASSNL('SRDA',R0 ',32') DO.OP() STORE.L2(R1) )
.					:(RETURN)
**
O.M	DIFFER(L.F,'W')			:S(O.TWO)
	( LOAD.R2(L.ADDR,L.F,R1) DO.OP() STORE.L2(R1) )	:(RETURN)
**
O.A ;O.O ;O.N ;O.X
O.TWO	GENTWO(OP)			:(RETURN)
**
END