
MC68302 Applications
D-22
MC68302 USER’S MANUAL
MOTOROLA
* The Tx BD sand data status is not checked since the only one is CTS lost,
* which is not applicable, since CTS is ignored in this application.
* The following updates A2 to point to the next Tx BD
BTST.B
#$05,(A2)
BNE.B
REINIT2
ADDA.W
#$08,A2
BRA.B
CONT
REINIT2 MOVEA.L
#$700640,A2
* Determine what the next byte to “echo” will be and then go to OUTERLOOP
CONT
ADDO.W
#$1,A1
CMPA.L
#$30004,A1
BEQ.B
NEWA1
BRA.B
OUTLOOP
NEWA1
SUBO.W
#$02.A1
BRA.B
OUTLOOP
* The two lines with *** above are dependent on the number of Rx BDs used.
* If the number is increased, these values should be increased by the same
* amount. These are the only lines dependent on the Rx BD or Tx BD setup.
***************************************************************************
*SCC3 Interrupt Routine
ORG
$30500
CLR.L
D1
MOVE.B
SCCE3,D1
MOVE.B
#$15,SCCE3
BSET.B
#$7,(A2)
;Set Ready bit of Tx BD
;test Wrap bit
;If set, reinit A2 to 700640
;else inc A2 by 8 to next Tx BD
;Jump to Continue on
;Reinitialize A2
;Increment A1 to next byte to send
;Is A1 = 30004 ***
;If so, go to NEWA1
;Jump back to outerloop and wait
;Set A1 back to 30002 ***
;Jump back to outerloop and wait
;clear D1
;Move SCCE3 status to D1
;Clear only BRK. BSY and RX in SCCE3.
BTST.B
BNE.B
#$2.D1
BUSY
;Is BSY set
;Jump to BUSY handler if set
* Test Break:
BRKTEST
BTST.B
BNE.B
#$4,D1
BREAK
;Is BRK set
;Jump to BREAK handler if set
*Test Receive:
RECTEST
* Busy handler:
BUSY
BTST.B
BNE.B
JMP
#$0,D1
RECEIVE
ALMDONE
;Is RX set
;Jump to RECEIVE handler if set
;Jump to About Done (impossible)
ADDQ.B
BSET.B
JMP
#1,D5
#$F,(A0)
BRKTEST
;Inc Busy counter (no receive buffers)
;set Empty bit of current Rx BD
;Jump to test for BREAK
*Break handler:
BREAK
* The UART BRKEC will record the number of breaks received
JMP
RECTEST
*Receive handler:
RECEIVE
ADDQ.W
#1,D3
ADDQ.B
#1,D6
NOP
;This code ignores received breaks
;Jump to test for RECEIVE
;Increment number of chars received
;D6 inc by 1 (character ready to send)
INCPTR
ADDQ.W
CMPI.B
BNE.B
SUBQ.W
ANDI.W
#1,A0
#$0,(A0)
BSTAT
#1,A0
#$FF00,(A0)
;Inc A0 to point to Rx BD byte status
;Does status = 00
;Jump to Bad Status it not 00
;Dec A0 to point to beginning of Rx BD
;Clear out Rx BD status