Using MAME to emulate the VIC
Moderator: Moderators
Using MAME to emulate the VIC
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!
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!
P*h*i*l*l*i*p EEaattoon in real life
Re: Using MAME to emulate the VIC
I got a bit further...this gives me a 16k VIC at the READY. prompt, but doesn't run the .prg file.
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
Now for some proper testing!
Code: Select all
mame.exe vic20p -quik roms\jetpac.prg -rompath .\roms -exp 16k -debug -debugger_font_size 9 -natural -nomax

Now for some proper testing!
P*h*i*l*l*i*p EEaattoon in real life
- chysn
- Vic 20 Scientist
- Posts: 1204
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: Using MAME to emulate the VIC
I've found the Vice monitor to be easy-to-use and very powerful. What does the MAME debugger do differently?
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5
WIP: MIDIcast BASIC extension
he/him/his
WIP: MIDIcast BASIC extension
he/him/his
Re: Using MAME to emulate the VIC
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.
Last edited by D-Type on Tue May 17, 2022 2:56 am, edited 1 time in total.
P*h*i*l*l*i*p EEaattoon in real life
Re: Using MAME to emulate the VIC
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-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.

P*h*i*l*l*i*p EEaattoon in real life
Re: Using MAME to emulate the VIC
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
Sounds you are using ancient VICE to me 

I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Re: Using MAME to emulate the VIC
thanks, I just looked at the latest and it seems like they've fixed all those issues by just removing the UI 

Re: Using MAME to emulate the VIC
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)
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)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Re: Using MAME to emulate the VIC
Yup, most/all of those things were fixed ages ago.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
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.
P*h*i*l*l*i*p EEaattoon in real life
Re: Using MAME to emulate the VIC
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
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
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.
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.
-
- Omega Star Commander
- Posts: 1375
- Joined: Thu Jan 31, 2008 2:12 pm
- Website: https://robert.hurst-ri.us
- Location: Providence, RI
- Occupation: Tech & Innovation
Re: Using MAME to emulate the VIC
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.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
https://robert.hurst-ri.us/rob/retrocomputing
Re: Using MAME to emulate the VIC
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.
I forked the repository, but that's as far as I got, so hope you can do better than I did.
-
- Omega Star Commander
- Posts: 1375
- Joined: Thu Jan 31, 2008 2:12 pm
- Website: https://robert.hurst-ri.us
- Location: Providence, RI
- Occupation: Tech & Innovation
Re: Using MAME to emulate the VIC
Refer to Debugging using MAME/MESS 12 years ago. I just checked and the document links mostly work.

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.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
https://robert.hurst-ri.us/rob/retrocomputing