* * CASES - example of switch-case syntax. * Read a key and print appropriate message. * ORG $8000 REPEAT TRAP #0 ;INCHR: read a key into D0 CMP.B #'P',D0 BEQ CASEPLY ;case D0 = 'P' CMP.B #'S',D0 BEQ CASESTP ;case D0 = 'S' CMP.B #'F',D0 BEQ CASEFFD ;case D0 = 'F' CMP.B #'R',D0 BEQ CASEREW ;case D0 = 'R' BRA REPEAT ;Key not P,S,F,R, so repeat * Cases for keypress * CASEPLY MOVE.L #PLYSTR,A1 ;Message for Play TRAP #2 ;print out message BRA REPEAT CASESTP MOVE.L #STPSTR,A1 ;Message for Stop TRAP #2 ;print out message BRA REPEAT CASEFFD MOVE.L #FFDSTR,A1 ;Message for Fast Forward TRAP #2 ;print out message BRA REPEAT CASEREW MOVE.L #REWSTR,A1 ;Message for Rewind TRAP #2 ;print out message BRA REPEAT * * Messages CR EQU 13 LF EQU 10 PLYSTR DC.B 'You pressed P for Play.',CR,LF,0 STPSTR DC.B 'You pressed S for Stop.',CR,LF,0 FFDSTR DC.B 'You pressed F for Fast Forward.',CR,LF,0 REWSTR DC.B 'You pressed R for Rewind.',CR,LF,0 END