TITLE SAMPLE CODE FOR THE Am29203 1/20/82 - DEW
;
;
; SAMPLE CODE FOR THE Am29203 - FOR USE IN ED2900A AND ED2900B SEMINARS
; =====================================================================
;
; This file was originally created for the Am2903.  There are a few
; subtle changes necessary for proper operation of the Am2923 due
; to the bidirectional DA port.  RAMAB CANNOT be used as the source for
; INCRR - RAMAQ or DAQ is required, for example.  The original draft
; of the file did not catch these changes - although the DEF file was
; properly flagged.  For users who are switching from one CPU to the
; other - be sure to proof your code for the changes shown in the
; Am29203 function table (normal functions, see the data book).
; The major problems will be encountered in selecting the proper source
; field to work with a given function field.  The don't care source
; equates must also be given careful conideration.
;
;
; This file was created for study.
; It does not contain a complete microword.
;
; Anyone finding errors in this file is requested to send a marked listing
; or portion thereof to: AMD CUSTOMER EDUCATION CENTER
;			 490-A LAKESIDE DRIVE
;			 PO BOX #453 MS #71
;			 SUNNYVALE, CA 94086
;
;
; Advanced Micro Devices reserves the right to make changes in its product
; without notice in order to improve design or performance characteristics.
; The company assumes no responsibility for the use of any circuits or
; programs described herein.
;
;
EJECT
;
;
;
;
; ------------------------------------------------------------------
; EDITED JAN 12, 1982
;
; ADDED EQUATES - CONDITIONAL CODE MULTIPLEXER
;
ZERO:		EQU	Q#0	; Z STATUS LINE TO MUX
;COUT:		EQU	Q#1	; ALREADY DEFINED (note that this is a comment)
;PASS:		EQU	Q#7	; ALREADY DEFINED
OVR:		EQU	Q#2	; OVERFLOW STATUS LINE TO MUX
NOVR:		EQU	Q#5	; INVERTED OVERFLOW STATUS LINE TO MUX
;
;
; * * * * *
; SAMPLE Am29203 OPERATIONS FROM THE ED2900A CLASS NOTES
;				THE 2900 FAMILY STUDY GUIDE
;				THE ED2900B CLASS NOTES
; * * * * *
;-------------------------------------------------------------------------
; 15. DA + DB --> Yi
;--------------------------------------------------------------------------
	AM2910 & AM29203 DADB, ADD, YBUS, NOCARRY
;
;--------------------------------------------------------------------------
; 16. RA + RB --> RC (ANY THREE REGISTERS)
;---------------------------------------------------------------------------
	AM2910 & AM29203 , ADD, RAM, NOCARRY, R0, R1	; ADD THIRD REG FIELD
;
;----------------------------------------------------------------------------
; 18.  INCREMENT R15 AND OUTPUT ITS ORIGINAL VALUE
;----------------------------------------------------------------------------
	AM2910 & AM29203 RAMAQ, INCRR, RAM, CARRY, R15, R15
;
; THE AM2903 WOULD USE RAMAB (000) WHILE THE AM29203 REQUIRES
; RAMAQ (010) BE USED WITH THE INCRR FUNCTION.	SEE THE DATA SHEET.
;
EJECT
;
;
;---------------------------------------------------------------------------
; 17.  FIRMWARE BYTE SWAP
;---------------------------------------------------------------------------
	AM2910 LDCT,, H#2 & AM29203 , ADD, RAMUPL, IC, R15, R15 & SHIFT SDROT
LA:	AM2910 RPCT,, LA  & AM29203 , ADD, RAMUPL, IC, R15, R15 & SHIFT SDROT
;
;----------------------------------------------------------------------------
; HARDWARE-ASSISTED BYTE SWAP
;---------------------------------------------------------------------------
	AM2910 & AM29203 DAQ, INCRR, RAM, NOCARRY, , R15
; OR...
	AM2910 & AM29203 RAMAB,       , RAM,	    , , R15, , OEYDIS
;
;     **DAQ MUST BE CODED AS 101**
;---------------------------------------------------------------------------
; 19. DA --> Q
;---------------------------------------------------------------------------
	AM2910 & AM29203 DAQ, INCRR, LOADQ, NOCARRY
;
;---------------------------------------------------------------------------
; 20. OUTPUT R2 AND PERFORM 2*(R2+1) --> R2 IN ONE MICROCYCLE
;---------------------------------------------------------------------------
	AM2910 & AM29203 RAMAQ, INCRR, RAMUPL, CARRY, R2, R2 & SHIFT SURZQZ
; OR...
	AM2910 & AM29203 RAMAQ, INCRR, RAMUPA, CARRY, R2, R2 & SHIFT SURZQZ
;
;---------------------------------------------------------------------------
; 21. UNSIGNED 16 BIT MULTIPLY (R1*R2)
;---------------------------------------------------------------------------
	AM2910 LDCT ,, H#F & AM29203 RAMAQ, INCRR, LOADQ, NOCARRY, R2
LB:	AM2910 RPCT ,, LB  & AM29203	  , SPECL, MULT,  NOCARRY, R1, R0
;
;---------------------------------------------------------------------------
; 22. TWO'S COMPLEMENT 16 BIT MULTIPLY (R1*R2)
;---------------------------------------------------------------------------
	AM2910 LDCT ,, H#E & AM29203 RAMAQ, INCRR, LOADQ,   NOCARRY, R2
