*------------------------------------------------------------------ * timertest2.asm - Test timer capabilities of HC11 * * Move the letter "A" around the LCD screen, driven by interrupts * from the HC11 Timer Output compare #1 function. This version * Uses timer.asm to set up the timer for us. *------------------------------------------------------------------ *#include "ascii.asm" #include "registers.asm" #include "buffalo.asm" org $2000 jmp main #include "lcd.asm" #include "timer.asm" glyph_table equ 0 ; No glyph table xcoord: rmb 1 ycoord: rmb 1 mydel: rmb 2 main: jsr init_LCD ldaa #DISP_ONOFF|D_DISP ; No blink/cursor jsr send_cmd * ldaa #0 ldab #0 staa xcoord stab ycoord ldaa #'A jsr write_lcd ldx #$ffff stx mydel ldaa #0 ; Select alarm #0 (really this means OC1). ldx #mysub ; Select subroutine "mysub" (below). ldy mydel ; Select my delay value. jsr setup_periodic_alarm ; Call mysub every mydel timer ticks. cli ; Enable interrupts inf: wai * ldx #0 * jsr dloop * ldx #msg2 * jsr outstrg bra inf msg1: fcc "in ISR" fcb EOT msg2: fcc "Main loop busy." fcb EOT mycount: fcb 5 mysub: dec mycount bne return ldaa #5 staa mycount * ldx #msg1 * jsr outstrg ldaa xcoord ldab ycoord jsr gotoxy ldaa #SPACE jsr write_lcd ldab ycoord incb cmpb #4 bne yok ldab #0 stab ycoord ldaa xcoord inca cmpa #20 bne xok ldaa #0 xok: staa xcoord * jsr adjust_delay yok: stab ycoord ldaa xcoord ldab ycoord jsr gotoxy ldaa #'A jsr write_lcd return: rts adjust_delay: ldd mydel lsra ; shift D right rorb std mydel ldx #mydel jsr out2bsp jsr outcrlf rts