vic20-emu (another emulator)

You need an actual VIC.

Moderator: Moderators

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: vic20-emu (another emulator)

Post by chysn »

Mike wrote: Sun Jul 19, 2020 4:38 pm More details to be found here: How to start .prg files in VICE.
Great info! I've been re-mounting a .d64 file with each build, so this will save a lot of time.

Does the vic20-emu have a way to save files to the local system's disk?
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
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

Noizer wrote: Sun Jul 19, 2020 7:45 am Nice. But who need another soft emulator when the answer is FPGA? Why not complete the vicy cores?
this is just a personal project I need when cross-developing software for the VIC-20. For example I am able to compile a program and have it instantly "hot reloaded" on the emu. Or set breakpoints and inspect machine register programmatically. When you have full control you can do lot of things. I also want to develop a version for mobile phones with a nice on-screen keyboard, so you have a VIC-20 always with you :-)
chysn wrote: Sun Jul 19, 2020 5:55 pm Does the vic20-emu have a way to save files to the local system's disk?
vic20.save("filename.prg");
and then
vic20.download("filename.prg")

unfortunately the browser sandbox does not allow to access the file system directly.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

DarwinNE wrote: Sun Jul 19, 2020 2:32 pm I tried it with a small game I wrote, Alien Invasion:
ok, I fixed it, the screen geometry was wrong. For reference I used a program I wrote back in 2008 which I posted here on Denial, sadly most of the pictures are broken links in 2020:
Maximum display size PAL and NTSC, post your pics here

As regards "Cavern Explorer" I'm looking into it, the current emulation has issues when the display is moved off-screen. Unfortunately it's not code of mine, so I am trying to make a sense out of it, comparing the source with the FPGA implementation and other emulators. It's a good chance to get close to the silicon and learn something new :-)
DarwinNE
Vic 20 Devotee
Posts: 231
Joined: Tue Sep 04, 2018 2:40 am
Website: http://davbucci.chez-alice.fr
Location: Grenoble - France

Re: vic20-emu (another emulator)

Post by DarwinNE »

I really like playing Alien Invasion in a browser, it works quite well now! BTW, I noticed a slight delay between the game and the audio effects, is there an audio buffer somewhere?

Is there a way to integrate the emulator in a webpage such as there?
http://davbucci.chez-alice.fr/index.php ... ieninv.inc
It would be nice to offer the possibility to play the game online.

Concerning Cavern Explorer, I used some quirky effects on the VIC to simulate a pixel by pixel scrolling. I had to test it both on VICE and on a real machine as I realized the version of VICE I was using was not sufficiently precise for some details. At the end, I could manage to have a version that was behaving the same on the real hardware and on the emulator, so I guess it may be a good test for your emulator, too.

If you need the code, here it is: https://github.com/DarwinNE/vic20-caver ... explorer.s
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

DarwinNE wrote: Mon Jul 20, 2020 9:23 am I really like playing Alien Invasion in a browser, it works quite well now! BTW, I noticed a slight delay between the game and the audio effects, is there an audio buffer somewhere?
I am enjoying it as well :-) yes there is a 4096 bytes buffer because the audio was glitching on my old computer, I have to find it a good value that also works on slow mobile phones (perhaps that could be selectable by the user).
DarwinNE wrote: Mon Jul 20, 2020 9:23 am Is there a way to integrate the emulator in a webpage such as there?
yes I am working on it. Unfortunately the browser security (aka "CORS") does not allow to load a .prg from an external website, so you can't have the emulator and the file on different servers. Currently you either have to embed the whole emulator on your site or put the .prg file on the emulator's server. But perhaps there is a workaround, I have to investigate more.

Regarding Cavern Explorer, I'll use it as a benchmark for fixing the current 6561 emulation, the source code is very handy, thanks! BTW, I tested it on my MiST FPGA and it runs perfectly.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: vic20-emu (another emulator)

Post by orion70 »

I find the "single chip emulation regardless of the machine" construct particularly interesting, and possibly very educational, even with its evident flaws. For what I am aware of, it's the first time that this approach is used the emulate stuff. Respect.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

DarwinNE wrote: Mon Jul 20, 2020 9:23 am Is there a way to integrate the emulator in a webpage such as there?
I've added new querystring options:
- config=n sets memory configuration
- joy=1 emulates joystick
- load=loads a program (stored on the same website)

