Shop OBEX P1 Docs P2 Docs Learn Events
Commodore 64 Emulator — Parallax Forums

Commodore 64 Emulator

GoogGoog Posts: 65
edited 2011-06-03 00:46 in Propeller 1
It just has to be done... I am working on a Commodore 64 emulator using the Propeller.· I had been writing it in .NET for the PC, but that venture wasn't working out - .NET just isn't fast enough.· The moment I saw the first Propeller article in Nuts and Volts, I knew this would be the perfect platform for an emulator.· So that is why I bought the demo board and I have already started emulating.

Is anyone interested in joining me on this? I will need some help in the sound emulation and possibly the video - perhaps at its lowest-level programming, since I have no experience with video and sound electronics and/or theory.

I've gotten a large chunk of the Commodore's processor (the 6510) emulated and have already started porting over the top-level engine that will end up putting it all together.

The C64 runs at 2MHz, first driving a chip called the VIC-II, which then splits the 2MHz signal in half, which drives the 6510 at 1MHz.· It seems like the Propeller would be perfect to "multi-process" this using 2 or more COGs.· Of course, there are other chips and functions, which will all need to be emulated.

Thoughts? Comments? Does anyone know and love the C64 as much as I do? Thanks for looking.

Goog

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Doing my part to keep the Commodore 64 alive!

http://www.commodorestuff.com
·
«134567

