Net Yaroze Game Jam 2023

Net Yaroze Toolchain options

January 16, 2021, at 12:46 PM by mgarcia in Development, Software (0 comments)

Title: Net Yaroze Toolchain options Author: mgarcia Date: 2021-01-16 12:46 +0100 Tags: Development, Software Comments: Open


Size: 3.84 MB[Player volume: MAX]

Pre-configured Virtual Environment

Pre-configured Virtual Machines make for a very convenient development environment for many reasons:

  • The fastest and easiest way to get started - Install VM software and run.
  • Built for purpose - Pre-configured with all the tools, documents and help, and nothing to distract you.
  • 100% self-contained - Easy to maintain, test and backup.
  • 100% future proof - No hunting for specific versions of old software.
  • Transferable and portable - Easy migration from computer to another computer.
  • Scalable - suitable for a single person or a 10 person team collaboration.

Net Yaroze Development Virtual Machine 2022

https://archive.org/details/net-yaroze-dev-winxp-vm-2022

Windows XP makes for a great guest Operating System in a Virtual Machine, it's very, very light weight and runs most of the Net Yaroze and general gamedev art related software. Pre-configured with the Net Yaroze DOS and windows tools, YarExe, YarISO (script to create PS1 CDROM image) PS1 emulators (No$PSX, Mednafen, XEBRA), tutorials, demos and newsgroup. Examples and demos are configured with Eclipse C/C++ IDE (makefile driven) and a few with CodeWarrior.


Toolchain

The Net Yaroze executable format is based on the MIPS R3000 RISC CPU, which is Little Endian, meaning binary values grow from right (little end) to left (big end). It is also ECOFF format, which means that the executable depends on a runtime library, or dynamically link libraries (DLL) as Windows calls them.

A toolchain is typically a set of individual programs which create and maintain executable related files, this includes C/C++ or assembly source code, the MakeFile, object binary files, binary archives, and the executable.

These programs are, compiler, assembler, linker, archiver, stripper, etc, a step debugger and a make tool is typically also included.

The ideal toolchain solution is to build in your native Operating System running on your hardware. Also using newer and updated toolchain, is always better, but the catch is that the other original (16-bit) tools may not work well or at all.

Below is a list of the current compilers available targeting the Net Yaroze, that I am aware of.

Image: Images.Toolchain

Image of Metrowerks' CodeWarrior and DOSBOX printing DJGPP's version 2.7.2.


Original DJGPP DOS 16bit compiler

The original installation compiler and tools for DOS & windows is downloadable from: https://archive.org/details/net-yaroze-software-development-disc-pc-sony-playstation-europe. This compiler was a port of GCC to DOS (16-Bit) using the DJGPP code base.

The toolchain is very old, it's from November, 1995 (GCC 2.7.2), so it will have a lot of C language and compiler features missing or unsupported.