e.g. for alien invasion:

https://nippur72.github.io/vic20-emu/?c ... vasion.prg
DarwinNE
Vic 20 Devotee
Posts: 231
Joined: Tue Sep 04, 2018 2:40 am
Website: http://davbucci.chez-alice.fr
Location: Grenoble - France

Re: vic20-emu (another emulator)

Post by DarwinNE »

I love it!!!

I added a link on my blog:

http://davbucci.chez-alice.fr/index.php ... ieninv.inc

Probably the best would be that a copy of the emulator and the game would be stored on my website, too, but if you think the link you gave is a permanent one, this is a perfect solution, too.

Is there a project webpage I can link to for giving appropriate credit to the emulator?
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

yes the link is going to be permanent, but I would like to give also the possibility of self-hosting the emulator. The problem is that if the emu is embedded, then it doesn't get updated when a new release comes out. I have to think better what's the best hosting model with the current web technology.

BTW, here's the link to the project: https://github.com/nippur72/vic20-emu, anyway most credits should go to Andre Weissflog who wrote all the chip emulation (amazing work indeed).

I investigated a bit why Cavern Explorer doesn't work properly, I think the issue is in the emulated 6522: when the game is over the IRQ doesn't trigger and the HORIZONTAL_OFFSET stays at #63 instead of being restored to the normal value. Unfortunately the VIA chip is quite difficult to fix, even VICE hasn't it right.
DarwinNE
Vic 20 Devotee
Posts: 231
Joined: Tue Sep 04, 2018 2:40 am
Website: http://davbucci.chez-alice.fr
Location: Grenoble - France

Re: vic20-emu (another emulator)

Post by DarwinNE »

nippur72 wrote: Wed Jul 22, 2020 3:02 pmI investigated a bit why Cavern Explorer doesn't work properly, I think the issue is in the emulated 6522: when the game is over the IRQ doesn't trigger and the HORIZONTAL_OFFSET stays at #63 instead of being restored to the normal value. Unfortunately the VIA chip is quite difficult to fix, even VICE hasn't it right.
I see what you mean, I need to "switch off" the screen once the raster passed a certain point, so that the image is cropped to what I want to show. This is important for the vertical scroll and can not be done in the top border, unfortunately.

Probably in such a situation, you can try opening a issue in the original project, it seems to be very active and they will probably appreciate a feedback.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

I already opened issues/pull requests on the "chips" repo, but the author (Andre Weissflog) said he's currently busy, but he will that check eventually. I hope he'll also fix the tape for loading .tap files, and complete the 1541 implementation.

BTW, I tried to run the VIA tests that are available for the VICE, and as expected many of them fail... but surprisingly some will also fail in VICE.

I've also added the ability to load cartdrige images at $A000 and the emulator now automatically configures itself when you drop a .prg file on the emulator window.
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: vic20-emu (another emulator)

Post by chysn »

My brother expressed a desire to play Blue Meanies from Outer Space. He has no VIC-20, so my first thought was to set him up with this emulator.

The file I found for him is here: https://www.myabandonware.com/game/blue ... -space-74c

The .prg file here works fine on my real VIC-20, and VICE, but errors with ?UNDEF'D STATEMENT ERROR IN 10 when dragged into this emulator. The BASIC program is messed up after a few lines.
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
AndyH
Vic 20 Afficionado
Posts: 364
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: vic20-emu (another emulator)

Post by AndyH »

Works in the older versions of Vice, but the latest crashes out with the same error for me.
--
AndyH
HEWCO | Vic 20 blog
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Re: vic20-emu (another emulator)

Post by orion70 »

Have you tried with LOAD"",8 (without the subsequent ",1")?
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Re: vic20-emu (another emulator)

Post by nippur72 »

I think I've identified the issue: the basic lines in the .prg file are "linked" as if the base address is $1200 and not $1000 as in the normal unexpanded VIC.

The VICE emulator loads .prg files by emulating a disk drive, so (I guess) the basic line links are rebuilt after the LOAD finishes.

In my emulator I instead just copy the .prg in memory without rebuilding such links -- so the first line is OK but the second one points somewhere in $1200 area.

Does anybody know if there is a system routine I can call for rebuilding links?
Post Reply