xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Commodore Pi - A Commodore 64 OS for the Rpi

Sat Sep 14, 2013 1:45 am

Ok so Ive been working on porting the comeback64 (Commodore 64) emulator to a bare metal build for the Raspberry Pi. Its at a point where it can be shown now, although there is a lot still to do.

Here's a video of it in action:
http://www.youtube.com/watch?v=J733xQicrBg

Here is the release site: https://commodorepi.codeplex.com/ if you would like to try it out.

I can tell you right now that I take credit ONLY for parting this thing together. There are too many people to thank for their contributions to making this even come close to working.

Im hoping to complete this as a fully functional bare metal emulation of the C64. Nearly instant on, without a linux underpinning to slow down boot time. There is another project elsewhere to use the Rpi as an IEC controller for real Commodore hardware...it would be very interesting to bring that in with this.

Currently, it doesnt do much. The CSUD driver seems to be causing a crash when it is enabled (hit or miss), so I have disabled that code at the moment. Also, the VIC-II emulation is SLOW. I need to figure out how to double buffer in order to speed it up. Also, porting the comeback64 video emulation code to some routines provided by others on Git proved to be difficult. Frankly, its a small miracle that it works :)

Anyway, I definitely need help with this - its too close to being finished to let it die. If you have CBM emulation experience and would like to help, let me know.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5862
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sat Sep 14, 2013 2:40 am

Brilliant. Good job.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sat Sep 14, 2013 7:12 pm

Nice work, but a custom bare bones linux, can boot very fast
http://www.youtube.com/watch?v=4Fjfqz6FxC8

And your CSUD problem is probably the later bootloaders and the writing to
0x000f0000 and 0x00050070, which may be dew to the FIFO size ?.
Batteries not included, Some assembly required.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sun Sep 15, 2013 3:48 am

Wow, that is fast!

Can you provide any more detail around the CSUD problem? Ill tinker around some more and see if I can figure it out, but anything else you can detail would save me some time. Its ready to roll now if I can get the keyboard working and speed the code up a bit.

Also, I have a new build out there with the VIC colors fixed and the code cleaned up.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sun Sep 15, 2013 6:39 am

Also, I have created a simple project page located below:

http://www.commodorepi.co.nr/

martinax85
Posts: 5
Joined: Tue Aug 27, 2013 5:47 pm

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sun Sep 15, 2013 2:27 pm

I love this. I hope that it will finish, and that similiar "auto-booting emulator projects" will come to life, awesome :) !!!

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Sun Sep 15, 2013 9:27 pm

Sure, there seem to be two main problems with the CSUD, one is a ramdom crash that seem to make the screen go blank.
Which can be fixed by change to older ver of the bootloader files
Eg: replace bootcode.bin and start.elf with the ones from this zip
http://www.dex-os.com/DexBasic/DexBasic.zip
You will find them in the folder Boot.

There also a problem with stuff being written at address 0x000f0000 and 0x00050070.
Which may or may not cause a problem, depending on if that address is used.
In my OS i only need to to use the older boodloaders, but other have needed to make sure the the above address are not used.

Also if you add this code (fasmarm you will need to change it to gcc) to the startup of your OS ( if you have not done so already )

Code: Select all

; by krom (Peter Lemon)
; Start L1 Cache
mov r0,0
mcr p15,0,r0,c7,c7,0 ; Invalidate Caches
mcr p15,0,r0,c8,c7,0 ; Invalidate TLB
mrc p15,0,r0,c1,c0,0 ; Read Control Register Configuration Data
orr r0,$1000 ; Instruction
orr r0,$0004 ; Data
orr r0,$0800 ; Branch Prediction
mcr p15,0,r0,c1,c0,0 ; Write Control Register Configuration Data
You will get a big jump in your FPS.
Hope this helps.
Batteries not included, Some assembly required.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon Sep 16, 2013 2:03 am

Thanks. Is there an easy(ish) way to ensure that those addresses are not used? Ive used your boot loaders but I still get corruption somewhere.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon Sep 16, 2013 8:05 pm

You, Could try loading your kernel to above 1MB, that should work as long as those address are not just offsets of a address in CSUD.
You could also try this: http://www.raspberrypi.org/phpBB3/viewt ... 08#p422608
Batteries not included, Some assembly required.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Tue Sep 17, 2013 7:39 am

Well, I dont know what I did... I backtracked to a very early build and apparently I did something it didnt like. But its fixed now and reading the keyboard. Thank goodness too, because I was getting to the point where I was ready to hang my hat up on this. Tomorrow Ill start fixing key mappings and try to speed the thing up. Thanks for all your help guys.

User avatar
chocolate
Posts: 29
Joined: Sun Jan 27, 2013 11:40 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Wed Oct 16, 2013 11:28 pm

This looks like a fantastic project. Ever thought of putting up a donation button on your site?



Edit: I recently tested the operating system with a CRT television.

The emulator booted up, but I was unable to get my USB keyboard (Keytronic) to work. I had to plug and replug my keyboard each time I wanted to input a character. On the bright side, the emulator looks wonderful.
New RISC OS user.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon May 11, 2015 4:00 pm

Just a note - Ive gotten some emails lately about lack of movement on this project. Not dead at all - just normal life getting in the way. But Im back on the bus, ready to make some significant improvements to this.

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon May 11, 2015 4:01 pm

Also, I found this project:

https://github.com/steventroughtonsmith/rpi-basic

Which looks really nice. Curious if he used Chadwicks USB library as I didnt see any reference to it. Cant try it right now because Im at work. Anyone know?

beta-tester
Posts: 1236
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon May 11, 2015 4:18 pm

interesting project...
first time i heard something about it...
thanks for push that thread into the year 2015, otherwise i never noticed your work.
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

xlar54
Posts: 50
Joined: Tue Aug 20, 2013 5:08 am

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Mon May 11, 2015 4:22 pm

Thanks, yeah it's been awhile.

What I REALLY wanted to do was port VICE to run native on the Pi. Ability to run any of the CBM 8-bit machines at boot would be very cool. But VICE is pretty complex (at least for me), so I started with a simpler codebase for emulation. The 8-bit machines just wont die :)

kriss
Posts: 66
Joined: Thu Apr 02, 2015 8:53 pm
Location: france for now ...

Re: Commodore Pi - A Commodore 64 OS for the Rpi

Wed May 13, 2015 2:47 pm

your git is 2 year old so you have to push your recent changes or provide the real rcs link ;)

Return to “Bare metal, Assembly language”