Stephen Smith's Blog

Musings on Machine Learning…

Posts Tagged ‘supernintendo

Continuing the MiSTer Journey

leave a comment »

Introduction

Last time, we started our MiSTer journey and could run the various cores that didn’t require the add-on memory expansion module. I finally received the memory expansion board, so now theoretically I can run any of the MiSTer computers, consoles and arcade games. For game consoles, this seems to be the case as all you need is the software images from the original game cartridges, for computers it’s a bit more complicated.

MiSTer uses the FPGA to replicate the original computer hardware. This leaves out the software side of things. Typically, you then need the boot ROMs and operating system. Once you can boot the operating system, then you can run various programs such as games.

Further, many of these older systems are rather quirky and you have to spend a bit of time learning the system. First a quick recap of components I purchased and components I already had lying around.

Quick Recap

I have quite a few Raspberry Pi type Single Board Computers, so I generally already have a number of the components for these sorts of projects, so here is a summary.

Components I purchased:

Components I already had:

  • HDMI Monitor
  • HDMI Cable
  • USB Keyboard
  • USB Mouse
  • USB Nintendo Game Controller
  • 128GB microSD card (plus USB adapter to plug into a computer)
  • microUSB cord and plugin, for power to USB hub

Nintendo – The Easy Part

Copy the files from the Arcade Punks image for Nintendo, namely games/NES and games/SNES and you are ready to play pretty much any Nintendo or Super Nintendo game. Already having an USB Nintendo game controller is a big help as you don’t need to worry about mapping buttons, etc. With these, loading and running the games is pretty painless. You just need to remember F12 is the MiSTer button to bring up the menu where you load them.

Atari ST – A Bit More Work

I copied the games/AtariST folder from the Arcade Punks image to the microSD card, inserted it into the DE-10 Nano, booted and chose Computers / AtariST from the MiSTer menu. I then received a blank screen. Popping up the configuration menu and selecting a floppy drive didn’t help. A bit of Googling revealed I was missing the GEM operating system. Atari referred to this as TOS (The Operating System) and you need this. AtariMania seems to be a good place to get a copy of TOS. Choose the version and language you prefer and download. I chose 2.06 and US English. Then copy the .img file to games/AtariST and rename it TOS.img. Now when you boot, you should load into the GEM desktop.

Once you have the GEM desktop running, then you can press F12 to select floppy disk images. Some of the images you can open and run the program contained on the disk. Others you have to select reset to cause a reboots since they are bootable floppies. For instance, here is Apache running.

As long as you aren’t too picky this is fine, meaning try a game, and if it doesn’t work properly then ignore it and run another, after all there are lots to choose from. There is a bit of extra complexity being glossed over here. Generally if you want to run a specific game, there may be a bit more work to do. Here is a list of potential issues:

  1. Hardware version. There were quite a few versions of hardware with different memory and processors. A particular game may require a specific hardware configuration from the MiSTer configuration.
  2. TOS software version. A particular program may require an exact version of the TOS image. It may not work on either newer or older images.
  3. Many of the games were on copy protected floppy disks, these are mostly available in “cracked” versions meaning the copy protection has been removed. This process might have introduced bugs, hard to say the quality of any specific “crack”.
  4. Perhaps there is a bug in MiSTer? Completely modeling a computer as sophisticated as an Atari ST is a challenge. They seem to have done a great job, but bugs are still being fixed and functionality improved.

A key thing I found is patience. Loading some of these old games is slow and as I’m about to give up, suddenly it appears or starts. MiSTer claims to emulate the speed of the CPU exactly, but I’m not sure about floppy disks. They do seem slow, but then I don’t know if it’s the CPU running at 8MHz, the 1MB RAM or the slow floppy drive.

Summary

With each step I can run more things on my MiSTer system. Some are easy to get going. Others require patience. The MiSTer name was formed out of the Mi in Commodore Amiga and the ST in Atari ST. So I have the Atari ST part working. Now onto the Commodore Amiga which looks fun.

Written by smist08

June 14, 2024 at 12:11 pm

Meet the Sipeed Tang Primer 25K FPGA

with 2 comments

Introduction

Last year, I got interested in FPGAs and purchased a Digilent Basys3, which was lots of fun to play with, I even got a minimal RISC-V processor programmed. The Basys3 is their lower end board and doesn’t have any RAM, limiting what you can do, since it has to use logic elements such as flip-flops to fulfill this purpose. To go further, I saw I could get the Sipeed Tang Primer 25K, inexpensively, containing many more logic elements along with RAM. This board is based on the Gowin 25K Arora FPGA and as such means learning the Gowin development tools rather than the familiar AMD Xilinx Vivado tools. This blog post is a review and some of my experiences using this board, including going down the rabbit hole of FPGA retro gaming.

Initial Setup

I received the Tang Primer 25K FPGA gamer bundle, which included a pair of Playstation compatible controllers that attach to a PMOD to connect to the board. However, this isn’t complete, you still require TFcard, HDMI and RAM PMODs which I needed to order separately. Would have been nice if the gaming bundle included everything required. Note that you need to use the Sipeed PMODs as others such as those from Digilent often are wired up differently. Ordering the collection, gives you a few other things to play with such as LED displays and pushbuttons.

The AMD Vivado development tools are really well documented with lots of tutorials and examples. Sipeed provides a wiki for their products and Gowin provides quite a bit of documentation, but the quality isn’t there and many of the instructions are incorrect. For instance, Sipeed says to use their special copy of the programmer to download programs to the FPGA rather than the Gowin one. However the special one didn’t work for me and I found the latest Gowin one was the correct one to use. It was nice that I could just download what I needed without requiring any interactions with Gowin, no export restrictions, since these are all Chinese companies.

FPGA Retro-Gaming

I previously looked at retro-gaming on the Raspberry Pi where people have written emulators for all sorts of processors and gaming systems. Now there is a new project MiSTer FPGA which emulates the hardware of various gaming consoles for FPGAs. I used the snestang fork which emulates the super-nintendo on various Sipeed Gowin based boards.

I didn’t have much luck initially, since I couldn’t load any games from the SDCard, but with some help from the developer, they made some changes to allow a bit more tolerance in accepting different cards. With that, I could load games, but had trouble starting them. Turns out you need to hit the start button first, hitting random buttons seems to disable the controller to the game.

Anyway, with that I could play games. The Verilog code that implements the Super Nintendo system implements a 65C816 cpu which is a 16-bit version of the 6502. This CPU was also used in Apple’s short-lived IIgs. Besides this CPU, it implements a RISC-V CPU that is used to provide the menu for system options and to choose the game to load, which it then loads from the SDCard. This gives you a basic RISC-V CPU with minimal firmware, HDMI support, SDCard support, controller support along with a menuing system.

This isn’t a bad starting point for playing with RISC-V hardware definitions. It gives you plenty of devices to play with, plus a debugging framework where you can print back to the host computer through the usb port, which can be read by putty.

Summary

The Tang Primer 25K is quite a powerful and capable FPGA at a reasonable price. You really need to get the pack of all the Sipeed PMODs so you have some devices to play with. I found it takes some patience to work with the Gowin tools and for me, with the 25K being fairly new, a lot of the documentation hasn’t kept up. You really rely on the samples to see how devices are connected, so you know how to map them in your program.

I think the FPGA approach to recreating vintage video game hardware is really cool. I just hope this doesn’t get stomped on by companies like Nintendo, who have a history of stepping on people’s fun.

Written by smist08

April 1, 2024 at 6:45 pm

Posted in fpga, RiscV

Tagged with , , , , ,