Start Org
Start Org
digit of 7-segment DISPLAY MOVE.L #$0FFF, D5 ;store $FF to D5 register as temporary counter REPEAT MOVE.B #$00, $100011 ;Activate the LSB digit (first 7-seg display) lea seg,a0 lea PB,a1 lea digits,a3 MOVE.l a3,a4 UPCOUNT MOVE.B (a3)+,D0 ;Display 0 MOVE.B D0, $100011 ;Display the D0 data to Port B cmp.b #$DF,(a1) ;as long as you hold the button it will be not equal BEQ REPEAT2 BSR DELAY CMP.B #$F6,D0 BNE UPCOUNT BSR REPEAT JMP UPCOUNT ;Check D5 equal 0? If not, branch to REPEAT REPEAT2 MOVE.B #$00, $100011 ;Activate the LSB digit (first 7-seg display) lea digit,a4 DOCOUNT MOVE.B (a4)+,D4 ;Display 0 MOVE.B D4, $100011 ;Display the D0 data to Port B cmp.b #$FD,(a1) ;as long as you hold the button it will be not equal BEQ REPEAT BSR DELAY CMP.B #$60,D4 BNE DOCOUNT BRA REPEAT2 ;Check D5 equal 0? If not, branch to REPEAT digits: dc.b digit: dc.b $F6,$F8,$90,$30,$64,$22,$02,$78,$00,$60 $60,$00,$78,$02,$22,$64,$30,$90,$F8,$F6
DELAY MOVE.L #$FFFFF, D6 ;DELAY subroutine DEL1 cmp.b #$FE,(a1) ;as long as you hold the button it will be not equal BNE DEL2 BSR pause0 DEL2 SUBQ.L #1, D6 BNE DEL1 RTS DELAY2 MOVE.L #$FFFFF, D6 ;DELAY subroutine DEL4 SUBQ.L #1, D6 BNE DEL4 RTS pause0 cmp.b #$FE,(a1) ;as long as you hold the button it will be not equal BNE pause0 RTS END START ;end of program