maziac / DeZog

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

Z80CPU Error: TypeError: Cannot read properties of undefined (reading 'start') #107

Closed CasperDev closed 1 year ago

CasperDev commented 1 year ago

Changing PC register in active debug session corrupt session. Next click on StepIn or StepOver throws Z80CPU Error: TypeError: Cannot read properties of undefined (reading 'start') and makes debug session unable to continue.

Steps to reproduce the behavior:

  1. Clone example repo (https://github.com/maziac/z80-sample-program)
  2. Open in VSCode folder z80-sample-program
  3. Run Build task
  4. Start debug session (cursor stops at line 60 as expected)
  5. Press F10 twice (StepOver) - cursor advances to line 64 and Z80 registers change as expected
  6. Change PC register from 8004h to 8007h - cursor advances to next instruction at line 65 as expected
  7. Press F10 or StepOver button - session crashes and above error is shown in debug console.

Expected behavior After changing PC register internal simulator should resume debug from new address stored in PC register (as reflected by cursor position on screen)

Version etc. (please complete the following information):

Additional context Project files as cloned from https://github.com/maziac/z80-sample-program today. All files including task.json and launch.json uses as is from above repo w/o any modification.

I believe this bug existed quite long. Tested also with Dezog 2.0

maziac commented 1 year ago

I could reproduce the described. Thanks for reporting. Seems the bug is happening only for the internal zsim. I tested with e.g. CSpect: there it works correctly. (And that's why it most probably slipped through...)

maziac commented 1 year ago

Could you please try out this fix. dezog-3.2.1-rc1.vsix.zip

CasperDev commented 1 year ago

I can confirm that bug is fixed. Also FYI another issue (I didn't posted) is fixed too. It was about changing register value when I couldn't write "8007h" but I was forced to use C format like "0x8007" - but like I said it's fixed now. I'm trying to use your awesome tools to develop software for non ZX computer (Sanyo Laser 210/ Dick Smith VZ200 and family) so you can expect more voice from me.

maziac commented 1 year ago

"Also FYI another issue (I didn't posted) is fixed too" That's because I used a converter function now that is also used in other places in DeZog. You could furthermore also use label names as input or e.g. "DE" for the register DE or SP for the stack pointer etc.

"to develop software for non ZX computer" Yes, please do so and let me know if you run into any trouble. Maybe 2 hints:

  1. with the "customMemory" (launch.json) you can setup your customized memory layout
  2. with "customCode" you can even setup/simulate some peripherals.