;Displaying Overflow Timer on LEDs of PORTB in Assembly for Dragon12+ Trainer with D-Bug12 installed ;for AsmIDe and MiniIDE. Many of the register's name used in AsmIDe and MiniIDe are different from the HCS12 Documentation ;Modified from Example 9-3 in HCS12 book by Mazidi & Causey #include "C:\Reg9s12.H" ;code section ORG $2000 LDS #$2000 ;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 TSCR ;TSCR1 LDAA #$07 ;Prescaler=16 (Try 0-7 values to see changes on LEDs) STAA tmsk2 ;(TSCR2) notice the name is different in AsmIDE and MiniIDE assemblers LDAA #0 OVER BSET TFLG2,%10000000 ;clear the Timer overflow flag (writing HIGH clears it) H1 BRCLR TFLG2,$80,H1 ;wait for Timer Overflow INCA ;keep adding the overflows STAA PORTB ;and dump it on PORTB to see BRA OVER