How to create user programs for the SPC16/10 SBC

The first step is to assemble the monitor. This makes sure the assembler is working and it generates a file with the externals; the routines in the monitor you might want to call.

The latest version of the assembler is found at https://github.com/josdreesen/SPC16_SBC. It compiles without problem on a linux system with gcc installed.

	gcc p800asm.c -o p800asm

Assembling the monitor is also simple. The default for the assembler is to generate the ROMs. Another product is the externals file 'extern.lbl. Copy this file to the directory with your program, the assembler uses it to fill in the undefined symbols. To assemble programs, I use a small script, so I don't have to remember the useful options:

	#
	ASM=/home/fjkraan/kryten/Programming/crossasm/p800asm/p800asm
	
	FILE=$1
	NOEXT=${FILE%%.*}; echo "$NOEXT"
	rm -f $NOEXT.lst
	$ASM -if $FILE -ihf > $NOEXT.lst
	
	EXIT=$?
	
	if [ "$EXIT" = "1" ] 
	then
	    echo error in assembly
	fi

This script sets the intel-Hex output option, captures output in a .lst file and check if the assembly was succesfull. If not, it prints a message. The real error is in the .lst file. The assembler has some options:

Usage : p800asm -if  [-rom] [-ihf] [-help] 
        [-rom]....create a set of ROM images
        [-ihf]....create Intel Hex file
        [-ihs]....create Intel Hex as Seyon script
        [-log]....echo ASM input on screen
        [-help]...this help text 

This is my first program:

        IDENT helloW
       
        LIST
        AORG    0xC100
HELLOW
        CF      A14,TXTOUT
        DATA    'Hello World!',/0A0D,00
        RTN     A14
        
        END

Uploading to the SBC is a bit of an issue at 19200 Baud. There is no hardware handshake, and it also appears there is no software handshake. Some terminal programs support regulating the speed by inserting delays between characters (see the Seyon option of the assembler), but I used a Python script.

    ?>LReading Intel Hex input..
    C100< F6A1 0248 4865 6C6C 6F20 576F 726C 6421 OK
    C110< 0A0D 0000 F03A 0000 0000 0000 0000 0000 OK
    0020(h) bytes read
    >P
    PTR <-  C100
    ?>GHello World!

The upload method might not be completely regular, but it seems to work:
The normal session from the PC to the SBC board is with PuTTY. Here we type 'L'. Then the Python script sends the data, one character at a time to the same tty-port. It appears that writing to a port already attached to PuTTY is not a problem.

Back to main SPC16/10 page

Last update: 2025-11-08

Email fjkraan@electrickery.nl