Hello. this is a simple tutorial that intends to help people who are wanting to get started programming casio fx-9860GII-2 with assembly on a linux machine.
The first step which I will be going over(to an extent) is compiling binutils which is compatible with the superH architecture. This is mostly derived from https://www.planet-c...riels.php?id=61
First we will set up our environment and download the binutils archive:
cd /tmp wget ftp://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz tar xJf binutils-2.34.tar.xz -C $HOME/.local/src/ mkdir build-binutils tmp-binutilscd build-binutils$HOME/.local/src/binutils-2.34/configure --prefix=/tmp/tmp-binutils --target=sh3eb-elf --disable-nls --program-prefix=sh-elf-
Now compile and install our binutils under sh-elf-
# -j depend on your system, 24 for me make -j24 MAKEINFO=true make install MAKEINFO=true cp /tmp/tmp-binutils/bin/* $HOME/bin/
Now we can begin fun part:
Go to a directory where your code will go and download this which contains important initialization code
wget https://www.planet-casio.com/storage/forums/bin-12970.zip unzip bin-12970.zip
For this example we will have following code in addin.s:
.section .text .global _main _main: rts mov #1, r0 .end
Now we will use binutils to assemble and link everything together:
sh-elf-as --big --renesas --isa=sh4a-nofpu -o main.o addin.s sh-elf-as --big --renesas --isa=sh4a-nofpu -o crt0.o crt0.s sh-elf-ld -T addin.ld -EB --oformat=binary -o addin.elf main.o crt0.o
And you are done!
Now you can wrap the binary file using the fxg1a tool by Lephenixnoir of planet-casio.com
Somethings to keep in mind:
Addin in example will do nothing because it only returns to main menu.
Binary size needs to be at least 272 byte long for g1a checksum so you will need to the fill rest with 0xFF if the size is smaller.
Thanks for reading,
Edited by hejsotnoss, 22 April 2020 - 06:01 PM.