This is an old revision of the document!
X68000 Development Tools
Documentation
Most of the standard system calls you will need to use are either doscalls or iocscalls - this refers to whether the system call is handled by DOS (Human68k DOS, of course), or directly by the BIOS/ROM/IPL functions. Some versions of the C compiler provide a standard C library, including a version of newlib in GCC 4.x, but to do anything other than the basic standard functions you'll need to look at the Sharp-specific calls.
Those functions include things like opening devices, setting screen modes, manipulating graphics memory, reading IO ports etc.
Sadly, most X68000 documentation is in Japanese. To find any information on the available system calls you will need to look up the definitions of those functions in either.
Inside / Outside X68000 series
The two main technical manuals for the X68000 are the Inside and Outside series. Inside X68000 deals with mainly software; memory map, system architecture, system calls, IO interfacing etc, and Outside X68000 is mainly hardware interfacing and the electrical side of things.
- Inside X68000: archive.org, local copy
- Outside X68000: archive.org, local copy
Puni docs
The PUNI docs are another source of system information, a bit clearer than the unwieldy several hundred pages of the Inside X68000 book, but not a lot of supporting information or examples.
Note that all of the files are S-JIS encoded, but should translate well on Google. You'll need a text editor that can understand S-JIS encoding though. I can recommend wxMEdit as a good all-round multi-platform hex and text editor with multiple language support.
Here's the full contents of the PUNI documentation.
Filename | Description | Download | Translation |
---|---|---|---|
assembler.rtf | Description of how to use the X68000 assembler, including command line switches. Not directly relevant to anyone using GCC. | assembler.rtf | - |
basicfunc.rtf | X-BASIC external function call list. Not directly relevant to anyone using C. | basicfunc.rtf | - |
bioswork.rtf | Description and sizes of the BIOS/ROM memory locations. | bioswork.rtf | - |
code.rtf | Note sure what this is - a character encoding table?? | code.rtf | - |
condition.rtf | Explanation of the condition bits in status registers resulting from arithmetic operations. | condition.rtf | - |
doscall.rtf | List of the available DOS/Human68k system calls; open file, get character input, allocate memory, etc. | doscall.rtf | - |
fdformat.rtf | Table of the various supported 3.5“ and 5.25” floppy disk formats and their layout (sectors/tracks/heads) etc. | fdformat.rtf | - |
fefunc.rtf | List of the available arithmetic operators, including multiplication and division, and their parameters. | fefunc.rtf | - |
filesystem.rtf | Interfacing with filesystems - e.g. if implementing your own. | filesystem.rtf | - |
fpcall.rtf | Explanation of the various Japanese Kana/Kanji character set functions. | fpcall.rtf | - |
iocscall.rtf | Description of the available low level system calls for interacting with hardware; setting video modes, reading joystick position, playing audio etc. | iocscall.rtf | - |
iomap.rtf | Illustration of the X68000 hardware memory map, size of memory locations and description of the values at those addresses. | iomap.rtf | - |
oswork.rtf | Description of the Human68k working memory area, hooks/trap/vector locations. | oswork.rtf | - |
programmers.rtf | Overview of most memory locations used by application programmers; e.g. description of the video memory registers and their meaning, location of data in SRAM etc. | programmers.rtf | - |
puni.rtf | Japanese document describing the contents of all of these files. | puni.rtf | - |
scsicall.rtf | SCSI interface system call descriptions. | scsicall.rtf | - |
trap.rtf | List of available trap functions; e.g. sound handlers, break/interrupt routines. | trap.rtf | - |
v2func.rtf | Description of new functions available in Human68k v2.0. | v2func.rtf | - |
There is a wiki on Romhacking that has some of the above files partially translated.
GNU Tools
The Lydux toolchain (GCC 4.6.2)
This is a cross-compiler - you run it from Linux and it targets the X68000. So you can use all your modern editors and revision control systems etc. The version of GCC reports as:
human68k-gcc -v Using built-in specs. COLLECT_GCC=/opt/toolchains/x68k/bin/human68k-gcc COLLECT_LTO_WRAPPER=/opt/toolchains/x68k/libexec/gcc/human68k/4.6.2/lto-wrapper Target: human68k Configured with: ../gcc-4.6.2-human68k/configure --prefix=/opt/toolchains/x68k --target=human68k --disable-nls --disable-libssp --with-newlib --without-headers --enable-languages=c --disable-werror : (reconfigured) ../gcc-4.6.2-human68k/configure --prefix=/opt/toolchains/x68k --target=human68k --disable-nls --disable-libssp --with-newlib --without-headers --enable-languages=c --disable-werror Thread model: single gcc version 4.6.2 (GCC)
The project was originally hosted on Github, but was last updated in June 2013; that's a long time ago, but it's still the latest version of GCC available.
Pre-built binaries for Linux:
- GCC 4.6.2 X68000 cross compiler (Linux x86_64 host)
If you want to build the tools from source, here's a handy script that patches them with a required fix before install; you must apply the patch, as there is a bug in this version of GCC which will cause a segfault during compilation otherwise:
- build_x68_gcc.zip - Run the included bash script to configure and patch the source from Github
Using the toolchain:
- Download the archive and extract in /, it unpacks to /opt/toolchains/x68k
- X68000 library functions are defined in:
- /opt/toolchains/x68k/human68k/include/dos.h
- /opt/toolchains/x68k/human68k/include/iocs.h
- Use the sample makefile below
# Names of the compiler and friends APP_BASE = /opt/toolchains/x68k/bin/human68k AS = $(APP_BASE)-as CC = $(APP_BASE)-gcc LD = $(APP_BASE)-ld OBJCOPY = $(APP_BASE)-objcopy STRIP = $(APP_BASE)-strip # libraries and paths LIBS = -ldos -liocs INCLUDES = # Compiler flags ASM_FLAGS = -m68000 --register-prefx-optional LDFLAGS = CFLAGS = -m68000 -std=c99 -fomit-frame-pointer -Wall -Wno-unused-function -Wno-unused-variable -O3 LDSCRIPT = OCFLAGS = -O xfile # What our application is named TARGET = test EXE = $(TARGET).X all: $(EXE) OBJFILES = test.o $(EXE): $(OBJFILES) $(CC) $(LDFLAGS) $(OBJFILES) $(LIBS) -o $(TARGET) $(OBJCOPY) $(OCFLAGS) $(TARGET) $(EXE) sample.o: sample.c $(CC) $(CFLAGS) -c $< -o sample.o clean: rm -f *.o $(EXE) $(TARGET)
One of the problems with this toolchain is that you can't use existing library code from earlier compilers. There are possibly some issues with the assembly syntax as well, there are some details documented on the NFG Games forum: https://nfggames.com/forum2/index.php?topic=4850.0
It's the most modern version of GCC currently available on the X68000 and probably the easiest to use, as long as you are not working on any legacy code or libraries.
Older Versions
I haven't tested any of these, but they have been used at some point by others:
GCC 2.x
GCC 2.95.2
A port of GCC 2.95.2 to run natively on the X68000. So you'll need to compile your code on an emulated or real X68000:
- GCC 2.95.2 Local mirror of the above
GCC 1.x
GCC 1.42
This runs on the X68000 itself, so you'll have to compile your source code from within either a real or emulated X68000 environment:
- GCC 1.42 local mirror of above
These early versions of GCC rely on a different assembler, so you'll also need:
- HAS 309 local mirror of above
GCC 1.30
Another cross compiler toolchain, but this is built for Windows:
- GCC 1.30 local mirror of above
Although this is an old version of GCC, it's a recent package which includes demo source code and some updated documentation put together by users from the NFG Games forum: https://nfggames.com/forum2/index.php?topic=6140.msg42562#msg42562