2 years ago 1 year ago Games Share

Commodore 64 JavaScript Emulator

I found this Commodore 64 JavaScript Emulator, written by Thomas Hochgoetz, at c64emulator.111mb.de. I've installed it here so I could experiment with getting it to work online — and demonstrate some of the games and other software I wrote back in the days when a Commodore 64 was affordable, and a "PC" was not.

The easiest way to play a game is to load one of the pre-saved snapshots of the vintage Commodore 64 games I wrote, from the SNAPSHOTS drop-down menu below the main emulator screen.

Currently there's two games, plus a morse code practice program, that you can play from the SNAPSHOTS menu. You can also load any other of the standard Commodore 64 file formats (e.g. the .D64 file type which is a Commodore 64 floppy disk image file) by dragging them into the DROP FILE panel.

NOTE THAT ON PHONES and other touch-screen devices, to scroll the screen when the emulator is in the middle, you have to touch the white borders outside the emulator window itself

More information is given further down this page underneath the simulator window itself...

You will probably have to turn on the sound by clicking on the "Sound" button.


Configuration








 
               

Drop File

S64, D64, G64, X64, ZIP, PRG, P00, T64, TAP, CRT

Snapshots

This file type doesn't support auto Joystick port detection. Please choose 'Joystick Swap Ports' if needed.


More Details About the Snapshots

Conqueror

The best game is Conqueror, the first one on the list of snapshots. Meaning best in terms of graphics, time and effort it took me to make it, and overall complexity. I wrote most of it in a version of the language Pascal called "G-Pascal" a very long time ago, beginning at age 12 or 13, and finishing not long after I turned 14.

I also wrote an earlier (and much less fully-developed) version of Conqueror in BASIC on a VIC-20. I had the VIC before the Commodore 64. Unfortunately, I no longer have the code of this version, which would have been stored on cassette, and not floppy disk.

I'll write more about G-Pascal on this website later on, and also about the nerd/coding side of game Conqueror itself, including the Pascal and 6502 Machine Language source code, and how it works internally, and how the graphics were made.

You can view the 1016 lines of Pascal source code of Conqueror here, and read more about the game.

Conqueror uses a short machine language program I wrote to scroll the screen, since Pascal was too slow for this. It's really "machine language", and not even assembly language – since I didn't have an assembler and had to convert all the 6502 opcodes to their actual numerical codes, (and then from hexadecimal to decimal), and enter them in to memory that way, and then save them to a separate disk file.

Here are some short instructions: Your spaceship can move up the sides of the screen also, and sit in the corners in a diagonal. Imagine the path your spaceship can move as like a very square-cornered letter "U" shape, where the "U" makes up three sides of the screen (everything except the top) and it will make more sense. Most of the time it's best to stay on the bottom of the screen.

Basically, everything that moves will kill you if it crashes into you or shoots you – except for the "bonuses" which appear occasionally, and float around very slowly. Crash into these to get lots of points. The longer your ship stays in contact with them, the more points you get. In the higher levels the bonuses are worth a lot more points, and you can get a crazy high score this way with some practice. I think you get an extra life every 10000 points (like the game Defender which was my favourite "real arcade" video game of that era).

When I get around to it, I'll add some more detailed instructions about how to play Conqueror on this website also.

HOW TO PLAY IT: If the joystick option is turned "on" (I think it will turn on automatically), you can play Conqueror with the arrow keys, and the space bar is the fire button. On a phone or a tablet, without a keyboard, it's still sort-of playable using the buttons which appear on the screen and/or the ones below the emulator window.

Once the program is running in the emulator, press "fire" or "space" to start the game. You might have to press it a few times. Make sure the sound is turned on if you want to hear the early-80s-quality sound effects.

Fast Draw

The other game, "Fast Draw", is a Poker Machine game which you can also play on Codewiz but in a different Commodore 64 emulator here. More detailed instructions for how to play Fast Draw are on that page also. The version on the current page that you're reading now is (probably) somewhat more random (in a good way) with respect to the "cheat" bug in the other version, as discussed on that page.

IMPORTANT SAFETY WARNING: I was much younger when I wrote Fast Draw, and it was really only ever meant to be played by myself and friends. When you lose at the double-ups, the game will give you random insults. Some of them might seem a bit harsh.

