Interesting use of Cosmos

Developer
Feb 1, 2011 at 4:40 AM
Edited Feb 1, 2011 at 4:44 AM

Hey guys,  just wanted to do a quick show and tell.. Im using Cosmos to host a 6502 CPU emulation class.  Essentially building an 8-bit system which can run on modern hardware, access all the RAM available (via bank switching), and when FAT12 or 32 drivers are ready, access harddrives and cd-roms.  Here's a screenshot of the system booting up into the built in ML monitor:

http://i.imgur.com/hpvkU.jpg

The CPU starts at location 0, which contains a zero (BRK instruction), jumping to the built-in ML monitor.  Screen memory is currently mapped to $03E8.  It will execute any 6502 instruction.

If anyone has worked with the old Commodore 8-bit machines or Apple 8-bit machines, I think you may find this a rather interesting application of Cosmos.  Roll your own Super-Commodore 64 :)  And with the proper emulation class, Cosmos could allow you to emulate any CPU system.

Coordinator
Feb 1, 2011 at 1:12 PM
Thats really cool! Can you give us some more details how you are doing this?

On 2/1/2011 1:40 AM, xlar54 wrote:
> From: xlar54
>
> Hey guys, just wanted to do a quick show and tell.. Im using Cosmos to
> host a 6502 CPU emulation class. Essentially building an 8-bit system
> which can run on modern hardware, access all the RAM available (via bank
> switching), and when FAT12 or 32 drivers are ready, access harddrives
> and cd-roms. Here's a screenshot of the system booting up into the
> built in ML monitor:
>
> http://i.imgur.com/hpvkU.jpg
> <http://www.google.com/url?sa=D&q=http://i.imgur.com/hpvkU.jpg>
>
> If anyone has worked with the old Commodore 8-bit machines or Apple
> 8-bit machines, I think you may find this a rather interesting
> application of Cosmos. With the proper emulation class, Cosmos could
> allow you to emulate any CPU system.
>
> Read the full discussion online
> <http://cosmos.codeplex.com/Thread/View.aspx?ThreadId=244082&ANCHOR#Post558477>.
>
> To add a post to this discussion, reply to this email
> ([email removed]
> <mailto:[email removed]?subject=[Cosmos:244082]>)
>
> To start a new discussion for this project, email
> [email removed] <mailto:[email removed]>
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe or change your settings
> <https://cosmos.codeplex.com/subscriptions/thread/project/edit> on
> codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at codeplex.com
>
Developer
Feb 1, 2011 at 1:43 PM

Sure, thanks.  The 6502 is a simple CPU to emulate - only having 3 registers, a stack pointer, status register, and program counter.  The emulation class reads wherever the program counter is pointing to, and then acts on the instruction at that location (so I first have to create a block of "RAM").   Basically, if you strip out the custom chip code from the Nintendo emulators, or VICE (a C64 emulator), to where all you have is the CPU emulation, that's what I am working from.  To access the text screen, I created a ConsoleIO class which wraps your Cosmos.Hardware.TextScreen and Cosmos.Hardware.Keyboard classes.  I map the text screen to a set of memory locations in the simulated RAM.  So if you load the accumulator with a 65 (LDA #65), then store it at $1000 (STA $1000), an 'A' will appear in the top left corner of the screen.  Hope not to dull folks with 6502 assembly too much here :).  Ill post the code up here on Codeplex somewhere in a day or so.  But yeah, I think its pretty cool.  Consider a PowerPC CPU emulation, or Z80, or anything like that.  I've searched around, and I *think* this is the first directly bootable CPU emulation thanks to the work of the Cosmos team.

Coordinator
Feb 2, 2011 at 11:42 PM
Really cool! Would love to see it sometime.

On 2/1/2011 10:43 AM, xlar54 wrote:
> From: xlar54
>
> Sure, thanks. The 6502 is a simple CPU to emulate - only having 3
> registers, a stack pointer, status register, and program counter. The
> emulation class reads wherever the program counter is pointing to, and
> then acts on the instruction at that location (so I first have to create
> a block of "RAM"). Basically, if you strip out the custom chip code
> from the Nintendo emulators, or VICE (a C64 emulator), to where all you
> have is the CPU emulation, that's what I am working from. To access the
> text screen, I created a ConsoleIO class which wraps your
> Cosmos.Hardware.TextScreen and Cosmos.Hardware.Keyboard classes. I map
> the text screen to a set of memory locations in the simulated RAM. So
> if you load the accumulator with a 65 (LDA #65), then store it at $1000
> (STA $1000), an 'A' will appear in the top left corner of the screen.
> Hope not to dull folks with 6502 assembly too much here :). Ill post
> the code up here on Codeplex somewhere in a day or so. But yeah, I
> think its pretty cool. Consider a PowerPC CPU emulation, or Z80, or
> anything like that. I've searched around, and I *think* this is the
> first directly bootable CPU emulation thanks to the work of the Cosmos team.
>
> Read the full discussion online
> <http://cosmos.codeplex.com/Thread/View.aspx?ThreadId=244082&ANCHOR#Post558680>.
>
> To add a post to this discussion, reply to this email
> ([email removed]
> <mailto:[email removed]?subject=[Cosmos:244082]>)
>
> To start a new discussion for this project, email
> [email removed] <mailto:[email removed]>
>
> You are receiving this email because you subscribed to this discussion
> on CodePlex. You can unsubscribe or change your settings
> <https://cosmos.codeplex.com/subscriptions/thread/project/edit> on
> codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any
> posts to this discussion will also be available online at codeplex.com
>
Developer
Feb 9, 2011 at 2:48 AM
Edited Feb 9, 2011 at 2:48 AM

I've published my project.  Feel free to check it out at:  http://cbm11.codeplex.com/.