LC:	AM2910 RPCT ,, LC  & AM29203	  , SPECL, TWOMULT, NOCARRY, R1, R0
/&		SHIFT DDOR
	AM2910		   & AM29203	  , SPECL, TWOLAST, Z,	     R1, R0
/&		SHIFT DDOR
EJECT
;
;---------------------------------------------------------------------------
; 23. PERFORM A DOUBLE PRECISION DOWN SHIFT USING R2 AND Q
;---------------------------------------------------------------------------
	AM2910 & AM29203 , INCRS, RAMQDL, , , R2 & SHIFT DDZR
;
;---------------------------------------------------------------------------
; 24. PERFORM 4*R2 --> Q IN ONE MICROCYCLE
;---------------------------------------------------------------------------
	AM2910 & AM29203 , ADD, RAMQUPA, NOCARRY, R2, R2 & SHIFT SURZQZ
	AM2910 & AM29203 , INCRS, LOADQ, NOCARRY,   , R2
;
; *************** REQUIRES TWO MICROCYCLES! *******************************
EJECT;
;
;
;---------------------------------------------------------------------------
; 27. SINGLE LENGTH NORMALIZE OF R6 (16 BIT ALU) - AT END, R4 HAS EXPONENT
;     16-BIT ALU
;---------------------------------------------------------------------------
NORMR0: AM2910			& AM29203 RAMAQ, INCRR, LOADQ, NOCARRY, R6
	AM2910 CJP, ZERO, ABORT & AM29203      , SPECL, SLN, , , , IENDIS
	AM2910 CJP, COUT, LBLA	& AM29203 RAMAQ, INCRR, RAM,   NOCARRY, R7, R4
	AM2910 CJP, OVR,  LBLA	& AM29203      , SPECL, SLN,   CARRY,	R4, R4
LBL4:	AM2910 CJP, NOVR, LBL4	& AM29203      , SPECL, SLN,   CARRY,	R4, R4
	AM2910		       & AM29203      , INCRS, QD,    NOCARRY
	AM2910			& AM29203      , SPECL, DECRMNT, CARRY,   , R4
	AM2910			& AM29203 RAMAQ, INCRS, RAM,   NOCARRY,     R6
LBLA:	FF 64X	; PLACEHOLDER
ABORT:	FF 64X	; PLACEHOLDER
;
; load R6 into Q register
; test for Zi = 1 <==> Qi = 0, all i; execute SLN with Ien disabled to set up
;    special status pins
; test Cout = 1 <==> Q3 exor Q2 on MSS = 1; already normalized; set-up exponent
;    register R4 with existing exponent of number in R6 (or zero it out)
; test Ovr = 1 <==> Q2 exor Q1 on MSS = 1; normalized after this step; execute
;    SLN with Ien enabled SLN shifts Q AND increments the exponent register
; test for no Ovr; loop until overflow occurs (number is normalized); SLN
; recover Q since status lags behind true state (ED2900A/ED2900B/C seminars)
;    by down shifting Q register
; decrement the exponent register by -1 (NOTE: unique to Am29203)
; put <Qreg> -> <R6>
;
; REFERENCE: Am2900 FAMILY STUDY GUIDE AND TEACHER'S MANUAL; CEC.PUB-29-3 ($18.00)
EJECT
;---------------------------------------------------------------------------
; 28. DOUBLE LENGTH NORMALIZE OF R6.R7 (16 BIT ALU)
;---------------------------------------------------------------------------
;- NOT CODED YET --------  182
EJECT
;
;---------------------------------------------------------------------------
; ADD R1 + R2 -> R2
;---------------------------------------------------------------------------
	AM2910 & AM29203 , ADD, RAM, , R1, R2
;
;---------------------------------------------------------------------------
; NAND DA, DB -> YBUS
;---------------------------------------------------------------------------
	AM2910 & AM29203 DADB, NAND, YBUS		; YBUS REPEATED FOR CLARITY
;
;---------------------------------------------------------------------------
; SIGN EXTEND R2
;--------------------------------------------------------------------------
	AM2910 & AM29203 , SPECL, SIGNEXT, NOCARRY, , R2
;
; NOTE: ADD 1-BIT FIELD FOR I5 FOR RAMEXT
;	FIRST TWO SLICES RECEIVE RAMEXT, LAST TWO SLICES RECEIVE SIGNEXT
;
;---------------------------------------------------------------------------
; SIGN MAGNITUDE CONVERSION OF R8 INTO TWO'S COMPLEMENT
;---------------------------------------------------------------------------
	AM2910 & AM29203 , SPECL, SGNTWO, Z, , R2
;
;---------------------------------------------------------------------------
; INCREMENT R2 BY 2 ( R2 <- R2 + 2 )
;---------------------------------------------------------------------------
	AM2910 & AM29203  , SPECL, INCRMNT, CARRY, , R2
;
;---------------------------------------------------------------------------
; BCD ADD R3 + R4 -> R3
;---------------------------------------------------------------------------
	AM2910 & AM29203 , SPECL, BCD.ADD, NOCARRY, R4, R3
;
;---------------------------------------------------------------------------
; DECREMENT R2 BY 2 ( R2 <- R2 - 2 )
;---------------------------------------------------------------------------
	AM2910 & AM29203 , SPECL, DECRMNT, NOCARRY, , R2
;
;---------------------------------------------------------------------------
EJECT
;
;
;
;
;
END
