FPGA core (Patreon)
Downloads
Content
Hi everyone!
Today I want to kick off the FPGA part of the N64.
It means that you will find the very first core build attached to this post.
Also the GitHub repository is open for you to take a look at the VHDL code or read the changelog as your daily newspaper :)
https://github.com/RobertPeip/Mister64
Before you transfer over some games to your SDCard and are frustrated that none of them works, let me tell you about what is really in this core already:
The core basically only has the bare minimum CPU together with memory interfaces and required registers. In terms of completeness this is only 5% of the whole core. I will post the whole progress of the core at the bottom, like I did with the emulator.
The reason why I open it already is that some homebrew stuff is working, so progress and also regressions can be tracked. It was a great experience with the PSX core to open the project early for anyone to try. While most of you will probably skip it until games are working, some might want to run it every now and then.
What can the core already handle?
The N64 has multiple boot stages. Some of them are often hidden by most emulators and skipped, but the core will do them.
- It starts booting out of the PIF ROM. Some IO registers are set up and the CPU will copy it's own program to RSP memory. The RSP memory is shared between RSP and CPU and both can execute code from there. The reason why the program stored in PIF ROM is copied to RSP memory is that access to the PIF is extremly slow.
- The second step is copying over the first 1000 instructions from the game cartridge using the CPU. This segment of each game cartridge is holding another bootcode that will be executed.
- Most of these cartridge bootcodes will now copy the first MByte of the cartridge via DMA to RDRAM, CRC check this data and then start running it.
I tell you all that so you get some idea what the core can already do, because these steps work fine already. Also some simple programs can run after this initial boot up.
What can YOU do with the core at the moment?
There is a big repository by Peter Lemon, aka Krom:
https://github.com/PeterLemon/N64
There you can find many homebrew tests for nearly all components of the N64, written in MIPS assembly. As binaries are checked in, you can just download the repository and try some of them.
Most basic CPU tests and some demos are already working, but many tests will still just hang up. For a first test, I can recommend:
"HelloWorldCPU16BPP320X240.N64"
How to setup this early build of the core:
- have a MiSTer with SDRAM
- download the RBF attached and copy it to your SDCard
- create a "N64" folder on your SDCard
- copy a PIF ROM file and name it as boot.rom
- load up the RBF and select a .N64 or .z64 file
How to get a PIF ROM?
Some emulators seem to share it via GitHub, but as this is a typical BIOS file, I cannot and will not provide it for you, sorry.
You can extract it from your N64 if you have a Everdrive:
https://github.com/hcs64/pif_rom_dumper
Please understand that I cannot assist further with this file.
Video output is a hack currently:
- Analog output is completly untested, be aware that it might not work at all!
- Interlaced output is still not finished. You may have to toggle the interlace option in OSD for 480i mode homebrew
- I recommend setting up a section entry in the MiSTer.ini to make the video triple buffered for keeping sync to your screen:
[N64]
vsync_adjust=0
Please be aware that this build is as early as it can be. Expect all kind of issues and please understand that I cannot give individual support. Things will get more stable over time.
What is the schedule?
I will spend the next time with adding missing CPU features like Caches, missing instructions and the management coprocessor (COP0). After that RDP, RSP and FPU must be implemented, among some other smaller components.
Overall, don't expect games to run soon. The project just started and there is a lot to do. Hopefully more and more homebrew demos will work over time until finally the first game boots up.
That's it for today.
Have fun!
Full progress(FPGA core):
- CPU: 20%, many components are missing/stubbed, only uncached instructions working
- RDP(Graphics): missing
- Video output: hack to output 60Hz 240p/480i without all VI features like AA
- Memory: 20%, RDRAM and cartridge can be accessed
- FPU: missing
- RSP(second CPU): missing
- Inputs: missing
- Sound: missing
- Saving: missing