
3–407
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
dec DA ;do this for all 8 CGRAM characters
bne cg8
lda weath ;get weather variable and decide which message to display
cmp #$04
bne try3210
ldhx #msg02e ;if $04
bra showit
try3210: cmp #$03
bne try210
ldhx #msg02d ;if $03
bra showit
try210: cmp #$02
bne try10
ldhx #msg02c ;if $02
bra showit
try10: cmp #$01
bne try0
ldhx #msg02b ;if $01
bra showit
try0: ldhx #msg02a ;otherwise this one
showit: jsr lcdstro
jsr del1s ;1s between pressure/altitude readings
brset 1,porta,contin ;exit only if SEL
brset 2,porta,contin ;and ENT pressed together
jmp MENU
contin: jmp LVLwarm
;__________________________________________________________
LfNx: sub N1 ;*** PX=f(NX,N2,N1) ***
ldx #$A0 ;x160
mul
sta NA
stx NB
clr NC ;NCNBNA:=(NX–N1)*160
lda N2
sub N1
sta DA
clr DB
clr DC
jsr NdivD ;RBRA:=(NX–N1)*160/(N2–N1)
lda RA
rts
;__________________________________________________________
NdivD: clr RA ;RBRA:=NCNBNA/DCDBDA
clr RB ;destroys NCNBNA and DCDBDA
keepatit: lda RA
add #$01
sta RA
lda RB
adc #$00
sta RB ;increment RB:RA
lda NA
sub DA
sta NA
lda NB
sbc DB
sta NB
lda NC
sbc DC
sta NC ;NC:NB:NA:=NC:NB:NA–DC:DB:DA
bcc keepatit ;keep counting how many times until overflow
lda RA
sub #$01
sta RA
lda RB
sbc #$00
sta RB ;we counted once too many, so undo that
lsr DC
ror DB
ror DA ;divide DC:DB:DA by 2
lda NA
add DA
sta NA
lda NB
F
Freescale Semiconductor, Inc.
n
.