empathicqubit/vscode-cc65-debugger

Attaching a disk-image during debugging.

KlausLoeffelmann opened this issue · 4 comments

I am trying to write code for handling disks.
That means, I would need to debug this code based on certain disks I virtually insert/change during a debugging session.

I notice, that this code...

        // This is the spot where I try to change the disk. Virtually.
	firstChar = cgetc();

	status=cbm_opendir(1,8);   // I change this to 9 with a virtual disk inserted, but that fails.
	printf("...opening directory...\n");
	if (status == 0)
	{
		printf("...OK...reading directory:\n\n");

		do
		{
			status = cbm_readdir(1, l_dirent);
			printf("%d %s %d %d \n", l_dirent->type,l_dirent->name, l_dirent->size, l_dirent->type);
		} while (status != 2);

		printf("...Done.\n\n");
	}

...shows the directory, but that is mapped to the actual working directory of the host machine. Which is somewhat expected.

Now I tried to map a d64 image to drive 9.
And with that, the code crashes.

Are there any best practice how to achieve that?

Thanks,

Klaus

In this context, although not directly related, I am having two additional questions:

  • Would it be possible to enable assembler code generation for the respective C-Code, when debugging?
  • Since I know nothing about make files: Is it possible to run some (in my case, command or PowerShell) scripts before starting Vice (after finishing Vice?) for log, deployment (maybe via FTP to an Ultimate machine) or clean-up purposes? What would be best practice if that's principally possible?

Nope. My embarrassing mistake.
I screwed up pointer operations (coming from C#... ) and overwrote memory. 🤦
It's working fine.

And I also found the hint to *.mk files for additional make files...
I probably can ramp up enough to make this happen as well.

Closing this.
🤷

You had mentioned working with disk images. If you need the program itself to be placed on a disk image file you could use c1541 in the Makefile. https://github.com/empathicqubit/c64-thepunchlineismachismo/blob/master/Makefile#L135
VSCode has prelaunch and postlaunch tasks. I tested quickly with this extension and it worked nicely.

Brilliant tips - thanks for those!!