Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-08 - 43,50500/test.mac
There are 8 other files named test.mac in the archive. Click here to see a list.
	TITLE	TEST --  CODE TO SHOW USAGE OF STRUCTURED MACROS
	SUBTTL	R.P.NIX --  11/21/78


	XALL

	RELOC

	SEARCH	STRUCTURED		; SET UP TO FIND MACROS


START:

	MOVE	1,A			; GET A VALUE INTO AC1

	%IF	<CAI,1,10,E>		; IF AC1 = 10 THEN

		MOVE	1,B		; MOVE B TO AC1

	%ELSE				; OTHERWISE

		MOVE	1,C		; MOVE C TO AC1

	%ENDIF				; END OF CONDITIONAL


	%WHILE	<<CAI,1,D,E>,OR,<SKIP,0,1,N>>
					; WHILE AC1 = D OR AC1 <> 0 DO

		SUBI	1,1		; DECR AC1

	%ENDWHILE			; AND LOOP BACK


	%CASE

	 %WHEN	<CAI,1,A,E>		; IF AC1 = A THEN
		MOVEI	2,1

	 %WHEN	<CAI,1,B,E>
		MOVEI	2,2

	 %WHEN	<CAI,1,B,E>
		MOVEI	2,3

	 %WHEN	<SKIP,0,0,A>		; DEFAULT (DO IF ALL ABOVE FAIL)
		MOVEI	2,0

	%ENDCASE			; END OF CASE SET


	%LOOP

		ADDI	1,1

	   %EXITIF	<CAI,1,20,GE>	; EXIT LOOP IF AC1 >= 20

		ADDI	2,1

	%ENDLOOP

	EXIT	1,

A:	1

B:	3

C:	5

D:	7


	END