********** * 7_SEG.ASM * * Fetches lower four switches on I/O Box and displays character * '0' - 'F' on a single 7 segment display. * * Harware configuration. Cable #1 connected to J1 of I/O Box. * J2 of I/O Box connected to 7 - seg LED Fixture. * * See attached Figure for wiring of 7-seg display. * * Intended to illustrate addressing modes and use of the Buffalo * Monitor to debug and run a routine. * * P. H. Anderson, 25 Jan 93 *********** ORG $C000 * code starts at C000 CLR $1007 * DDRC set for inputs on PORTC LDAB $1003 * read switches on PORTC ANDB #$0F * lower four bits only CLRA * D register now has 00 0S where S is * switch setting of lowest 4 switches LDX #$D300 * starting address of where patterns are STX $D000 * store in a temp location ADDD $D000 * D (A and B pair) now has address of desired * pattern STD $D000 * save the address LDX $D000 * load adress in index register LDAA 00,X * get the pattern STAA $1004 * output pattern on PORTB JMP $C000 * infinite loop ORG $D300 FCB $02, $67, $11, $41 * 0, 1, 2, 3 FCB $64, $48, $08, $63 * 4, 5, 6, 7 FCB $00, $40, $20, $0C * 8, 9, A, B FCB $1A, $05, $18, $38 * C, D, E, F