cmp #$01
beq Lzero
;if result is $01
;then display it directly
makeRB lsl RB
dbnza makeRB
bra Lzero
;otherwise shift 1 pixel bit to the right place
;by counting down result of division
Lsat: mov #$80,RB
Lzero: lda RB
;if full then position highest pixel
ldhx #ramfree+$27 ;last of the 40
sta 0,x
;put it at then end of the 40 bytes (new value), all others were shifted left
;weath will contain dynamic change based also on value of RB
;if RB=$00 then weath=$00: "empty"
clr weath
lda RB
beq donew
cmp #$80
bne notfull
;
mov #$01,weath ;if $80 then weath=$01: "full"
bra donew
notfull mov #$02,weath ;prepare for "steady" if L(i)=L(i-1)
lda OA
;get current level value L(i)
cmp Lgfx
beq donew
;compare to previous level value L(i-1)
mov #$03,weath ;"filling" if L(i)>L(i-1)
bcc donew
mov #$04,weath ;"emptying" otherwise
donew: lda OA
;current level L(i)
;minus previous level L(i-1)
;establishes rate: L(i)-L(i-1)
;update L(i-1)
sub Lgfx
sta MA
mov RA,Lgfx
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
golevel: lda #$80
jsr lcdcmdo
;******** now let's display the level in decimal ********
;start on 1st character of 1st line
;get current level value
;and divide by 100
lda OA
clrh
ldx #$64
div
bne over100
lda #$20
jsr lcdchro
bra lnext
over100: jsr lcdnibo
lnext: pshh
pula
;if result is >0 then handle "hundreds"
;otherwise display space (remove leading 0)
;display "hundreds" digit
;move remainder into A
;divide by 10
clrh
ldx #$0A
div
jsr lcdnibo
lda #'.'
;display "tens" digit
jsr lcdchro
pshh
;display decimal point
pula
jsr lcdnibo
lda UnitType
cmp #$3F
beq dsplIN
;and first decimal
;check for cm ($A0) vs. in (#3F)
dsplCM: lda #'c'
jsr lcdchro
lda #'m'
AN1950
12
Sensors
Freescale Semiconductor