z88dk / z88dk

The development kit for over a hundred z80 family machines - c compiler, assembler, linker, libraries.
https://www.z88dk.org
Other
914 stars 174 forks source link

[NASCOM] Keyboard input very slow (maybe new issue) and no auto-repeat (old issue) #590

Open Fabrizio-Caruso opened 6 years ago

Fabrizio-Caruso commented 6 years ago

It seems to me that the Nascom target has some serious issue with the keyboard input:

suborb commented 6 years ago

I'm just playing around with adv_a and virtualnascom/NASSYS to see what the behaviour is.

Initial key detection seems to be okay (i.e. on a par with NASSYS), but the first key repeat is very slow, subsequent seems ok. This will be using fgetc_cons()/getch() using rst 8 (RIN). This will wait for a key to be pressed. I suspect there might be a poke that can be made to improve key repeat speed.

getk() which just polls the keyboard calls rst 18/0x62 (IN) which doesn't wait. That shows the same behaviour in terms of delays.

I want to find another source of information, but http://www.nascomhomepage.com/pdf/Guide_to_NAS-SYS.pdf suggests that there is another keyboard driver in NASSYS-3 that supports key repeat. Though the obvious question I have is why my emulator supports key repeat on the alternate system calls - which emulator are you using?

It might be worthwhile poking the addresses mentioned below to get some tuning happening: nascom-kbd

Fabrizio-Caruso commented 6 years ago

I am using the Windows version of Virtual-nascom-20 (which maybe was ported by a friend of ours).

suborb commented 6 years ago

@zx70 any ideas on the difference behaviour between the Mac build and Windows build? - The Mac one uses SDL.

zx70 commented 6 years ago

Dominic, I thought at a problem in the emulator but all the emulators I've tried had the same problem. your finding halves the problem, because still nas-sys 3 is the only ROM supporting this type of keyboard scanning. But I must thank you a lot for the hint!

suborb commented 6 years ago

So, should we add support for the RKBD driver then?

zx70 commented 6 years ago

I Think so, most of the nascom computers were not shipped with the nassys3.. obviously it is not urgent and changes this issue from bug to enhancement

suborb commented 6 years ago

Keyboard bits are defined in https://github.com/mamedev/mame/blob/5be75c4a63932afaaad8af9bb9e333d59cf8e788/src/mame/drivers/nascom1.cpp

I think it's read as follows:

out ($00), 2 -> reset keyboard counter in a,($00) -> row 0 out ($00), 1 in a,($00) -> row 1 ... etc up to row 8

So we could add an inkey driver hopefully without too much trouble