My Commodore VIC20 emulator with twists

You need an actual VIC.

Moderator: Moderators

User avatar
lgb
Vic 20 Drifter
Posts: 25
Joined: Tue Apr 26, 2016 8:10 am
Website: http://lgb.hu/
Location: Hungary
Occupation: System engineer

My Commodore VIC20 emulator with twists

Postby lgb » Wed May 25, 2016 10:37 am

It seems I like to write unfinished and inaccurate emulators :) Maybe someone is interested anyway. Don't let the project name confuse you :-)

https://github.com/lgblgblgb/xclcd

The emulation is not so much accurate, no need to mention. The CPU is 65C02, which for sure is incorrect for a VIC20, but I already had my own emulation for that CPU because of Commodore LCD computer, that's why I use that. VIC-I emulation is done by scanlines, which is also not so correct, I guess, but it's better than the initial version when I did a full frame in once :) Sound is - "of course" - not emulated, also no tape/serial IEC, etc (but you can give a .prg) file as a parameter. Keypad arrows is the joystick, but in theory, USB joys/gamepad controllers should work as well (however a fixed single axis is used, which may not be mapped to a sane way by default ...), well it worked with an XBox 360 controller on Linux for me at least.

The project also includes a more-or-less working Commodore LCD and a Commodore 65 emulator (with also emulating the 65CE02 extra opcodes and other changes over 65C02), by the way, but it's kinda off-topic here, I think :)

Thanks to Pixel, he already had some suggestions and some help eg about the kernal/BASIC entries for the .prg loading stuff, and maybe other topics as well :)

Here it is a binary build (.win32 files are .exe) built by me (with mingw cross-compilation from Linux), but since I have/had *no* Windows at all, I can't test them too much ....

http://c65.lgb.hu/dist.zip

Thanks for you patience :)

User avatar
Mike
Herr VC
Posts: 3111
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: My Commodore VIC20 emulator with twists

Postby Mike » Wed May 25, 2016 3:11 pm

Your emulator runs 'vector.prg' (see attached) successfully with the commandline xvic20.win32 @8 @16 @24 vector.prg, so it can't be too far off. ;)

Nicely done!
Attachments
vector.zip
(10.05 KiB) Downloaded 20 times

User avatar
lgb
Vic 20 Drifter
Posts: 25
Joined: Tue Apr 26, 2016 8:10 am
Website: http://lgb.hu/
Location: Hungary
Occupation: System engineer

Re: My Commodore VIC20 emulator with twists

Postby lgb » Wed May 25, 2016 3:46 pm

Mike wrote:Your emulator runs 'vector.prg' (see attached) successfully with the commandline xvic20.win32 @8 @16 @24 vector.prg, so it can't be too far off. ;)

Nicely done!


Thanks. Honestly, I don't know if my emulator makes any sense, as there are much more accurate emulators for the VIC-20, even with sound :) and tape / 1541/etc emulation. For example VICE is good enough for me. It was just a few hours hack over my existing code fragments developed for the Commodore LCD emulator. The major headache was the VIC-I, initially I did some primitive approach (ie emulate an x*y screen with one frame rendering) but as it turned out it's better to think about VIC-I as it really works, ie linear addressing of 16K memory space using 12 bits data bus and its building of the frame, it just mater of the VIC-20 application of the VIC-I that how that is mapped to memory components in the VIC-20. So now it's even possible in theory to simulate situations eg with more than 1K of colour SRAM, or allow VIC-I to access the memory expansions regions as well (which is not so much possible with external expansion at least with a real VIC-20, if I understand the situation properly now). It needs just adjusting 2*16 pointers in the code. The limitation factor (from the viewpoint of accuracy) can be the fact that I render one scanline at once still after 71 CPU cycles elapsed (if I remember correctly now).

One sense - probably - of my emulator can be the fact, that it's a pure SDL2 app and not so much resource hungry, so it's quite easy to run on low-end machines, eg Raspberry Pi (I haven't tested that yet, though my much more complicated Enterprise-128 emulator used about 70% of CPU of Raspberry Pi model 1, so I would expect that this VIC-20 emulator would cause even lighter CPU load). Though VICE seems to support SDL builds, it never worked for me (I tried only SDL2, it just gives me some odd patterns and that's all, tried some weeks ago at last time with SVN version of VICE).

User avatar
darkatx
Vic 20 Afficionado
Posts: 440
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Re: My Commodore VIC20 emulator with twists

Postby darkatx » Wed May 25, 2016 4:02 pm

Holy crap thats pretty sweet - nice stuff man! :)

EDIT - played Qbert pretty nice too.. :)
Learning all the time... :)

User avatar
lgb
Vic 20 Drifter
Posts: 25
Joined: Tue Apr 26, 2016 8:10 am
Website: http://lgb.hu/
Location: Hungary
Occupation: System engineer

Re: My Commodore VIC20 emulator with twists

Postby lgb » Wed May 25, 2016 5:46 pm

darkatx wrote:Holy crap thats pretty sweet - nice stuff man! :)

EDIT - played Qbert pretty nice too.. :)


Nice to hear :) As I am new for VIC20, and just write an emulator to get to know it better, I am kinda bad to know VIC20 softwares, so no idea about Qbert - but it's a global tendency of mine, that I never play/played with computer games :) But I've checked it out now.

Btw, Pulse was a great testing material :) as its "shaking intro screen" made some work for me to fix things :)

User avatar
lgb
Vic 20 Drifter
Posts: 25
Joined: Tue Apr 26, 2016 8:10 am
Website: http://lgb.hu/
Location: Hungary
Occupation: System engineer

Re: My Commodore VIC20 emulator with twists

Postby lgb » Fri May 27, 2016 1:09 pm

By the way, have anybody here some kind of VIC20 program on a tape but in digitalized form? :) I mean WAV (!!) actually (not TAP file). Unfortunately I have no tape at all, but it would be interesting to see if I can "feed" my emulator somehow with the actual data recorded from playing a tape which could be used for a real VIC-20. Then it's maybe even possible to do it real-time later, ie grabbing from the sound card with a cassette player attached, as it would be a real VIC-20 with a Datasette. It would be interesting project with a Raspberry Pi, used like a real VIC-20 (though it doesn't have sound input ... however some cheap USB "sound card" is probably OK, the other possibility, is to connect a real Datasette onto the GPIO pins, but I doubt it would work, as the emulator sleep after every frame, ie running on the top of a multitasking operating system, namely Linux).


Return to “Emulation and Cross Development”

Who is online

Users browsing this forum: No registered users and 1 guest