Page 1 of 1

My current Sega MD/CD/32X devkit

Posted: Sun May 05, 2019 3:34 pm
by Chilly Willy
I'm posting an arc of the code needed to build my latest toolchain, along with a few examples. All the needed code is included together with a makefile to build everything at once. The toolchain is comprised of

gcc 9.1.0
binutils 2.32
newlib 3.1.0
zasm 3.0.22

Those are all the latest releases other than zasm. That's the last v3 zasm, which I use for assembling z80 code. v4 zasm introduced some changes to the assembler that I haven't bothered updating for, as well as being more of a pain to build. I made a makefile for zasm (since it normally comes set to build in MACOSX), and used the linux config file set for x86-84. If you use MacOS and/or use 32-bit, you'll need to change the config.h file.

To build, make sure your /opt folder can be written by your user. Download this archive and decompress into a folder; note that the file is about 101MB, compressed with 7zip. In a terminal, cd to the directory you decompressed everything to, then enter 'make'. It will create the toolchains directory (if need be) and then the sega directory inside that. It will then build c, c++, obj-c, and obj-c++ compilers for SH2 and 68000, using newlib for the standard c libraries. It will then create a bin directory in toolchains/sega, build zasm, and copy it into that bin directory. It will then copy the bootblocks and ldscripts directories into toolchains/sega. Once it's done, you can clean up the build folder by running 'make clean'. Note that the examples aren't copied into the toolchain.

Once the toolchain is done, you can build the examples to check that everything is working. I included my Yeti3D example, and the C/C++ TicTacToe examples for MD and 32X. All were tested on my system under Xubuntu 18.04 and work fine on real hardware and Fusion 3.64.

Re: My current Sega MD/CD/32X devkit

Posted: Mon Jul 22, 2019 2:14 am
by edenist
Thanks very much for posting this. It's quite simple and elegant.
I have been a longtime user of gendev [SGDK], but I much like your self-contained toolchain.

Note it builds just fine on freebsd, too. The only change is you need to explicitly specify gnu make instead of the default BSD make. The easiest way is just to edit the makefile and

Code: Select all

%s/make /gmake /gc

Re: My current Sega MD/CD/32X devkit

Posted: Mon Jul 22, 2019 1:58 pm
by Chilly Willy
Thanks for posting that. There are plenty of people who use BSD, so I'm sure others may find that handy.

In any case, SGDK is a nice devkit. I contribute to it myself. It's more for people making MD/Genesis games who want/need a lot of functions to control it's many features. To the end, it's great. I work more on 32X, and a bit on SCD, so I tend to not need quite as much MD support, and my devkit and examples reflect that. On 32X stuff, I tend to leave the Z80 reset, and the 68000 runs a tight loop in work ram to a) keep it off the cart as much as possible as bus contention on the cart is the number one source of slowdown on the 32X, and b) having it monitor the communication registers for when the 32X side needs it to do something like read/write the save ram, or update the controller variables.