SunPlus released sources for the C compiler. It doesn't include the assembler and is based on GCC 2.95 so quite hard to compile: https://github.com/vsmile-dev/unsp-gcc
Work in progress port of vbcc: http://pulkomandy.tk/gerrit/plugins/gitiles/vbcc/+/refs/heads/unsp
This uses the very latest version of vasm and vlink.
The code generation is unoptimized at the backend level currently. This means the frontend of the compiler can do some general, high level optimizations, but it is not able to make use of any of the CPU advanced features.
See VBCC for info on how to set up a development environment.
Here is a TODO list for optimizations:
POP R1
(end of a sequence using R1 as a scratch register), then PUSH R1
(start of another seauence), then LD R1, …
(actually making use of the register). The POP/PUSH in this case is useless and should be removed. This can be done either at the “peephole” level (after the code has been generated), or by attempting to move “allocreg” and “freereg” ICs (sometimes they are not as close as they should to actual use of the register).XASM is the original assembler provided by the µ'nSP IDE. It uses an unusual syntax compared to assemblers for other systems. For example, an addition to a register is written in this form:
R1 += 7
This is the syntax also used in the MAME debugger and some other disassemblers, but it is not convenient to include in other tools. For this reason, other assemblers use a more standardized syntax.
un-asm implements the original XASM syntax. It is a very simple assembler (no macros, no expression evaluation) but it is usable when you need to have the XASM syntax.
naken_asm has support for µ'nSP and provides a standard include file for SPG200 registers.
This is a simple assembler that directly provides a binary file. It is not possible to use it to generate multiple object files to feed into a linker. But other than that, it is a well-tested and well documented assembler and works reliably.
vasm is a retargettable assembler. It is part of the vbcc compiler suite but usable separately.
It can emit binaries directly, or also generate temporary object files (in its custom vobj format) for use with the vlink linker. This allows to use the assembler in the context of a C compiler toolchain. Of course the assembler can be used standalone or together with the linker as well.
Due to the 16-bit-only addressing of the µ'nSP architecture, several changes were needed in vasm to handle it correctly. This will be released in vasm 2.0 when it is fully tested and stabilized. Until then, vasm with µ'nSP support is available:
git clone http://pulkomandy.tk/gerrit/plugins/gitiles/vasm
and use the unsp branch.This early homebrew experiment took an interesting approach of not using an assembler at all.