Page 1 of 1
Add monitor interface to x16emu
Posted: Thu Sep 10, 2020 6:21 pm
by SerErris
I thought about getting a better workflow for programming X16 in assembler.
There are several ways of writing code for X16 and to compile it. That is no issue.
/EDIT: Already there in R38
Quote
However for a full integration a automatic load option would be great.
1. x16emu -load myprog.prg
This will then load the myprog.prg into x16emu and runs it. We can do mimic that via the -bas extension, but a simple option would make that easier.
2. Debugging within the emulator from outside with any IDE is currently not possible (not that I understand how it would be). Can we integrate a standard interface (like VICE does) that enables IDEs to control the build in monitors with breakpoints and stuff? That would be very possible with a monitor running within the emulator instead of running inside the virtual machine with a rom. The monitor we have is build into the x16 roms. But as Vice does it, the monitor is actually part of the emulator and can be controlled by the IDE from outside.
What I am looking for is something CBMStudio or C64Studio does.
If that interface is available, I will work together with the guy who wrote the C64Studio to integrate the X16emu ... then we have a full development IDE with Sprite Editor, Tilemap Editor, Color Editor and stuff including full assembler and debugger support .. I have a dream
?
Add monitor interface to x16emu
Posted: Thu Sep 10, 2020 6:34 pm
by Perifractic
Add monitor interface to x16emu
Posted: Fri Sep 11, 2020 12:37 am
by StephenHorn
A fully automatic load and should should already be possible by combining the -prg and -run command line options:
x16emu.exe -prg "filename.prg" -run
This will load the program "filename.prg" and automatically execute "run" in the console.
What kind of interface does a debugger like C64Studio need? Honestly, what I'd like would be a debugging plug-in for Visual Studio Code, but I've never looked deeply into it. I more or less assumed it would require opening a pipe or something and then communicating with a tool-specific binary protocol.
Add monitor interface to x16emu
Posted: Fri Sep 11, 2020 8:20 am
by SerErris
Yes, thanks for pointing that out. I should really check for updates between releases
? That has been introduced in R38. C64 Studio normally interfaces directly with VICE. VICE has a remote interface to the build in monitor. So it is not a monitor running in the virtual machine (so esp. not like a monitor on a cartridge or ROM) but it runs within the emulator itself. Therefore you can set breakpoints and stuff without the need to change the code in any way. If you hit a certain address the emulator stops execution and shows all values (like a monitor would do). Obviously that is much better in an emulator to do than within a machine. I believe even the -debug option is pretty close already. ... I have not tested it myself. The main issue would be remote control and output of the debugger to inject breakpoints and see the flow inside the IDE together with the source code, the registers and memory segments. Here is the VICE docu on the debugger ... very powerful but not needed for the integration. https://vice-emu.sourceforge.io/vice_12.html#SEC269
Add monitor interface to x16emu
Posted: Fri Sep 11, 2020 9:37 am
by Ender
The one that you get with -debug and typing F12 is pretty close. You can see memory (including VRAM), the registers, flags, disassembly, all that stuff. The only thing it's missing is the ability to inject your own code in.
Add monitor interface to x16emu
Posted: Fri Sep 11, 2020 3:50 pm
by SerErris
Actually the workflow is already working as you can put nearly any tool into C64 Studio. So from code to run is already there. Debug obviously is not working that way (with the debug keys in C64Studio for step etc. pp.)
You need to configure in the Tools section of the preferences a new entry for an emulator and define it as in this screenshot. Works great
And if you put -debug in the line as well you can use the debugger inside. However the debugger with step integration and such stuff does not work right now. Also the assembler does not create 65c02 code, but 6502 code. That means the new instructions available in 65c02 cannot get used.