Commit partial changes. vars should be DS
This commit is contained in:
+67
-7
@@ -14,6 +14,12 @@ bdos equ 0005h
|
||||
conout equ 02h
|
||||
conin equ 01h
|
||||
|
||||
char_idx equ 10h
|
||||
|
||||
temperature equ 20h
|
||||
humidity equ 30h
|
||||
pressure equ 40h
|
||||
|
||||
start:
|
||||
call init_lcd
|
||||
call init_siob
|
||||
@@ -39,7 +45,8 @@ start:
|
||||
|
||||
main:
|
||||
call read_char_b
|
||||
call print_char_to_lcd
|
||||
call parse_char
|
||||
;call print_char_to_lcd
|
||||
ld c,11
|
||||
call bdos
|
||||
or a
|
||||
@@ -88,6 +95,9 @@ delay1:
|
||||
jr nz,delay1
|
||||
ret
|
||||
|
||||
convert_to_hpa:
|
||||
ld a,(pressure)
|
||||
|
||||
read_char_b:
|
||||
wait:
|
||||
in a,(siob_ctrl)
|
||||
@@ -97,7 +107,63 @@ wait:
|
||||
in a,(siob_data)
|
||||
ret
|
||||
|
||||
parse_char: ; char should be in register a
|
||||
cp a,25h ; percent sign (end of transmission)
|
||||
jr z,print_telem_to_lcd
|
||||
cp a,0dh ; carriage return
|
||||
jr z,null_term
|
||||
cp a,0ah ; new line
|
||||
jr z,parse_char_done
|
||||
cp a,054h ; T character
|
||||
jr z,set_char_idx_t ; point the char_idx to the temperature buffer
|
||||
cp a,050h ; P character
|
||||
jr z,set_char_idx_p ; point the char_idx to the pressure buffer
|
||||
cp a,048h ; H character
|
||||
jr z,set_char_idx_h ; point the char_idx to the humidity buffer
|
||||
|
||||
ld bc,(char_idx) ; get address stored in char_idx
|
||||
ld (bc),a ; deref that address and store char
|
||||
inc bc
|
||||
ld (char_idx),bc ; store incremented address in char_idx
|
||||
|
||||
;out (lcd_data),a
|
||||
parse_char_done:
|
||||
ret
|
||||
|
||||
print_telem_to_lcd:
|
||||
call move_to_tempaddr
|
||||
ld hl,temperature
|
||||
call print_str_to_lcd
|
||||
ld a,1h
|
||||
out (0),a
|
||||
ret
|
||||
|
||||
null_term: ; null terminate end of parsed string in memory
|
||||
ld a,00h
|
||||
ld bc,(char_idx)
|
||||
ld (bc),a
|
||||
jr parse_char_done
|
||||
|
||||
|
||||
set_char_idx_t:
|
||||
ld bc,temperature
|
||||
ld (char_idx),bc
|
||||
ret
|
||||
|
||||
set_char_idx_p:
|
||||
ld bc,pressure
|
||||
ld (char_idx),bc
|
||||
ret
|
||||
|
||||
set_char_idx_h:
|
||||
ld bc,humidity
|
||||
ld (char_idx),bc
|
||||
ret
|
||||
|
||||
|
||||
print_char_to_lcd:
|
||||
cp a,00h ; null byte
|
||||
jr z,lcd_done
|
||||
cp a,0dh ; carriage return
|
||||
jr z,lcd_done
|
||||
cp a,0ah ; new line
|
||||
@@ -141,12 +207,6 @@ move_to_humidaddr:
|
||||
out (lcd_ctrl),a
|
||||
ret
|
||||
|
||||
print_char:
|
||||
ld e,a
|
||||
ld c,conout
|
||||
call bdos
|
||||
ret
|
||||
|
||||
clabel: DB 'degree C',0
|
||||
plabel: DB 'pascal',0
|
||||
hlabel: DB '% RH',0
|
||||
|
||||
Reference in New Issue
Block a user