dimanche 24 novembre 2019

How to compile N64 microcode from source


It was nearly impossible till very recently to create new microcode working with original SDK for the N64. It is now something possible under Linux, with the recently release of the iQue player SDK for N64. Hereby a tutorial, oriented for linux beginners as me, to do so.


  I/Install Centos 6.10 i386 (32 bits)


Download the isos of the distribution: 




You may install the “Software Development Workstation” set of software.


Here a nice tutorial for the X86_64 version (64 bits):




   II/ Install the necessary missing software/libraries


Ensure that you are connected to internet


Go to System Tools, Terminal and then type:


su  


Type your root password and then type:


yum install dos2unix


Press yes where prompted.


Close the terminal


Download libstdc++-libc6.2-2.so.3 for Centos 6.10




Install the package by opening the file downloaded and follow the instructions.


   III/ Copy the SDK in your user folder


Go into your personal user folder and create a folder named “ique_root”.


Copy the folder “doc” from the iQue SDK to this ” ique_root” folder.


Copy the folder “PR” and “usr” located in the per_user folder of the SDK to this  ” ique_root” folder.


Feel free to install the .rpm packages located at the root of the SDK, it might be useful in order to compile a N64 binary rom (i.e. a sample from the SDK).


   IV/ Setup path environment variable


In the terminal, type:


ROOT=$HOME/ique_root; export ROOT


and also:


PATH=$PATH:$ROOT/usr/sbin; export PATH


Please note you will have to do so each time you want to use the SDK.


   V/ Clean boot microcode sources and compile!


The source of the microcode can be found in some “leaked files” in the folder usr/src/PR/rspcode.


Copy this folder to your ique_root.


With the Terminal, type:


cd ique_root/rspcode/rspboot


then type:


dos2unix Makefile


then type


dos2unix *.s


This command will turn the files from Windows to Unix format.


Then type:


make





The code is compiled! :)


The rspboot.o can be found in folder rspboot.


   VI/ Graphics microcode compilation


All source files in the folder graphics (cd ique_root/rspcode/graphics) have to be turned in Unix format with the dos2unix command.


Open the file gmain.s with gedit and  at this line: #include "newt.s" */


erase the “*/” and save the file


Open the file goverlays.s with gedit and at this line: #include "gflight.s"   # do lighting


Erase the “# do lighting


The file called labeltest and sizecheck will have to its permission extended to access reading and writing (click right on the file, tab “Permissions”)


Open with gedit sizecheck and change #!/bin/ksh to #!/bin/bash


Open with gedit labeltest and change #!/bin/ksh to #!/bin/bash


Open with gedit fillnops.c and add below #include <stdio.h>:


#include <stdlib.h>


And then type in Terminal:


make


In each folder you can find the compiled ucode (*.o files).


And voila, you have already a very good idea on how to compile microcode for the N64.

Next step will be to check out how to customize a microcode to our taste :) This will be the subject of another article.

Thanks for the support of CrashOveride (he noticed that the iQue N64 got the tools to compile the ucode!!!) :)
Very special thanks for the help of Gonetz!