********** * Program LOGIC_2 (6811) * * Simulates 2 cascaded tens counters. * Ouputs 00 to 99 in BCD form to LEDs and continually repeats. * * Input switches are not used. * * P. H. Anderson, MSU, 11 Oct 90; 15 Jan 93 ********** PSCT EQU $C000 DSCT EQU $D000 IDSCT EQU $D300 STACKTP EQU $0045 REG_BASE EQU $1000 PORTB EQU $04 * output PORTC EQU $03 * input DDRC EQU $07 ORG PSCT LDS #STACKTP LDY #REG_BASE CLR DDRC,Y * port c configured as 8-bit input CLRA * zero the counter L1 STAA PORTB,Y * output counter to LEDs BSR TIME * brief delay ADDA #$01 * increment counter in decimal manner DAA BRA L1 * continue * note that the counter naturally rolls over from $99 to $00 TIME * subroutine time provides a nominal 0.25 sec delay PSHX * save X on stack LDX #50000 DECR DEX BNE DECR PULX * restore X RTS ORG DSCT