Skip to content

Commit 9cc018e

Browse files
Various keyboard tweaks
1 parent 7cdd375 commit 9cc018e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

patch.asm

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; Title: BBC Basic for AGON
33
; Author: Dean Belfield
44
; Created: 03/05/2022
5-
; Last Updated: 28/03/2023
5+
; Last Updated: 02/04/2023
66
;
77
; Modinfo:
88
; 24/07/2022: OSWRCH and OSRDCH now execute code in MOS
@@ -24,6 +24,7 @@
2424
; 21/03/2023: Added FX/OSBYTE functions for keyboard control, STAR_FX fixed to accept a single 16-bit parameter
2525
; 25/03/2023: Fixed range error in OSBYTE, now calls VBLANK_INIT in OSINIT, improved keyboard handling
2626
; 28/03/2023: Improved BYE command
27+
; 02/04/2023: Various keyboard tweaks
2728
2829
.ASSUME ADL = 0
2930
@@ -123,7 +124,10 @@ OSLINE1: PUSH IY
123124
LD A, (FLAGS) ; Otherwise
124125
RES 7, A ; Clear the escape flag
125126
LD (FLAGS), A
126-
XOR A ; Return A = 0
127+
CALL WAIT_VBLANK ; Wait a frame
128+
XOR A ; Return A = 0
129+
LD (KEYDOWN), A
130+
LD (KEYASCII), A
127131
RET
128132

129133
; PUTIME: set current time to DE:HL, in centiseconds.
@@ -234,7 +238,10 @@ OSKEY: CALL READKEY ; Read the keyboard
234238
CALL WAIT_VBLANK ; Wait a frame
235239
DEC HL ; Decrement
236240
JR OSKEY ; And loop
237-
$$: CP 1BH ; If we are not pressing ESC,
241+
;
242+
$$: LD HL, KEYDOWN ; We have a key, so
243+
LD (HL), 0 ; clear the keydown flag
244+
CP 1BH ; If we are not pressing ESC,
238245
SCF ; then flag we've got a character
239246
RET NZ
240247
;

0 commit comments

Comments
 (0)