ORG $100 DC.L ISR CRA EQU $52003 CRB EQU $52007 DDRA EQU $52001 DDRB EQU $52005 PDRA EQU $52001 PDRB EQU $52005 ORG $900 BCLR.B #2,CRA ;set to choose DDRA BCLR.B #2,CRB ;set to choose DDRB MOVE.B #00,DDRA ;set PA0 to PA7 as inputs MOVE.B #$FF,DDRB ;set PB0 to PB7 as outputs BSET.B #0,CRA ;enable CA1 interrupt BSET.B #3,CRB ;set CRB to pulse mode 101 BCLR.B #4,CRB BSET.B #5,CRB BSET.B #2,CRA ;set to choose PDRA BSET.B #2,CRB ;Set to choose PDRB MOVE.B #$07,CRA MOVE.B #$2C,CRB MOVE.B $52001,D0 ANDI.W #$F8FF,SR ;set interrupt level to 0 LOOP MOVE.B #247,D7 ;input single character TRAP #14 MOVE.B D0,PDRB BRA LOOP ORG $1800 ISR MOVEM.L D0-D7/A0-A6,-(A7) ;store the regitsers to the stack MOVE.B PDRA,D0 MOVE.B #248,D7 ;output single character TRAP #14 MOVEM.L (A7)+,D0-D7/A0-A6 ;restore the registers RTE ;return from exception