Javascript Vic-20 emulator updated (completely rewritten)...

You need an actual VIC.

Moderator: Moderators

Post Reply
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Javascript Vic-20 emulator updated (completely rewritten)...

Post by matsondawson »

Following features added.

* Rewritten to support Firefox!
* Joystick and 2nd VIA implemented.
* New games.
* Auto frame skip.
* Memory expansion options.

It's been tough though, Firefox Javascript is damn slow, so I had to write a Just In Time compiler to convert the 6502 to Javascript and optimise it rather than just interpret it.

Chrome and Safari are still the best at speed.

http://www.mdawson.net/vic20beta/vic20.php
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Damned impressive!
I get 132% speed with Chrome and 42% with Firefox 3.5.
I can type BASIC without it dropping keystrokes! Very nice.
Is it possible to "fix" the aspect ratio?

This should definitely replace the animated GIF on the Denial front page!

Steve

[EDIT] Just had a browse of cpu.js. Incredible stuff.
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

What's wrong with the aspect ratio?

The pixels are 2:1 atm, is it meant to be something else?
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Yeah, should be around 1.6:1.
I don't have a link for reference, but if you search the forums you should come up with some threads discussing it.
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

Post by rhurst »

Very cool! 8) I am getting up to 302% emulation speed (typical 273%) using Firefox 3.5.3 on my workstation.
Do you allow this project to be used in other web-sites?
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

have updated cpu.js to handle dynamic code better.

Previously if code changed I recompiled the whole lot, now if you are just changing an immediate on a instruction I recompile the code to use the dynamic memory location as its immediate instead of a constant.
This means that Alien Blitz runs a heck of a lot faster (it's self modifying code central).
Also basic interperator runs faster as it has dynamic code for parsing code.

re: emulator on other websites. I don't really want to do that yet. Maybe later. I have bigger plans for it, so don't really want the competition!

re: aspect ratio, I'm percolating on it. It would require a little fancy coding to do the scaling which may be slower as the browser won't handle that for me.
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

rhurst wrote:Very cool! 8) I am getting up to 302% emulation speed (typical 273%) using Firefox 3.5.3 on my workstation.
Do you allow this project to be used in other web-sites?
Your workstation kicks ass btw :twisted:
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

Post by rhurst »

re: emulator on other websites. I don't really want to do that yet. Maybe later. I have bigger plans for it, so don't really want the competition!
That's cool, thanks for letting us check it out though. It looks and runs great, so it certainly is a tease!
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

Aspect ratio now changed to 1.6.
There may be a small performance drop.

You may also need to shift+refresh to get the new display.js to load.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Aah, looks much better...
The framerate is about 50% what it was in Firefox (now ~50%) and about 67% what it was in Chrome (now ~200%). I think it's worth it though!
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

More changes:
* Added real speed counter, as the emulation speed counter doesn't take into account system/browser events causing things to be slow.
* Added some optimisation around screen redraw, probably good for another 30% speed.
* Fixed a bug, that I don't understand around frame rate :) For some reason the emulator was running at double speed. So I doubled the wait periods to make it run normally, but it has me stumped atm.

Don't forget shift+refresh again, for .js scripts to update as your browser may cache them.
Post Reply