From 0b4cb9f0b8debd9041a59cec5b1404dee79e8e06 Mon Sep 17 00:00:00 2001 From: maddiebaka Date: Sun, 23 Aug 2026 20:31:56 -0400 Subject: [PATCH] Add 'press Q to exit' function --- bme280_util.z80 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bme280_util.z80 b/bme280_util.z80 index cf0e647..2c4a0b6 100644 --- a/bme280_util.z80 +++ b/bme280_util.z80 @@ -13,10 +13,15 @@ humid_offset equ 09eh bdos equ 0005h conout equ 02h conin equ 01h +dconio equ 06h printstr equ 09h start: + ld c,printstr ; tell the operator how to quit + ld de,quitmsg + call bdos + call init_lcd call init_siob call lcd_delay @@ -42,11 +47,14 @@ start: main: call read_char_b 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 - or a - jr z,main - ret + cp a,051h ; Q + ret z + cp a,071h ; q + ret z + jr main ; no key, or a key we ignore init_siob: ld a,018h ; channel reset @@ -240,6 +248,8 @@ clabel: DB 'degree C',0 plabel: DB 'hPa',0 hlabel: DB '% RH',0 +quitmsg: DB 'Press Q to quit',0dh,0ah,'$' + char_max equ 15 char_cnt DB 0