Page 1 of 1

Using MAME to emulate the VIC

Posted: Sun May 15, 2022 2:42 pm
by D-Type
I'm looking to debug a game and I need an emulator with a debugger. I've tried VICE 3.2 debugger (i.e. version before the SDL/GTK split) and I'm thinking that I'd be better off with the MAME debugger that I've previously used successfully for debugging TRS-80 and Vectrex binaries as I know the commands and hotkeys. I know the MAME VIC-20 driver has some remaining issues, but I'm hopeful they'll not affect what I'm looking to do.

I do recall getting the TRS and Vectrex to run under MAME took a bit of trial and error.

Does anyone have a example Windows command line I can use to start MAME emulating a VIC-20 with 8K ram expansion and a .PRG program file?

TIA!

Re: Using MAME to emulate the VIC

Posted: Sun May 15, 2022 3:25 pm
by D-Type
I got a bit further...this gives me a 16k VIC at the READY. prompt, but doesn't run the .prg file.

Code: Select all

mame.exe vic20p   -quik roms\jetpac.prg  -rompath .\roms -exp 16k -debug  -debugger_font_size 9  -natural  -nomax
UPDATE...actually the above works. (I obviously needed all the roms in the appropriate folder.) I just needed to type LIST and it shows you a SYS command. Typed RUN and off it goes :D

Now for some proper testing!

Re: Using MAME to emulate the VIC

Posted: Mon May 16, 2022 11:43 am
by chysn
I've found the Vice monitor to be easy-to-use and very powerful. What does the MAME debugger do differently?

Re: Using MAME to emulate the VIC

Posted: Mon May 16, 2022 4:03 pm
by D-Type
chysn wrote: Mon May 16, 2022 11:43 am I've found the Vice monitor to be easy-to-use and very powerful. What does the MAME debugger do differently?
It's several little things...
- Lets you see memory dumps in a matrix of any size like a hex editor, instead of just a list
- Let's you set the display font and size, useful on a hi-res monitor
- It has easy to use Function-keys for stepping
- Can run the program and you can watch the instructions in the disassembly window i.e. fast auto-stepped
- Has a watchpoints window
- I know how to use it
...it just seems a bit more polished.

I have MAME running now...Llamasoft Matrix runs perfectly, but Jetpac seems to have the fire button held down and Jetman flies right and fires all the time. It could be a bug in MAME, apparently not so many people use it because VICE is available, so bugs don't get fixed. This is a shame, because the debugger is good.

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 2:56 am
by D-Type
D-Type wrote: Mon May 16, 2022 4:03 pm...but Jetpac seems to have the fire button held down and Jetman flies right and fires all the time. It could be a bug in MAME, apparently not so many people use it because VICE is available, so bugs don't get fixed. This is a shame, because the debugger is good.
I mentioned the strange behaviour I was experiencing with the controls to a MAME-whizz friend. He checked out the source and found that the 2nd VIA wasn't configured correctly in the driver. He fixed it and committed it to Git. Hopefully I'll have a new MAME binary today to test with. :D

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 6:30 am
by beamrider
chysn wrote: Mon May 16, 2022 11:43 am I've found the Vice monitor to be easy-to-use and very powerful. What does the MAME debugger do differently?
I get by with it, but it does have many annoyances.

- it doesn't remember what windows you have open / position and resets each debugging session.
- when it breaks, the breakpoint is at the very top of the window so you can't see the preceding instructions for context without scrolling
- no scroll-wheel support
- why does registers need to be a separate tiny window that you have to open every time?
- no keyboard shortcuts for step-in/over etc that I can see
- a call stack would be extremely useful
- it's supposedly an MDI app but 3 out of 4 windows are free floating, just the monitor CLI is an internal window ?
+ others that I can't remember off-hand

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 6:50 am
by groepaz
Sounds you are using ancient VICE to me :)

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 7:17 am
by beamrider
thanks, I just looked at the latest and it seems like they've fixed all those issues by just removing the UI :lol:

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 7:50 am
by groepaz
That "UI" for the monitor was never really ment to be even deployed, its broken and unfinished all over the place - as you have noticed already.

If you really want this kind of thing, you can always use an external debugger (like cbm prg studio, for example).

(the call stack is "bt" btw, even in the ancient one)

Re: Using MAME to emulate the VIC

Posted: Tue May 17, 2022 3:43 pm
by D-Type
beamrider wrote: Tue May 17, 2022 6:30 am I get by with it, but it does have many annoyances.

- it doesn't remember what windows you have open / position and resets each debugging session.
- when it breaks, the breakpoint is at the very top of the window so you can't see the preceding instructions for context without scrolling
- no scroll-wheel support
- why does registers need to be a separate tiny window that you have to open every time?
- no keyboard shortcuts for step-in/over etc that I can see
- a call stack would be extremely useful
- it's supposedly an MDI app but 3 out of 4 windows are free floating, just the monitor CLI is an internal window ?
+ others that I can't remember off-hand
Yup, most/all of those things were fixed ages ago.

It doesn't show the call stack, but you could open a memory window showing the stack address area and resize it to 2 bytes wide.

Regarding windows open/position, that was a problem for me previously. When I was debugging the Vectrex it was even worse because save states aren't supported and I needed about 6 memory block windows open, it was a nightmare to reopen them to the right size each restart. The workaround was to use Microsoft PowerToys FancyZones, then at least you could quickly drag and drop them into predefined zones and they'd snap into place.

I have my fresh build of MAME with the fixed VIC-20 driver, JETPAC is working great now with keys and joystick, look out for it in the next MAME release.

Re: Using MAME to emulate the VIC

Posted: Fri May 20, 2022 12:41 pm
by beamrider
so I tried getting this to work in VS-code but no luck even building the .asm test project they supply. Get an error, "The output stream for this command is already redirected" when I try and run with F5.

https://marketplace.visualstudio.com/it ... .cc65-vice

looks like back to Notepad++ and the old clunky debugger

Edit: bug-report https://github.com/empathicqubit/vscode ... issues/112

Re: Using MAME to emulate the VIC

Posted: Tue May 31, 2022 6:04 am
by beamrider
I've managed to get https://marketplace.visualstudio.com/it ... .cc65-vice working, however it doesn't appear to offer much support for assembler. No watch variables/call stack! I've put in a feature request.

Alchemy 65 looks better, but only works for the NES emulator, looks like it would be relatively straight to fork the project and change it to Commodore/VICE.

Re: Using MAME to emulate the VIC

Posted: Fri Sep 02, 2022 5:25 am
by rhurst
Nice, I'll have to take a look into these VS Code extensions -- IMO, getting a comprehensive setup to work for the Commodore 8-bits is a worthy pursuit.

Re: Using MAME to emulate the VIC

Posted: Fri Sep 02, 2022 5:41 am
by beamrider
Hi Robert, nice to here you back on here..hope you're doing well.

I forked the repository, but that's as far as I got, so hope you can do better than I did.

Re: Using MAME to emulate the VIC

Posted: Sun Sep 04, 2022 8:16 am
by rhurst
Refer to Debugging using MAME/MESS 12 years ago. I just checked and the document links mostly work. :P
beamrider wrote: Fri Sep 02, 2022 5:41 am Hi Robert, nice to here you back on here..hope you're doing well.
I am doing OK, bud, thanks for asking! I've done mostly QA work with another Code extension for enterprise DB scripting, but always wanted to break ground on adding in support for ca65 (I know, there are other assemblers, so maybe allow for 'dialect') and perhaps have it work with the VICE debugger. I'll poke around and see if it sticks.