Jump to content
IGNORED

Timing for ROM access


SvOlli
 Share

Recommended Posts

I'm thinking if it would be possible to take a Raspberry Pi Zero and use it GPIOs to act as a ROM simulator, just like the Harmony cart does using a microcontroller. This is not intended as a replacement for the Harmony, but an extension for development. I think it would be nice, if you could run your whole development on the cartridge.

 

It also offers some other features not possible on a Harmony, like playing a 15kHz 4 bit audio file decoded from mp3/ogg/wav by playing one sample each raster line.

But before I dive into developing a 2600 HAT for the Raspberry, I'd like to run some sanity tests, like: is the ARM CPU really fast enough to run a ROM simulator as a kernel module? For this I need to know, the time I have from noticing the change of the address until the data is read from the bus. I know, I can pull these out of the 6502 specs for example, but I'd prefer some figures taken from a real machine.

I know that there is still some more stuff involved like converting the 3.3V of the RasPi to the 5V of the VCS, but imho the next step would be writing a simple linux kernel module to fake rom access, so can use an oscilloscope to check if the RasPi is able to meet that hard timing requirement.

  • Like 1
Link to comment
Share on other sites

Actually I have been working on a Rasperry Pi cartridge based on the B+. I had to install my own operating system on the Pi ... Linux is not fast enough. But I was finally able to use the Raspberry Pi B+ as a Pac-Man cartridge (shame on me for choosing Pac-Man).

 

So yes, the Pi is fast enough to do this, but you need a very much optimized assembly kernel for that and there is VERY little time left for anything else but watching the bus and setting the data lines. Doing a lot of things in the background is at least difficult.

There are other difficulties: The noise level you induce into the 2600 by using a Pi is significant. I was not able to receive power from the console and have a nice picture at the same time. Even not after using resistors on the dataline between the level shifters and the 2600. Only when using an external power supply for the Pi, the picture quality was acceptable.

 

Actually I already bought a Pi Zero to see if it is possible to replace the B+ by Pi Zero. Unfortunately I had to wait a long time for the Zero and now I have no more time to work on the project ...

I never ordered a PCB, but I think the Pi zero could be squeezed into a 2600 cart ...

post-3715-0-87202200-1468441226_thumb.jpg

post-3715-0-45184400-1468441235_thumb.jpg

post-3715-0-80794000-1468444775_thumb.jpg

Edited by Kroko
  • Like 1
Link to comment
Share on other sites

Kroko, did you ever consider using arduino instead ?

I needed at least 24 free GPIO pins. Lots of people have Raspberry Pi at home, so all that is needed is a cheap adaptor to turn it into a 2600 cartridge.

 

How popular is Arduino compared to Raspberry Pi ? Do people have these at home, too ?

 

Now that the Pi Zero is 5$ it might be hard to find something comparable in the arduino world.

Link to comment
Share on other sites

Kroko: thanks for sharing your experiments. It saved me a lot of time.

 

I also didn't think about the noise level, but since my ideas was to run the development environment directly on the RasPi, there would have been already the need for an external power supply.

 

Since timing is critcal and I'd like to run it inside linux, I think I'd start with the RasPi 3 then: If one core takes care of the GPIO vritually exclusively, then I could still use the other 3 for assembling, etc. Especially when the Pi3 Compute Module has been announced, it's a Pi3 without the wireless chip in the formfactor of an SO-DIMM.

Link to comment
Share on other sites

Nope, but I think it should be possible to run a linux kernel module that will serve as a ROM simulator. It has to be inside the linux system, which also allows communication between the dev system and the ROM simulation (like uploading a new ROM).

Link to comment
Share on other sites

Kroko, Rpi is more a computer than a micro controller, so you can't really compare it to each other.

 

I was wondering about arduino because it is free of OS annoyances and you can find a cheap 5$ nano version (although it is far from Rpi specs we agree).

Link to comment
Share on other sites

p0ke: it needs to be fast.

Let's assume the following: You're using an Atmega 2560, which has enough GPIOs: It's clocked at 16MHz, the VCS is clocked as 1.2MHz.

The you'll have 13-14 clock cycles on the Atmega for each clock cycle of the VCS. In this you'll need to do the following:
- wait for address lines to get stable

- read the values of address lines

- decide if you want to go active (address >= $1000)

- read / calculate the corresponding data byte to that address

- write it to the data lines

 

All this in 13-14 clock cycles? I'm leaving out here that the writing of the data lines need to be done way before the end of each clock cycle. My rough guess is that you'll need to do the write at about cycle #10. Even if each opcode takes only 1 cycle to run, it's very hard to accomplish.

 

The RasPi can be programmed like a microcontroller, it's called "bare metal" and that is what Kroko did.

I even want to have the Linux kernel running, so I can do coding right on the cartridge running in the VCS. This may be possible with a Pi3 because it's multicore architecture should be able to "answer" to the continuing changes of the address lines, while still running the operating system.

Link to comment
Share on other sites

SvOlli :

 

You right. Explained like that I understand better.

 

I have in fact no idea about necessary operations between the cart and the vcs so I can't guess precisely the necessary cycles.

 

I didn't knew about the "bare metal" which is clearly solving many things (on my side) about Rpi. I failed to find it during my previous search on the web ! (thank you the info)

 

Gonna buy a zero right away !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...