#include "c:\miniide\hcs12.inc" pat_port equ PORTB ; Port that drives the segment pattern pat_dir equ DDRB ; direction register of the segment pattern sel_port equ PORTK ; Port that select the digit sel_dir equ DDRK ; direction register of the select port org $1500 movb #$FF,pat_dir ; configure pattern port for output movb #$3F,sel_dir ; configure digit select port for output forever ldx #disp_tab ; use X as the pointer loop movb 1,x+,pat_port ; output the digit pattern and move the pointer movb 1,x+,sel_port ; output the digit select value and move the pointer ldy #1 ; wait for 1 ms ; wait for 1 ms jsr delayby1ms ; “ cpx #disp_tab+12 ; reach the end of the table bne loop bra forever #include "c:\miniide\delay.asm" disp_tab dc.b $30,$20 ; seven-segment display table dc.b $6D,$10 dc.b $79,$08 dc.b $33,$04 dc.b $5B,$02 dc.b $5F,$01 end