I previously suggested avoiding DOSBOX and to use a native or virtual machine with a 16bit OS, but after further testing, the Net Yaroze DJGPP toolchain does work in DOSBOX in both a native environment or in a virtual one. However, very large projects might have issues with DOSBOX settings and/or the compiler itself (apart from being old, it's a proprietary port of a free compiler).

The above methods make the original toolchain binary harder to use, but thanks to brill2k, who informed me that the original Net Yaroze toolchain can run well in modern Windows 64bit operating systems using NTVDMx64 by Leecher1337. Simply download the compressed file linked "downloaded here", and follow the install instructions. Basically extract it and go to the folder with your preferred language and run the installer, after installation a reboot is required, lastly remove the extracted folders. NTVDMx64 is more stable on Windows 7 then on newer Windows (10,11), It's recommended to install the CCPU version (especially on a Virtual Machine) and read the open issues.

In the video below brill show's how to install and configure the Net Yaroze binaries and setup the environment variables which is useful if you use an IDE which requires these variables, but they are optional if you choose to run them from a batch file and use make or launch the IDE via the command line etc.

  https://www.youtube.com/watch?v=HaiPIw0cpyA  

Set Up Net Yaroze On Modern OS (Rus + Eng sub), video by brill2k

Typical IDE-
  • Any editor that can execute a command line.
Pro's-
  • Modern OS and IDE.
  • Original toolchain, providing all the features of Net Yaroze.
  • All GCC code examples, demo's and tutorials just works.
  • Simpler toolchain and less complicated, which the original documentation and help was written for.
Con's-
  • A bit very slower then a pure native binary but still very usable.
  • Strict ANSI C, (ie: All variables must be declared at the beginning of the code block).
  • The toolchain is very old (and probably buggy).
  • To my knowledge, only works in Windows 7 or newer, 64bit operating system.

PSX3 (GCC 2.8.1 win32)

Graeme Evans' 2nd build of GCC from March 1998, it's configured to the C:\PSX3 folder. To my knowledge, it doesn't support software floating points (floats and doubles). It will compile with no errors, but it will most likely not run if fractions are used that don't result in whole numbers. Compiling with "-msoft-float" will force any usage of floating point numbers as errors in the linking stage.

But this isn't an issue worth worrying about too much, the PlayStation hardware doesn't have floating point hardware, instead relying on software emulation of floating point math. This is really slow because calculations have to be converted in software at runtime, instead of any hardware acceleration. So, in fact it's good practice not to use floats. However this also means that the math library needs to be replaced with a fixed point one, which are typically faster lookup tables (ie sin, cos, tan, etc) the trade off being a lack in precision.

To my knowledge, apart from the included math library which does use floats, the rest of the Net Yaroze libraries does not use floating point calculations.

But, using "real" floating point math is more common and portable now, and in that case, this compiler isn't for you.

https://archive.org/details/NetYaroze-GCC281

Typical IDE-
  • Any editor that can execute a command line (batch file or makefile).
Pro's-
  • Runs on Windows XP or newer without emulation.
  • Very fast compile time.
  • Easy to integrate with newer PlayStation emulator.
  • Runs fine in win32 platforms (and possibly win64).
  • Provides ISO/ANSI C with some C++ functionality.
Con's-
  • Not having float support means, it's not a complete replacement.
  • Still an older toolchain.
  • Some original (16-bit) tools will not fully work or only partially.

Compiling GCC v2.95.3

Unfortunately the MIPS ECOFF format was removed from GCC many years ago, so the only way to get a working GCC Net Yaroze compiler is to build an older compiler, capable of building the last supported compiler, which is v2.95.3 (March 2001).

So, your modern GCC compiler, builds the older GCC v3.3.4 compiler as normal, which then is used to build GCC v2.95.3 as a native binary with the output targeting the Net Yaroze.

Thankfully, Chris Marshall made an easy to use script (there is also a docker version) which does it all in Linux and possibly Mac. Windows could also be possible via Windows Subsystem for Linux (WSL), MSYS or Cygwin.

To build the compiler, download the script and follow the instructions: https://github.com/ChrisRx/mipsel-ecoff-toolchain
There is also a GNU-Linux x86_64 prebuilt download available.

There are also a docker image for Net Yaroze using this method:
1) https://github.com/Davermouse/docker-yaroze
2) https://archive.org/details/sdk-yaroze.tar

Typical IDE-
  • Any editor that can execute a command line (batch file or makefile).
Pro's-
  • Runs on modern platforms without emulation.
  • A bit better C/C++ support then GCC 2.8.1.
  • Very fast compile time.
  • Includes floating point support.
  • Capable of compiling and linking large projects.
Con's-
  • The original (16-bit) tools not supported, but most likely not needed.

Metrowerks CodeWarrior Win32

Made by Metrowerks, CodeWarrior is an all inclusive C/C++ compiler and IDE built for Net Yaroze development. CodeWarrior already had a Psy-Q (Pro Dev Kit) PlayStation product, and some parts are based on that (file streaming via serial).

They also made compilers for other systems including Windows, PowerPC Mac's and embedded devices, and were seen as high quality compilers at the time.

CodeWarrior was available for Windows 95 and it was also the only official (and unofficial) Net Yaroze development environment for Apple Macintosh users (OS 7 to 9), here the installation can be seen for CodeWarrior for PowerPC-based Macintoshes.

From a CodeWarrior's v2 readme, the C++ subset includes:

  • Creating C++ classes with or without virtual functions
  • Allocating objects on the heap with new (and destroying them with delete), statically, or on the stack.
  • throwing C++ exceptions.

C++ features that are NOT provided (but is not limited to):

  • namespaces
  • iostreams libraries
  • C++ Standard Template Library

I'm not sure if or how well CodeWarrior emulates, ie in wine.

Delta Island has images of R2 (win) and R5(mac) CodeWarrior for Net Yaroze.

Pro's-
  • PC file streaming, using special codewarrior functions.
  • Visual step debugger.
  • The IDE, build tools and debugger all works well (and not slow and buggy) in win32 Operating Systems.
  • Possibly generates better PlayStation binaries then GCC.
  • Also an original tool, replicate the authentic experience.
  • YarExe support for CodeWarrior is Work In Progress.
Con's-
  • The interface is non standard and debugger has no scroll wheel mouse support.
  • Missing modern IDE features like Intellisence (auto complete) and refactoring.
  • To my knowledge there are no command line options.
  • Binaries are not compatible with GCC and visa versa.
   

Metrowerks CodeWarrior for Net Yaroze (no audio)

In the video above, I show Code Warrior V2 installed with V3 patch applied, configured to run at 115.2 Kbps com speed. It is running in winXP VM using my home made USB (FTDI) to serial cable, I am showing the step debugger in operation. The demo and code is from the included Check program.

Thanks to the V3 patch, the scroll mouse works in the IDE, but not in the debugger, maybe better mouse drivers could fix this though. This is my first time using it, it looks slow but stable, has nice visual features, but I think I still prefer GDB, when it actually works.


