maziac / DeZog

Visual Studio Code Debugger for Z80/ZX Spectrum.
MIT License
210 stars 34 forks source link

ini instruction #89

Closed denisiorus closed 2 years ago

denisiorus commented 2 years ago

can't read zx-spectrum emulated keyboard with ini instruction. in a,(c) works as expected.

maziac commented 2 years ago

Could you maybe share your project (launch.json) and code. Even better your whole zipped project.

denisiorus commented 2 years ago

inisamp.zip

polls keys: 0,9,8,7,6,N,Y,Q pay attention to lines: 40 (main.asm), 200 (keys.asm)

maziac commented 2 years ago

Seems to work for me. I tested here with the Z-key. keyb For e.g. '9' it works also the same.

denisiorus commented 2 years ago

Change IF 1 to IF 0 at line 201 (keys.asm). It works because INI instruction is replaced by piece of code: in a,(c) ld (hl),a inc l

maziac commented 2 years ago

Ah, I see. And you are right, the INI instruction is not working. I fixed it now: It decremented B to early. Please try the new vsix here https://github.com/maziac/DeZog/releases/tag/v2.6.3-rc1 and let me know if it is working.

denisiorus commented 2 years ago

Yes, now ini works well. But I decided to check ind and it doesn't work. I guess it decrements B too early too :) Maybe you should check all of similar instructions like: INIR, INDR, OUTI, etc...

maziac commented 2 years ago

Shit. Is now corrected.

The R(epeat) instructions just call the single instruction in a loop. So that should be fine as well.

OUTI/D is now corrected as well.

Here it was implemented according to the ZILOG pseudo code. But that actually seems wrong. See https://github.com/maziac/z80-instruction-set/pull/10.

In rc3 also the outd/i is corrected: https://github.com/maziac/DeZog/releases/edit/v2.6.3-rc1