Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example json file for z88dk on Windows #121

Open
port513 opened this issue Dec 22, 2023 · 8 comments
Open

Example json file for z88dk on Windows #121

port513 opened this issue Dec 22, 2023 · 8 comments

Comments

@port513
Copy link

port513 commented Dec 22, 2023

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
Copy link
Owner

maziac commented Dec 23, 2023

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

@maziac
Copy link
Owner

maziac commented Dec 23, 2023

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

@port513
Copy link
Author

port513 commented Dec 23, 2023

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
Copy link
Owner

maziac commented Dec 23, 2023

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

@maziac
Copy link
Owner

maziac commented Dec 23, 2023

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
Copy link
Author

port513 commented Dec 23, 2023

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
Copy link
Owner

maziac commented Dec 23, 2023

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
Copy link
Owner

maziac commented Dec 28, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants