9.7. A SIMPLE DIGITAL VOLTMETER 99
TAB *COPY A TO B
H2B.LT
CMPB #10 *IS B < 10
BLO H2B.DONE *IF SO WE ARE DONE
SUBB #10 *B <- B-10
ADDA #6 *A <- A+6
BRA H2B.LT
H2B.DONE
PULB
RTS
7. We can go back and repeat the steps (the first need not be performed more
than once). It is convenient to check the keyboard and go back only if the
user has not pressed the ESC key (code 27).
The complete program to achieve these steps is given below
;;;;;;;;;;;;;;;;;;;;;Start: A/D code ;;;;;;;;;;;;;;;;;;;;;;
OUTLHLF EQU $FFB2
OUTRHLF EQU $FFB5
OUTCRLF EQU $FFC4
INPUT EQU $FFAC
OUTA EQU $FFB8
OPTION EQU $1039
ADCTL EQU $1030
ADR1 EQU $1031
ORG $C000
;STEP 1
;TURN A/D ON
LDAA #%10000000
STAA OPTION
LDAA #40
LT
DECA
BNE LT
Comentarios a estos manuales