CP/M-65 cartridge for the SNES? #228
Replies: 21 comments 39 replies
-
That would actually be interesting... although I don't own one either! The current port uses 64kB of ROM, which contains the fonts, the BIOS, the supervisor, and the startup vectors, although most of that is empty; I think it'll all fit in 16kB, but not 8kB. The SNES startup is kinda weird so it'll need to be at 0x004000 in the ROM to get the startup vectors in the right place. The hardware registers could go at 0x008000 in the ROM, which will appear at 0x018000 in the memory map. If you had a 32kB EEPROM, then it'd be at offset 0x000000 in the ROM, and the hardware registers would be at 0x008000. That reduces the chip select logic to a single inverter. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the input! I have attached an updated version of the schematics. Apparently 32 kB EEPROMs are getting ridiculously expensive these days, but 128 kB NOR Flash memory is cheap and easy to get so it is better to go with that. I added some image select jumpers so that it is possible to select four different ROM images. I went with your proposed memory map, but I added some simple diode-resistor logic to also account for the /CART signal (otherwise the there will be a bus conflict for addresses outside of the cartridge memory area). So now ROM is selected whenever A15 is low and /CART is low, and the VIA is selected whenever A15 is high and /CART is low. Both devices will repeat all over the memory map, but I don't think that is a problem. With the 128 kB Flash, could I just as well wire up A15 and BA1 to the Flash and use BA2 for the chip select logic, to allow 128 kB of ROM, or will that complicate the code as the Flash and VIA ends up on different pages? I'm not really familiar with how the addressing works on the 65816. |
Beta Was this translation helpful? Give feedback.
-
The 65816 has addressing modes that can directly access 24-bit addresses, so having the VIA on a different page shouldn't cause a problem. With all 16 address lines wired up to the ROM and using BA0 and BA1 for chip select you get the HiRom layout (I think, SNES memory maps are exceptionally bizarre: https://snes.nesdev.org/wiki/Memory_map), which directly maps the ROM to 0xc00000 and up with a windowed 32kB mirror at 0x008000 which is used to boot from. This is the setup that the cpm65 SNES port currently uses. I looked up 6522 VIAs on Mouser --- they're not cheap, either! Which makes me wonder: it should be possible to replace both it, the shift registers and all the glue logic with something like a Greenpak programmable logic chip. It's only a little cheating --- it's not like using an actual CPU like the RP2040 to bit-bang the bus like the neo6502 does, and it's not an FPGA either. They even do level shifting. I found this project which uses one for a NES cartridge: https://forums.nesdev.org/viewtopic.php?t=20284 |
Beta Was this translation helpful? Give feedback.
-
Yes, I have been reading a bit about the different memory map options for the SNES and they are all very strange. Going with a 128 kB flash mapped from 0x00000 to 0x1FFFF in the cartridge memory space and placing the VIA at 0x20000 should hopefully be compatible with the HiRom adressing. All the WDC parts are fairly expensive, I guess that they run them in small volumes on an old process which tends to increase the cost. I had a look at the Greenpak and while they look interesting, I would prefer to use the WDC VIA at least for a first version in order to not have too many moving parts at once. It would take a fair bit of investigating to find out if all the needed logic can fit into a Greenpak device, especially since I've never used them before and they don't seem to support VHDL/Verilog or any other well known HDL, but instead use some kind of graphical environment for programming. In addition, I think that the cost of having to get the programmer will be higher than the price difference for the 6522+logic when doing just a couple of boards, and the availability of parts in packages which are solderable by hand (i.e. SO packages) is limited (sending the boards for pick and place/reflow mounting will definitively cost much more than a couple of VIAs). Using the 6522 is also better if someone would like to reproduce this cartridge later, as they won't have to get a specific programmer. |
Beta Was this translation helpful? Give feedback.
-
I've never worked with a Greenpak, but apparently there's support on Yosys and OpenFPGA, as well as a bespoke Python library to do bitstream synthesis and programming via I2C. Somewhere, I can't find a link now... So with the 6522, I make the BoM: one each of 65c22, 74hc14, tcb0104, ap2204, sst39sf010, pic12f, plus some passives. Is that correct? Does the PIC need a programming port or would it be done out-of-line, meaning it needs to be socketed? The only other thing I can usefully contribute is to note that there are enough spare pins on the 6522 that DAT1-3 on the SD card could be hooked up, with a bigger level shifter chip. That would (I think) allow 4-bit SDIO, which given that the interface has to be bitbanged might simplify the code. It'd also improve performance but I don't think that would be an issue. |
Beta Was this translation helpful? Give feedback.
-
Ah, I only checked the Renesas documentation and tools. I will read up more on that, it is interesting as 5V CPLDs in general are getting hard to find. Yes, that is the current BOM, + a SD-card slot, a miniDIN-6 connector and some diodes. I noticed that the AP2204K-3.3 is end-of-life, so I will change to another linear regulator for the 3V3-rail. I will also go through the passives and check that the sizes are OK for the specified values before starting the layout. I will add the PIC programming header so that it can be programmed in circuit, good point! The current connection between the SD-card and the VIA are done so that the code could be reused from the sdcard6502-project. In my experience SD-cards are much more fuzzy about the timing when using 4-bit SDIO than with SPI, so maybe that is an issue with a bitbanged interface? I don't remember how the cartridge port on the SNES works exactly - do you know if any type of case is needed to insert the cartridge (of there are some microswitches to detect that it is inserted for instance?) or is it possible to just put the PCB in there as is? |
Beta Was this translation helpful? Give feedback.
-
I have come a bit further now, so the KiCad project, including the BOM in open-office format and PDF schematics, is up on github now if you want to have a look. The rough component placement is done and I have done some sanity check of the routing to see that the address and data lines are possible to route in a good way, the rest should be straight forward. The board design is hopefully done quite soon if I find the time to work on it. The board outline should hopefully fit into a PAL SNES cartridge case, so either one could be reused from a broken game (with some dremel work for the connectors) or a new case could be 3D printed. |
Beta Was this translation helpful? Give feedback.
-
It looks good to me! Some minor nits:
I can't think of anything else? One problem is that if neither of us have a SNES, testing will be tricky. I can probably hack support into an emulator fairly easily to allow development but that's not the same as using real hardware. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the input!
Regarding getting a SNES I will look around to see if I can borrow one, otherwise I'll try to find a cheap unit somewhere. They pop up fairly frequently on local second hand sites here in Sweden. |
Beta Was this translation helpful? Give feedback.
-
I think the design is done now, here are the updated schematics. See the attached picture of the routed board below for the placement of things. I placed the CE LEDs by the affects chips although I just realized that maybe they should be at the top so that they are visible also when the cartridge is inserted? :) The hunt for a SNES continues, but I hope to find one soon and then order the board and components. |
Beta Was this translation helpful? Give feedback.
-
The 6522 CA1/CA2/CB2 lines aren't connected to the header --- is that intentional? A question regarding the two shift registers: the odd placement of the output lines is to pull the eight data bits from the 11-bit PS/2 frame while discarding the start and stop bits, right? What triggers the CPU to read a value from the 6522 --- does it just poll the value at intervals until it sees something valid? Without seeing the start and stop bits it doesn't know whether the byte is valid, though. The only other thing I can think of, and this is getting really nitpicky, is that the ROM chip seems rather close to the bottom of the board. I did go and try looking for schematics for the PCB layout tolerances but couldn't find anything, but I also didn't see any other PCBs that had big components that far down. I have no idea if that's significant or not. Other than that, I've got nothing. |
Beta Was this translation helpful? Give feedback.
-
A quick update - I got my hands on a scruffy old SNES in a partly 3D printed case for very little money, so now I have ordered the PCBs and will place a component order on Mouser soon, so there should at least be hardware available soon. |
Beta Was this translation helpful? Give feedback.
-
Good news and bad news... I got the wrong thickness PCBs, but at least I discovered it before I started soldering :) I got standard 1.6 mm boards without thinking about it, but of course SNES cartridges use 1.2 mm. It may be possible to force a 1.6 mm board into the connector, but probably not too many times, so I'll just order new boards. I made a quick verification of the footprints and dimensions on the boards I got now and it all seems fine. |
Beta Was this translation helpful? Give feedback.
-
Hah. I have on video the exact moment I realised I'd used a 0.05in pitch footprint on a PCB instead of a 0.1in footprint. My SNES turns out to work, more or less, but the case is very broken and my epoxy isn't setting. |
Beta Was this translation helpful? Give feedback.
-
Many years ago I bought a SNES at a flea market for €5,= just so I could play Super Turrican on Real Hardware instead of emulation. That's a prerequisite for world records. The cartridge was ten times the price of the console. Never got around to record it, and I lost interest, and I'll certainly need to retrain to reach 300K+ 😉 But anyway, I'll have working hardware if you need another tester. |
Beta Was this translation helpful? Give feedback.
-
Hi, I think this will work with SNES and CP/M-65. I will try to make it. https://ja.aliexpress.com/item/1005006399351128.html https://github.com/RobertDaleSmith/SNESpad/blob/main/examples/hid-keyboard/hid-keyboard.ino https://problemkaputt.de/fullsnes.htm#snescontrollersxbandkeyboard https://en.wikipedia.org/wiki/XBAND#Supported_games I bought this cartridge, is this work with CP/M-65 ? If it is arrived, I will report here. Regards, |
Beta Was this translation helpful? Give feedback.
-
That hardware doesn't let you connect keyboard to a SNES --- instead it lets you connect a SNES Xband keyboard to a Raspberry Pi Pico! That's the wrong way round. Unless I misunderstood you and you do have a Xband keyboard? As for the flash cartridge, that looks like the same one I have (I have the purple one). It would technically be possible to make it work, but you'd need technical information about how the flashcart talks to the SD card. Then it would be possible to run it on that and an Xband keyboard. But there's a lot of work to do there. If I ever get my own SNES working, I would like to investigate modifying the flashcart, but haven't started looking for any documentation on it yet. Do you have anything? |
Beta Was this translation helpful? Give feedback.
-
Which emulator do you use ? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I found this file is Xband keyboard tester cartridge image file. I will try to check my usb keyboard-snes converter. |
Beta Was this translation helpful? Give feedback.
-
A Japanese man wrote Arduino SNES keyboard it works on patched SNES CP/M-65. https://github.com/satoshiokue/SNES_CPM-65_keyboard (In Japanese) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
What do you think about making CP/M-65 cartridge for the SNES, with a SD-card interface and PS/2 keyboard connector on the cartridge, so that it is actually possible to run CP/M-65 on obtainable SNES hardware?
For the SD-card interface the design from sdcard6502 could be used, and the PS/2 can be deserialized using some inverters and a couple of shift register, similar to what Ben Eater does in one of his videos. Both of these interfaces can be connected to the same 65C22, which is then hooked up to the CPU bus.
The superCIC uses a small PIC12 microcontroller to emulate the CIC chip, this is easy to add to the cartridge.
An EEPROM also needs to be included on the cartridge for the boot code, I guess 8k should be enough? A larger ROM could of course be used so that FAT32 code can be included for instance.
I made some quick schematics which contains at least a first version of everything except the address decoding, I need to read up a bit more on the SNES memory map to see where the ROM and 65C22 needs to be placed.
Do you think this is worthwhile going through with to get it running on actual hardware? I'm happy to do the hardware design, but I don't think I am familiar enough with the SNES to do the software changes which are needed (all disk and keyboard code at least).
I don't own a SNES which would complicate testing somewhat, but that is at least a simple problem to solve :)
Beta Was this translation helpful? Give feedback.
All reactions