NOTE: The popup keyboard which this emulator is supposed to have does not seem to work currently. This means that I don't think you type anything if you're using a device like a phone with no actual keyboard. To get around this, until I can fix it properly, this page has a "Spartan" version of the emulator where the popup keyboard does work. If you want to play Fast Draw in particular (since it needs the keyboard) on a phone, this is probably the only way you can do it currently.

If you want to play the Fast Draw Poker Machine game on a phone or tablet, I've added some virtual buttons just for Fast Draw below the main emulator screen. (To play fast draw, you only need the keys C and D, and the number keys from 1 to 5, and R and B and T, I hope that's all, lol). The game is playable though a bit hard to see (because the cards are small) on my phone. I can turn the screen sideways, and see just enough of the game to play it (that is, only the cards themselves and the virtual keys to press). You can change between horizontal and vertical views in the middle of a game, and the emulator seems okay with that.

INTERESTING TRIVIA: While Conqueror took many months to write (and even longer than that in the "embryo" phase when I was thinking about what the different aliens would be, and look like, and do), Fast Draw was written over a few days. The band that I played guitar in had our first gig (a 21st party I think, I'll have to ask who I think it was if that's correct now) and I was nervous. So I spent the entire several days leading up to the gig writing a game on the Commodore 64, to distract myself from the stage nerves of my impending performance.

Morse Code Practice

There's also a Snapshot of a short program to help me learn Morse Code. (Which I also wrote years ago, like all the Commodore 64 ones here). First you enter the speed in words per minute (I had to learn it to 5 wpm for an exam.) Then select how many lines of text you want to write (from memory, the Commodore 64 had a limitation of only 80 characters per line which is why it does that). Then type in some text, and it will play it back in morse. Make sure the sound is turned on. The program adds random "static" and other distortions added to the sound, to make it more like listening to a real radio station far away in bad reception conditions. It was only ever written to be used by myself so it's not the most fancy user interface.

Sometimes the sound keeps playing after the Morse Code Practice program finishes. This is a bug that I never fixed. Though I might get around to fixing it sometime, now that the program is on the internet. To stop the sound you can turn it off with the button above the emulator, or just type "run" and press enter and then type in a number of words per minute and the sound will stop then.

Web Assembly

This Commodore 64 Emulator runs in JavaScript on your web browser, and also uses a language called Web Assembly, which I'm only just learning about. The use of Web Assembly language makes the emulator run much faster than standard JavaScript. You can notice the difference in speed as compared to playing Fast Draw in the other Commodore 64 Emulator here, which is pure JavaScript only and no Web Assembly.

I'll write (and learn) much more about Web Assembly on this website in the future. Web Assembly Language also has huge implications for Cyber Security. This is because it's a way to run assembly (i.e. "machine") code on your client machine, based on something that can auto-run from any random website you happen to browse. If you think about it, this opens up a massive Pandora's Box of potential security vulnerabilities which a hacker can exploit – by hiding malicious code within the Web Assembly module(s) on any website you might happen to visit.

I'm actually pretty happy that the use of Assembly Language seems to be making a comeback (in the form of Web Assembly), since I spent so much time learning it many years ago – and then it was superceded for nearly all commercial use by the time I was old enough to enter the workforce.

I had learned Assembly Language to the level that my high-school computer science teacher got me to teach all the classes I was in (i.e. to my own class) covering Assembly Language, since I understood and could explain it better than anyone else in my high school (both students and teachers) at that time.

Credits and Info from the Makers of the Emulator

Special thanks to:

  • "Schütti" - for the corporate conversion work to JavaScript
  • Emscripten and LLVM - link to the site

License:

  • The C64 JavaScript Emulator is free for non-commercial use only.

Minimum Requirements:

  • 2 GHz CPU and an up-to-date browser - see here for browser and sound support.

Play with the C64 Joystick which is emulated by the following:

  • Keyboard 1: Cursor Keys and Left Ctrl Key
  • Keyboard 2: W/S/A/D and Left Shift key
  • Touch Screen: 4 directions/corners and the middle position
  • Gamepad/Joystick: 1 or 2 Gamepads support + Paddles (axes 3/4)

Codewiz.au Homepage - Australian Cyber Security Web Magazine

Share This Page

If you liked this page, please share it with others! You can use the links to share on Facebook, Twitter, LinkedIn, Pinterest, and Email. Ther is also an RSS feed to get updates for the website.