Problems with KILBUF

بواسطة litwr

Resident (54)

صورة litwr

04-11-2022, 13:16

Hi there
Does anybody know how function KILBUF works? IMHO it does nothing! Shocked! Let me present a tiny program

SNSMAT equ #0141
KILBUF equ #0156
   org #8000
   xor a
l: call SNSMAT
   call KILBUF
   inc a
   jr z,l  ;Press 1 to exit
   ret

It proves my claim, it prints the char pressed. Maybe I have missed something? Any help is welcome. A lot of thanks in advance.

Login أوregister لوضع تعليقاتك

بواسطة SjaaQ

Champion (369)

صورة SjaaQ

04-11-2022, 14:01

I always clear the buffer after calling it:

;kill keyboard buffer
ld iy,(EXPTBL-1)
ld ix,KILBUF
call CALSLT

ld hl,KEYBUF
ld de,KEYBUF+1
ld bc,40-1
ld (hl),0
ldir

بواسطة erikmaas

Expert (70)

صورة erikmaas

04-11-2022, 16:20

You are flushing the keyboard buffer before the keypress is actually written into the buffer.

SNSMAT directly reads the scan matrix. The keyboard buffer is filled in VSYNC interrupt context.

Maybe you want to flush the buffer on release of the key once it was pressed.

بواسطة litwr

Resident (54)

صورة litwr

05-11-2022, 08:17

Thanks, actually I began to suspect myself that I need to insert some delay. Smile

بواسطة gdx

Enlighted (5991)

صورة gdx

05-11-2022, 09:49

Try that to klll the buffer:

	ld	hl,(0F3F8h)
	ld	(0F3FAh),hl

بواسطة ro

Scribe (4860)

صورة ro

05-11-2022, 13:28

litwr wrote:

Thanks, actually I began to suspect myself that I need to insert some delay. Smile

Understand the concept and difference between reading the keyboard matrix and using keyboard handling functions.

On the default interrupt the keyboard matrices are read and results are processed to the buffer.

In your case, you confuse direct read with the keyboard handling functions.

Snsmat reads the matrix.
Killbuf clears the buffer used by the int keyboard handler. Two different things.