Comments

  • JavalinJavalin Posts: 892
    edited 2006-06-14 11:02
    Coog,

    I'd suggest that the large number of friendly & helpful people on this forum would be willing the to assist. Perhaps the best way is for you to continue; post any specific questions here and I'm sure somebody will be able to help!

    The C64 was cool - I allways got frustrated with the slow & unreliable load-from-tape so as long as you don't emulate that im sure it will be cool!

    Rokicki has done a Tandy computer emulator - might be worth checking it out. http://forums.parallax.com/forums/default.aspx?f=25&m=126292&p=1&ord=d

    James
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-06-14 16:38
    Load $,8,1 !

    I would be interested to see this carried out.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-06-14 17:06
    Go ahead on.·

    SYS 49152

    It's a 1541-Disk emulator that I'd really, really, really...
  • GoogGoog Posts: 65
    edited 2006-06-14 17:42
    PJ Allen said...

    Go ahead on.·

    SYS 49152


    It's a 1541-Disk emulator that I'd really, really, really...
    ...like to emulate for me? [noparse]:)[/noparse]
    I met someone who was going to develop a hardware device that plugs into the C64's I/O chip socket (that's right - the socket) which would control the serial port and emulate the 1541 on-chip.· Pretty wild - I don't know what his progress is, but I might find out in July at the Las Vegas Commvex (Commodore Expo).· I hope to have my "Prop64" developed by then.
    So here is my first challenge: Memory.· I'm thinking of attaching an EEPROM to my dev. board to handle the C64 ROMs and RAM area.· Since the C64 needs 64K to work with, it would be ideal to just manage that memory in another chip.· Any suggestions on what chip to get? Perhaps a serial EEPROM that a COG could communicate with?

    I'll be posting my first code soon... hang in there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-14 18:41
    Coog,

    EEPROM - thats easy! Get another of the 24L256 type 32k EEPROM's that the Propeller uses as its program storage. Download my i2cObject from the object library and walla.

    If you want bigger (Multi-Media Card) type storage wait a few weeks and i'll be publishing it.

    You could easily write an object to make a virtual block of 32K ram using an EEPROM. Using multiple (up to 8) you could extend this to 256K! You wouldn't be able to use it for your Propeller App but your interpreter could be written to make use of it....

    James
  • GoogGoog Posts: 65
    edited 2006-06-14 23:29
    Ideally, it would be great to have a contiguous 64K block of memory that I could just access with my BUS object - it would simply do reads and writes from/to the memory, making simple calls like:

    bytValue := objBus.ReadByte(Address)
    objBus.WriteByte(Address, Value)

    The Bus object would basically propogate that to another object that reads and writes from/to the external memory chip/card.· It could be anything from an attached USB device (with an SD card, for example) or even an EEPROM on the circuit board (or breadboard).

    This is something I'd like help with, if anyone is willing to spell it out for me.· I do have a 32MB TransFlash card (with an SD adaptor)·that would be nice to use - is that something easily doable? Can the demo board utilize its built-in USB port to do these reads and writes? Any other ideas?

    I'm almost ready to publish my first code - but the memory limits are stopping me from testing it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-15 00:35
    The problem with EEPROM is its limited write capability. You can only write to one location 100,000 times or so before it doesn't work and the EEPROM chip takes a couple of milliseconds to do a write. Better to use a Ramtron (<http://www.ramtron.com>) serial ferroelectric memory. It has essentially unlimited writes and the time to write is the same as the time to read. They have an I2C version (25C256) and an SPI version (25L256) which is much faster. They're both 32KB x 8 bits and the I2C version has address select lines so you can have up to 8 on the same I2C "bus" with only 2 I/O pins.
  • Cliff L. BiffleCliff L. Biffle Posts: 206
    edited 2006-06-15 01:31
    Waaaaait. Ferroelectric?

    They put core on chips now?
  • JavalinJavalin Posts: 892
    edited 2006-06-15 12:51
    Goog,

    Cannot help with the SD card - dont have any code for this. In a week or so when I have completed and tested it - I will be posting a MultiMediaCard object that allows you to use a 1GB card (currently testing with a 256MB card!)

    This isn't ideal for RAM emulation - the RAMTRON link from Mike looks then best option. I'd be happy to try to help with this - baring in mind I would'nt have a ramtron chip to play with. (the all seem to be surface mount....)

    James
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-15 13:58
    The Ramtron chips are not quite like core or even thin film memory. They're more like conventional EEPROM, but they use a ferroelectric capacitor rather than burying charge in a layer of silicon dioxide. They do only come in SOIC packages, but there are little mounting convertors you can buy that make them work like 8-pin DIPs for breadboard use.
  • IbsenIbsen Posts: 68
    edited 2006-06-15 14:27
    It would be cool if the Commodore 64 emulator could load in old games/programs from tape and save them on a EEPROM module.
    Then you could build a library of games and programs and just change the module like the GameBoy etc.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    *.*

    Ibsen

    " It's nice to be important, but
    ·· more important to be nice... "
  • GoogGoog Posts: 65
    edited 2006-06-15 16:36
    Mike/James:
    I'm actually fine with a less-superior RAM emulation at this point, just so I can test things.· I need to be able to read and write from memory - even if the performance isn't perfect.· Then, when I get things stable in the emulator, I can find the best solution.
    ·
    The Ramtron looks good - I'll see if I can find an adaptor for their surface mount chips.· Also, working with the multimedia card will be fine as long as I can get the accompanying hardware to plug it into my breadboard.· What are you using to hook it up, James? Maybe post a photo?
    Ibsen said...
    It would be cool if the Commodore 64 emulator could load in old games/programs from tape and save them on a EEPROM module.
    Then you could build a library of games and programs and just change the module like the GameBoy etc.
    Yes, I plan on having the ability to have some sort of media, such as an SD card, with pre-loaded .d64 files (these files are single-file equivalents of disks on the 1541).· Or even just using an EEPROM, loaded up with whatever you want.· The emulator would be able to display a list of files available and then you could load the file you want.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 16:47
    Coog,

    OK leave the ram bit with me I'll get a couple of EEPROM's hooked up and get a large RAM object underway! This should be easily adaptable to use the Ramtron bits

    The MMC card is connected using a reduced size manual connector - such as http://uk.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=8755574&N=401

    I'd expect (work commitments etc not withstanding..) to have a RAM object mid next week.

    James
  • GoogGoog Posts: 65
    edited 2006-06-15 17:55
    Javalin said...
    Coog,

    OK leave the ram bit with me I'll get a couple of EEPROM's hooked up and get a large RAM object underway! This should be easily adaptable to use the Ramtron bits

    so do you mean you'll use Ramtron chips? What do you mean when you say get a couple of EEPROMs hooked up?


    The MMC card is connected using a reduced size manual connector - such as http://uk.farnell.com/jsp/endecaSearch/partDetail.jsp?SKU=8755574&N=401

    Thanks, I think I'll get some parts for the different cards, such as this one... that way, I'll have them ready if I ever need them.

    I'd expect (work commitments etc not withstanding..) to have a RAM object mid next week.

    Just keep this as simple as possible - I have a "Bus" object / memory manager that handles all of the Bus reads/writes.· I would imagine it would implement your RAM object to do the reads/writes to whatever connected memory device there is - that way, we can switch the hardware with ease.· I would prefer something like:

    (from my Bus object)...
    
    OBJ
      objRAM : "RAM"
    .
    .
    .
    
    PUB Start
      objRAM.Start(64)                 'Allocate 64K of addressable memory
      objRAM.Move(@Kernal, $E000)      'Need some way to pre-load the memory with ROM data
                                       'to a specific address. In this case, I can load an array
                                       'of data (Kernal) and then store it at address $E000
                                       'in the RAM object.
    
    PUB Whatever...
      objRAM.Write ($C000, $AF)        'Write a byte to external RAM object
      bytValue = objRAM.Read($E000)    'Read a byte from external RAM object
    
    
    



    James

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 18:02
    No, from your previous post I thought you wanted to "get it working" with EEPROM's first?
  • GoogGoog Posts: 65
    edited 2006-06-15 18:25
    That would be fine, but my concern would be what Mike suggested about the limited # of writes - 100,000 writes wouldn't take long if I were addressing it (writing to it) like RAM in the emulator.

    Now, I could probably store the·two 8K ROMs in the EEPROM without writing to them, but that still leaves ~48K of memory that will need to be written to frequently.

    I'm more than happy to try the MM card (or SD or whatever).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 18:31
    Yeah but there is a 1m write limit on the MM cards. So better than the EEPROM's but not as good as the RAM.

    If the RAM behaves like a normal i2c EEPROM an object written for the EEPROM would work on the RAM

    James
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-06-15 18:52
    FYI... the I2C EEPROMS we use for the propeller and stamps operat faster then the C64 rev A, B & C's (Most common), AND the C128.
    The issue here is not the memory, but rather how the 6510 addressed it.
    The 6510 emulator will need to talke into account the addressing modes, how to derive a valid physical address, and retrieve (or set) that byte of data.
    Notes on C64 Drives:
    http://en.wikipedia.org/wiki/Commodore_64_peripherals
    As soon as I can, I'll find the protocall specs and post them... the overall scheam is like SPI... somewhat, but different..
    ANd here's an example of using a C64 printer...
    http://www.textfiles.com/computers/c64topc.txt
    (Which, you can see, how to hookup the drive... the c64 drives are smart, ie they have the OS on board.., and how the protocall works!)
    Lastly, here's a link to the pin outs of the c64 serial port...
    http://www.technick.net/public/code/cp_dpage.php?aiocp_dp=pinconser_c64_c16_c116_p4


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-15 18:55
    The Ramtron devices are intended as "drop-in" replacements for standard EEPROMs. They have a variety of application notes on their website that discuss how to optimize access to them with I2C given than they read and write faster than the I2C controller can pass them data.
  • GoogGoog Posts: 65
    edited 2006-06-15 18:57
    I think we're stuck unless we go with the Ramtron chips or something like them... even still, I would prefer not to do this so that anyone with a development board could run the emulator without buying extra hardware.· Obviously, there isn't enough RAM on-board, and we can't write to SDs, MMCs, EEPROMs, or the like, without maxing out the # of erases/writes.

    How about this idea: We'll write a SPIN object to read/write to the USB interface that hooks up to the computer.· Someone could write a program that runs on the computer·to communicate via the USB port, providing virtually unlimited memory access.· This would allow anyone with a dev. board to run this without any extra hardware. (Any takers to write the PC driver and SPIN code [noparse][[/noparse]I have no USB experience]?).· It could also serve as a temporary way to load Commodore programs/disks from the computer's hard drive.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 18:58
    KK and Mike,

    Thanks - this is getting interesting - I'd love to be able to play some of the old games on a Propeller C64! (especially if I've worked on some of the code!!)

    KK - Look forward to reading the posted specs!

    James
  • JavalinJavalin Posts: 892
    edited 2006-06-15 18:59
    Goog,

    How about one using the USB2SER module and using 115k serial? I could do that in VB6 fairly easily.

    A simple object requesting a block of ram etc would work!

    james
  • Mike GreenMike Green Posts: 23,101
    edited 2006-06-15 19:03
    An SOIC-8 to DIP-8 adapter board is available from Jameco (<http://www.beldynsys.com/p510.htm>). They have other sizes as well.
  • GoogGoog Posts: 65
    edited 2006-06-15 19:09
    Kaos Kidd said...
    ...(Which, you can see, how to hookup the drive... the c64 drives are smart, ie they have the OS on board.., and how the protocall works!)
    Lastly, here's a link to the pin outs of the c64 serial port...
    http://www.technick.net/public/code/cp_dpage.php?aiocp_dp=pinconser_c64_c16_c116_p4
    Not sure if everyone understands this or not, but... I am not planning on using any C64 hardware - everything will be emulated internally in software.· There is no need to hook up a C64 disk drive or anything like that.· Of course, that might be cool, too, at a later time.

    My goal is to have a C64 computer (using the Propeller), placing it in an old PC laptop and interfacing it to the VGA LCD screen.· Old laptops are easy to acquire on ebay or at garage sales... the old hardware is ideal because 1) LCD screen, 2) Likely it will have 2 serial ports which can serve as the joystick inputs (DB9 connectors). 3) built-in keyboard.· I'll basically remove the guts and place the propeller circuit board inside, hooking up the wires to the devices I plan to use accordingly.
    Kaos Kidd said...
    The 6510 emulator will need to talke into account the addressing modes, how to derive a valid physical address, and retrieve (or set) that byte of data.
    I already have the 6510 emulator working and it·emulates the addressing·modes - I just need to do the memory reads and writes to something other than the on-board memory.
    Javalin said...
    Thanks - this is getting interesting - I'd love to be able to play some of the old games on a Propeller C64! (especially if I've worked on some of the code!!)

    KK - Look forward to reading the posted specs!
    Yeah, I can't wait - Of course, everyone who contributes code to this will get programming credits in my final version!

    -Goog

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-06-15 19:17
    This is the service manual for the C64...

    http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/c64/manual-html/front_page.html

    And this is the programmers Ref for the C64..

    http://www.devili.iki.fi/Computers/Commodore/C64/Programmers_Reference/page_i.html

    (See chapter 6 for the serial communications stuff)






    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Just tossing my two bits worth into the bit bucket


    KK


    Post Edited (Kaos Kidd) : 6/15/2006 7:22:33 PM GMT
  • GoogGoog Posts: 65
    edited 2006-06-15 19:20
    Javalin said...
    Goog,

    How about one using the USB2SER module and using 115k serial? I could do that in VB6 fairly easily.

    A simple object requesting a block of ram etc would work!

    james
    Not sure I follow... is the USB2SER module a PC program/driver that you can use for USB programming from VB?

    If you want to write this, be my guest! I have no USB programming experience and I'd rather not learn [noparse];)[/noparse]· The SPIN code would basically communicate over the USB port using the same methods outlined in a previous post of mine.· I will handle the emulation of it from the C64 bus.

    The VB program would handle the communication to the Propeller Dev. board.· It could also load .D64 images (I have some code in VB to do this already)! This would be sweet!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 19:23
    Nah - the USB2SER is a serial->USB adapter. Basically a glorified serial port.

    Im writing the app now. The app will provide 128k of RAM, which the Propeller will use the fullduplexserial and a "expandedRAM" object to deal with this nicely.

    so something like:

    xx = largeRAM.readByte(yyy)

    or

    largeRAM.writeByte(xxx)

    OK?

    James
  • GoogGoog Posts: 65
    edited 2006-06-15 19:34
    Awesome! Once this is done, I'll be able to do my final testing for the first round of C64 emulation.· Then I will post the code.

    Good work!

    Will you make the expandedRAM object be self-sufficient so that I only have to create that object in my Bus object to do the reads/writes?

    Also, make the VB program generic so other Propeller programmers could use it as an expanded ram without having to do anything other than run it (with some configuration settings on the form).· After that is done, I'll combine it with my code to read the .d64 files.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Doing my part to keep the Commodore 64 alive!

    http://www.commodorestuff.com
    ·
  • JavalinJavalin Posts: 892
    edited 2006-06-15 19:38
    OK. Its quite a bit of work - so i'll keep you posted. (couple of days maybe!)

    James
  • JavalinJavalin Posts: 892
    edited 2006-06-16 10:54
    Coog,

    Well it didn't take very long - this is version 1.0 however and it could be improved.· It currently only will read and write a byte (0-255) to the object - however it'd be easy to extend to allow for longs (32 bits)

    The PC app runs a 128000 array so should be enough.

    Attached is the PC program - you'll need to download the VB6 runtime from http://www.microsoft.com/downloads/details.aspx?FamilyId=7B9BA261-7A9C-43E7-9117-F673077FFB3C&displaylang=en·- probably too big to post here.

    Attached also is a propeller demo which implements the object and demo's a 255 byte read/write sequence outputted to LCD

    To wire it up - connect pins tx/rx to either the USB2SER or via a line driver (MAX232 etc) to a PC - set the VB app to run on the correct port and walla.

    Let me know how you get on!

    James

    Post Edited (Javalin) : 6/16/2006 11:03:40 AM GMT
Sign In or Register to comment.