NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Currently Being Moderated

A Commodore 64 emulator written in LabVIEW

Posted by Christian_G on Oct 20, 2009 7:24:20 AM

I wanted to share my C64 emulator I created in LabVIEW.

 

Why is somebody doing this?

That’s easy! For years I was wondering if it is complicated to emulate a processor or a whole computer platform.

So played around with the C64 roms I found on the web and a state machine in LabVIEW...

 

My goal was to make the C64 boot the Kernel and Rom so that I can write a little basic program like:

 

10 PRINT “HALLO”

20 GOTO 10

C64_FoorLoop.jpg

It took me a couple of weeks to get that far. I found many helpful resources on the web and got a copy of the Commodore 64 programmer’s reference manual from a friend (thanks Tapio!).

I got a few games working on the emulation, for example Lode Runner, Centipede etc.

 

C64_Game.jpg

 

This example code shows how an emulator can be written in LabVIEW, although is not a complete C64 emulator.

 

Overview

This program emulates most parts of the famous Commodore 64 home computer.

You can use the build in BASIC and some program files (PRG), for example games

- 6510 CPU with almost all OpCodes

- VIC with almost all Screen modes, sprites, collision detection and IRQs

- Keyboard and Joystick input

 

These parts of the C64 are not yet implemented:

VIC: Extended background color mode, fine scrolling

CIA: Timers, Serial port

SID: The is so far no sound at all!

Floppy and Datasette are not implemented.

 

I attached the emulator. Download and unzip it, look for original C64 ROMs on the web and place them in the folder named ROMs.

They must be named: kernal.rom, basic.rom, char.rom

 

Run the MAIN VI and have fun!

 

Christian

Attachments:


Oct 20, 2009 7:35 AM gene7135 gene7135    says:

My first computer was a C64... this is awesome!

 

This sounds way cool!

Oct 20, 2009 7:50 AM Jakub Czaplicki Jakub Czaplicki    says:

wow. great stuff !

Oct 20, 2009 8:24 AM Thoric Thoric    says:

Very impressive! Well done to you for putting such an idea into practice - it would never have occured to me that this was possible in LabVIEW!

I like it very much

Oct 20, 2009 8:51 AM Rick Kuhlman Rick Kuhlman    says:

Genius!!!!..... This is an amazing feet. Thanks for contributing in such a big way to this group.

Oct 22, 2009 11:57 AM Bill_in_Detroit Bill_in_Detroit    says:

Cool.  Now I can throw out or give away the two Commodore 64 computers I have.  I look forward to trying out the code when I am away from my work place.  Have you considered building one that would emulate a Sinclair ZX-80?

Oct 22, 2009 1:06 PM Christian_G Christian_G    says in response to Bill_in_Detroit:

Thanks! But you better keep your C64! Tis emulator is not really finished ;-)

A very good emulator can be found here, unfortunately not in LV:  http://www.viceteam.org/

What processor does a ZX-80 use? I guess a Z80? Is that similar to the 6510 of the C64?

The Processor was a lot of work - it is a case structure with 256 cases...

The graphic is also complicated becuase of the many different modes which can be changed on every line etc.

I think I'll finish the graphics of the C64 first...;-)

Oct 26, 2009 6:32 AM Bill_in_Detroit Bill_in_Detroit    says in response to Christian_G:

The ZX-80 uses the Zilog Z80, an 8 bit processor and not at all like the 6502 based processor used in the C64.

But nostalgia aside (and the C64 definitely brings up memories for me), I look forward to seeing where you take the project.  I have said for years that LabVIEW is the most versatile programming environment that still retains the ability to be used by a single person for major projects and what you are doing is a perfect example of that.  Keep up the good work!

Oct 29, 2009 11:33 AM KBersch KBersch    says:

What version of LabVIEW is this written in?  I'm stuck at 8.6 for now.

Oct 29, 2009 11:40 AM Jakub Czaplicki Jakub Czaplicki    says in response to KBersch:

You say, you "stuck at 8.6" ? I still use 7.1.1 and I know people who use version 6.

Oct 29, 2009 11:42 AM Christian_G Christian_G    says in response to KBersch:

The C64 emulator was written in LV 8.6.1

Oct 29, 2009 11:52 AM Bill_in_Detroit Bill_in_Detroit    says in response to Christian_G:

Christian:

When you say "...original C64 ROMs..." do you mean ROMs for the original C64 as opposed to the SX64 or other variations on the theme, or do you mean only the ROMs from the first generation C64? (I think there were like 3 generations of ROMs over the life of the original C64)

Oct 29, 2009 11:56 AM KBersch KBersch    says in response to Jakub Czaplicki:

That's why I asked what version it was writte in.  I actually have 8.6.1 but it occured to me that some one with an older version might try to open this and get frustrated.

 

This looks like a great project.  As soon as I can I'm going to see what I can do with it.  Ah, the memories of my first computer!

Nov 3, 2009 10:30 AM RTSLVU RTSLVU    says in response to Jakub Czaplicki:

That's nothing my company's ATE system is still using LV 5.11 and our production test department is still developing with it.           

 

Worst part is, I am often called on to support it.