X68000 programming, chapter 2.1 setting up the IDE, Lydux flavour

Following with this series of articles about the Sharp X68000, I’m going to show how to install the programming environment and our ever “hello World”.

First of all, to talk about the Cross-Human68K toolchain which are the libraries and tools that we’ll use to produce executables in the Human68K and to give credit to its author Lydux, member of the forum https://nfggames.com and published on 30th of April of 2012 and that can be found at https://nfggames.com/forum2/index.php?topic=4850.0

This is going to be a transcription of that post in https://nfggames.com

Lydux’s github is https://github.com/Lydux

Downloading the packages needed:

Following his instructions for Windows we have to download Code::Blocks from http://www.codeblocks.org

And the different packages of the toolchain from the following urls:

Binutils-2.22http://nfggames.com/X68000/Development/toolchain/binutils-2.21-human68k-win32-3.zip
GCC-4.6.2http://nfggames.com/X68000/Development/toolchain/gcc-4.6.2-human68k-win32-1.zip
Newlib-1.4.0http://nfggames.com/X68000/Development/libraries/newlib-1.19.0-human68k-1.zip
Make-3.82http://nfggames.com/X68000/Development/toolchain/make-3.82.zip
Human68K wizard for Code::Blockshttp://nfggames.com/X68000/Development/toolchain/codeblocks-wizard-human68k-1.zip

Installing the toolchain:

If you still don’t have the Code::Blocks installed you install it obviously. Once installed you open it up.

Now go the “Settings → Compiler and debugger” menu.

Make a copy of the “GNU GCC Compiler” which presumably will be selected by default and press the button Copy.

Name the new compiler “Human68K GCC”.

Now go to the tab “Toolchain executables” and change the values as in the image below.

There is where you set the path where you decompressed the toolchain.

Another thing you may need is to remove any optimization flag that is for PC in the “Compiler settings” tab.

Adding a project template of Human68K in Code::Blocks:

Finally we’re going to make Code::Blocks give us the option to create a X68000 project so that we don’t need to configure the compiler each time.

In order to do that we are going to unzip the codeblocks-wizard-human68k-1.zip file in the folder C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard and edit the file C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\config.script

And inside the block function RegisterWizards(){} we are going to search for some lines like these:

RegisterWizard(wizProject, _T("arm"), _T("ARM Project"), _T("Embedded Systems"));
RegisterWizard(wizProject, _T("avr"), _T("AVR Project"), _T("Embedded Systems"));
RegisterWizard(wizProject, _T("tricore"), _T("TriCore Project"), _T("Embedded Systems"));
RegisterWizard(wizProject, _T("ppc"), _T("PowerPC Project"), _T("Embedded Systems"));

And to add the following line:

RegisterWizard(wizProject, _T("human68k"), _T("Human68K Project"), _T("Embedded Systems"));

Note:

There are reports from people whose executable isn’t well generated. Although it isn’t my case the solution they suggest is to edit the file:

C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\human68k\wizard.script

and inside function SetupProject(project) to change the next line:

oc_x = _T("human68k-objcopy -O xfile $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).X");

for this other:

oc_x = _T("human68k-objcopy -v -O xfile $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).X");

Now you can save the file and create a new project in Code::Blocks and select the template “Human68K Project”

When creating the project you’ll have an easy “hello world” which you can compile and that will build a .X file in the subfolder “default” inside your project.

Installing the emulator:

Presumably you will need an emulator. You can find one here: http://www.gametronik.com/site/emulation/sharp_x68000/

I use the XM6 Pro-68k which is top list.

With the emulator you will also need an operating system. You can find one in https://nfggames.com/X68000/index.php/OperatingSystems/Human68k/

The one I use is Human 68k v3.02 (1993)(Sharp – Hudson)[a].zip

Then you install the emulator and unzip the operating system somewhere.

The file with the operating system has the extension .dim and it represents a disk floppy or a Hard disk.

Every time that the emulator starts you have to mount the operating system in one disk drive as in the picture.

For convenience’s sake you can make a shortcut to start the emulator with the operating system’s disk mounted with this command:

"C:\X68000\XM6 Pro-68k Release 30 (210225)\XM6.exe" "Human 68k v3.02 (1993)(Sharp – Hudson)[a].dim" 

Or wherever you have placed the emulator and the operating system.

In order to test the program we compiled earlier with the Hello World we need to mount the folder where the executable is as it were a floppy disk.

For that in the menu Floppy Drive #1 select Insert directory…

and now look for the folder “default” in your project folder:

Lastly go to unit B in the same manner you would in MS-DOS, with B:

You’ll need to find the colon in your keyboard because it doesn’t correspond to it.

If you run the command dir you’ll see the files you have in the folder you just mounted.

Like in the picture, among them is the executable file we compiled HelloWorld.X

Now we just have to run it with HelloWorld.

With this we have now our environment ready to make our first programs in the Sharp X68000.

In next articles I’ll explain how to do more interesting things.

In my GitHub you can find some example about which those articles will be about.

https://github.com/FedericoTech/X68KTutorials

Enjoy.

Leave a comment