;Displaying Overflow Timer on LEDs of PORTB in Assembly for Dragon12+ Trainer with Codewarrior ;Modified from Example 9-3 in HCS12 book by Mazidi & Causey ABSENTRY Entry ; for absolute assembly: mark this as application entry point ; Include derivative-specific definitions INCLUDE 'mc9s12dp256.inc' ;CPU used by Dragon12+ board ;code section ORG $4000 ;Flash ROM address for Dragon12+ Entry: LDS #$4000 ;Stack LDAA #$FF STAA DDRB ;Make PORTB output ;PTJ1 controls the LEDs connected to PORTB (For Dragon12+ ONLY) LDAA #$FF STAA DDRJ ;Make PORTJ output, (Needed by Dragon12+) LDAA #$0 STAA PTJ ;Turn off PTJ1 to allow the LEDs on PORTB to show data (Needed by Dragon12+) ; ;-------Toggling ALL LEDs connected to PORTB LDAA #$80 STAA TSCR1 LDAA #$04 ;Prescaler=16 (Try 0-7 values to see changes on LEDs) STAA TSCR2 LDAA #0 OVER BSET TFLG2,%10000000 ;clear the Timer overflow flag (writing HIGH clears it) H1 BRCLR TFLG2,mTFLG2_TOF,H1 ;wait for Timer Overflow INCA ;keep adding the overflows STAA PORTB ;and dump it on PORTB to see BRA OVER ;************************************************************** ;* Interrupt Vectors * ;************************************************************** ORG $FFFE DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000