PSX.Dev Visual Studio Code Extension

The PSX.Dev community have extracted the professional (PSYQ) libraries and made them usable with a modern GCC compiler and debugger. They are also maintaining the PS1 emulator, PCSX-REDUX which also allows GDB to step through code. And they have combined all these projects into a simple Visual Studio code extension.

From early testing, it does not support float's or any functions which uses them.

Net Yaroze, being a cut down version of the professional SDK, it is relatively simple to create a Net Yaroze compatible project.

Pro's-
  • Modern OS (Linux and Windows), toolchain and IDE.
  • Visual step debugger via PCSX-REDUX or a real PlayStation using nops.
Con's-
  • Not having float support means, it's not a complete replacement.
  • While this GCC is modern, using modern features will break backwards (Net Yaroze GCC or Code Warrior) compatibility, recommend also installing the previously mentioned toolchains, to confirm compatibility.

Follow the most excellent video instructions to get started.

   

PSX.Dev Visual Studio Code Extension for PS1 Homebrew development, by Nicolas Noble.

The Net Yaroze demo is very basic and simple, for more specific details see the help page.


Siocons alternatives

(TODO - make into new page)

The next important tool after the toolchain is Siocons, which was the application which sent data to the PlayStation.

Siocons almost works in windows' 16-bit support framework called ntvdm, I think the issue is related to how the legacy software accessed the com ports. This means that while it will run, it will not run well and cause a lot of problems.

Also, running Siocons in DOSBOX will have a more or less the same problem, it will run but have issues while communicating over the com port.

Delta Island have a compiled version of DOSBOX called DosBox patch 5n1 but in my testings, I wasn't able to see a difference and can not recommend using Siocons in DOSBOX.

Minicons

Minicons from September 2001, is a win32 Siocons replacement by Graeme Evans. It uses the win32 serial calls which means it works just as fast as the original Siocons on 16bit software. It also functions very close to the original with minor differences, Ctrl-C to exit instead of Esc key.

Linux/Unix

TODO


Emulation

(TODO - Move to it's own page - TODO)

Emulation is very important in the retro development community, and Net Yaroze does benefit from PlayStation emulators. Obviously testing and debugging on original hardware is better, but it's also slower, compared to using emulation. The catch to using emulators is that they're not really built for development, so some emulators are better for developing retro console software then others.

Because Net Yaroze requires a connection to the serial port to connect to the remote debugger, it makes it very difficult (or impossible) to recreate. So I have yet to see any C/C++ step debugging using emulation, the next best thing is output text from printf's statements via the serial port as TTY (Teletypes).

The trick to developing using emulation, is to use and test on as many as possible, here are a few that I use.
The list below is based on my personal experience and ordered in how often I use them.

NO$PSX

NO$PSX

Pro's-
  • Good emulation, with development tools like VRAM viewer and assembly debugger.
  • Doesn't require an ISO - runs self contained executables.
  • Very light on resources, fast and simple emulator.
  • Works in windows XP and newer.

PCSXR

BUGGY, EXPERIMENTAL - DON'T USE!

Net Yaroze custom PCSXR build

Pro's-
  • Supports Net Yaroze CDROM access without creating an ISO.
  • Converts CodeWarrior executables (not the debugging format) into standard PSX executables and runs them.
  • Loads from siocons script or self contained executable.
  • Very light on resources, fast and simple emulator.
  • Works in windows XP and newer.
Con's-
  • Very old and not so great emulation.
  • No TTY output - no printf support.

PCSX-REDUX

Based on the old code but rewritten from scratch.

PCSX-REDUX

Pro's-
  • In active development.
  • Focused on retro game development.
  • Extensive hacking tools, Assembly step debugger, memory viewers, etc.
  • TTY output, GCC Mips-ELF step debugger integration WIP.
  • Doesn't require an ISO - runs self contained executables.
Con's-
  • Requires modern OS.
  • Can be very resource hungry.

Mednafen

Mednafen

Pro's-
  • Aims to be accurate emulation.
  • Works in windows XP and newer.
  • Requires 100% correct CUE/BIN files.
Con's-
  • No self contained executable support.
  • No TTY output - no printf support.
  • Can be very resource hungry.

XEBRA

Has a debug menu option but I couldn't get any TTY out.

XEBRA

Pro's-
  • Aims to be accurate emulation.
  • Requires CUE/BIN files.
  • Very light on resources, fast and simple emulator.
  • Works in windows XP and newer.
Con's-
  • No self contained executable support
  • No TTY output - no printf support



Comments are open.


Your name or alias (required):

Your plain text comment (required):


Your entered name and comment will be displayed above this form.
There is no reply notifications or editing of comments.
Spam, swearing or off topic comments will be removed.

 Enter value: 2103  

Page last modified on January 09, 2024, at 11:28 AM and visited 4188 times.

Powered by PmWiki. No cookies used.