maziac / DeZog

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

Example json file for z88dk on Windows #121

Closed port513 closed 1 week ago

port513 commented 6 months ago

Describe the bug Maybe my setup but it does not recognize my breakpoints, it only shows the disassembled code. I'm using z88dk with a mix of asm and c and the internal emulator.

I would like a functional example of the json file of how it should be configured.

maziac commented 6 months ago

Could you zip your whole project together with the .vscode folder and attach it here. I will have a look.

maziac commented 6 months ago

A sample can be found here: https://github.com/maziac/z80-sample-program

port513 commented 6 months ago

ZX-Spectrum.zip This is my config. The whole point of using z88dk is to be able to mix asm in C-code and that doesn't seems to be a hit with DeZog

maziac commented 6 months ago

Could you add your build directory to the zip, then I don't have to compile myself.

maziac commented 6 months ago

Maybe for clarification: With DeZog you can step through (or break in) assembler or lis(t) files. It's not possible with c-files or assembler embedded in c-files. If you have a mixed projects with c- and assembler files you can break inside the asm files but not in the c-files. The only thing you can do if you have compiled c-sources is to step through (or break in) a lis(t) file that was created from the c-file.

port513 commented 6 months ago
  1. build.zip Build files, I know it shouldn't debug C-code but it should use the hello.asm file if I put a break in that.

maziac commented 6 months ago

Didn't have much time to look into it, but it seems that the _fromASM cannot be found from the specnext-c-starter.lis file for some reason.

BTW there is a z88dk example here: https://github.com/maziac/currah_uspeech_tests But note that this is for the old list file version (1), not the current (v2).

maziac commented 6 months ago

Hmm, I tried to run the makefile to build from the sources but it did not work for me:

specnext-c-starter % make
<path>/z88dk/z88dk.bin/bin/zcc +zxn -subtype=nex -vn --list -m -s -clib=sdcc_iy -pragma-include:zpragma.inc -startup=0  src/specnext-c-starter.c  src/hello.asm -o build/specnext-c-starter -create-app
sh: z88dk-zpragma: command not found
src/specnext-c-starter.c:4: warning 283: function declarator with no prototype
src/specnext-c-starter.c:6: warning 283: function declarator with no prototype
src/hello.asm:7: error: syntax error
  ^---- PUSH A
src/hello.asm:8: error: syntax error
  ^---- POP A
make: *** [build/specnext-c-starter.nex] Error 1

I exchanged it with "PUSH AF"/"POP AF". Now it builds.

With a few modifications I was also able to set a breakpoint: 1) zcc creates several list files. The one in the build directory does not contain the _fromASM subroutine. Instead it builds a "specnext-c-starter/src/hello.asm.lis" list-file. Use that one. 2) The new format of list files for z88dk requires to use "z88dkv2" instead of "z88dk". 3) The "srcDirs" folder need to include the 'parent' path of the files mentioned in the list file. Here it is: specnext-c-starter

So the resulting configuration is:


            "z88dkv2": [
                {
                    "path": "specnext-c-starter/src/hello.asm.lis",
                    "mapFile": "specnext-c-starter/build/specnext-c-starter.map",
                    "srcDirs": [
                        "specnext-c-starter"
                    ]
                }
            ],

With this I was able to break and step: Bildschirmfoto 2023-12-28 um 19 12 45