Add 'press Q to exit' function
This commit is contained in:
+14
-4
@@ -13,10 +13,15 @@ humid_offset equ 09eh
|
|||||||
bdos equ 0005h
|
bdos equ 0005h
|
||||||
conout equ 02h
|
conout equ 02h
|
||||||
conin equ 01h
|
conin equ 01h
|
||||||
|
dconio equ 06h
|
||||||
printstr equ 09h
|
printstr equ 09h
|
||||||
|
|
||||||
|
|
||||||
start:
|
start:
|
||||||
|
ld c,printstr ; tell the operator how to quit
|
||||||
|
ld de,quitmsg
|
||||||
|
call bdos
|
||||||
|
|
||||||
call init_lcd
|
call init_lcd
|
||||||
call init_siob
|
call init_siob
|
||||||
call lcd_delay
|
call lcd_delay
|
||||||
@@ -42,11 +47,14 @@ start:
|
|||||||
main:
|
main:
|
||||||
call read_char_b
|
call read_char_b
|
||||||
call parse_char
|
call parse_char
|
||||||
ld c,11
|
ld c,dconio ; direct console i/o, no echo
|
||||||
|
ld e,0ffh ; ff polls, returning zero if no key
|
||||||
call bdos
|
call bdos
|
||||||
or a
|
cp a,051h ; Q
|
||||||
jr z,main
|
ret z
|
||||||
ret
|
cp a,071h ; q
|
||||||
|
ret z
|
||||||
|
jr main ; no key, or a key we ignore
|
||||||
|
|
||||||
init_siob:
|
init_siob:
|
||||||
ld a,018h ; channel reset
|
ld a,018h ; channel reset
|
||||||
@@ -240,6 +248,8 @@ clabel: DB 'degree C',0
|
|||||||
plabel: DB 'hPa',0
|
plabel: DB 'hPa',0
|
||||||
hlabel: DB '% RH',0
|
hlabel: DB '% RH',0
|
||||||
|
|
||||||
|
quitmsg: DB 'Press Q to quit',0dh,0ah,'$'
|
||||||
|
|
||||||
char_max equ 15
|
char_max equ 15
|
||||||
char_cnt DB 0
|
char_cnt DB 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user