Using MAME to emulate the VIC

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Using MAME to emulate the VIC

Post 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!
P*h*i*l*l*i*p EEaattoon in real life
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Re: Using MAME to emulate the VIC

Post 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!
P*h*i*l*l*i*p EEaattoon in real life
User avatar
chysn
Vic 20 Scientist
Posts: 1205
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

Post by chysn »

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
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Re: Using MAME to emulate the VIC

Post 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.
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
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Re: Using MAME to emulate the VIC

Post 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
P*h*i*l*l*i*p EEaattoon in real life
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Using MAME to emulate the VIC

Post 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
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Using MAME to emulate the VIC

Post by groepaz »

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.
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Using MAME to emulate the VIC

Post 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:
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Using MAME to emulate the VIC

Post 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)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
D-Type
Vic 20 Drifter
Posts: 23
Joined: Sun Jul 05, 2020 4:07 am
Location: Zurich, Switzerland

Re: Using MAME to emulate the VIC

Post 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.
P*h*i*l*l*i*p EEaattoon in real life
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Using MAME to emulate the VIC

Post 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
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Using MAME to emulate the VIC

Post 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.
rhurst
Omega Star Commander
Posts: 1371
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

Post 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.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Using MAME to emulate the VIC

Post 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.
rhurst
Omega Star Commander
Posts: 1371
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

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