Synertek Systems Sym-1 machine-specific files

This commit is contained in:
Wayne Parham
2021-05-09 16:34:53 -05:00
parent 07bd5089ec
commit 6e79379405
23 changed files with 2088 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# build.sh
if [ -f $1.c ]; then
echo
echo "--- Building $1 ---"
if [ -f $1.s ]; then
rm $1.s
fi
if [ -f $1.o ]; then
rm $1.o
fi
if [ -f $1.bin ]; then
rm $1.bin
fi
if [ -f $1.hex ]; then
rm $1.hex
fi
cc65 -t sym1 -O $1.c
ca65 $1.s
ld65 -C sym1.cfg -m $1.map -o $1.bin $1.o sym1.lib
if [ -f $1.bin ]; then
bin2hex $1.bin $1.hex > /dev/null 2>&1
fi
if [ -f $1.hex ]; then
echo "--- $1.hex made ---"
else
echo "--- $1.hex FAIL ---"
fi
fi

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# build.sh
if [ -f $1.c ]; then
echo
echo "--- Building $1 ---"
if [ -f $1.s ]; then
rm $1.s
fi
if [ -f $1.o ]; then
rm $1.o
fi
if [ -f $1.bin ]; then
rm $1.bin
fi
if [ -f $1.hex ]; then
rm $1.hex
fi
cc65 -t sym1 -O $1.c
ca65 $1.s
ld65 -C sym1-32k.cfg -m $1.map -o $1.bin $1.o sym1.lib
if [ -f $1.bin ]; then
bin2hex $1.bin $1.hex > /dev/null 2>&1
fi
if [ -f $1.hex ]; then
echo "--- $1.hex made ---"
else
echo "--- $1.hex FAIL ---"
fi
fi

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
#
# build.sh
if [ -f $1.c ]; then
echo
echo "--- Building $1 ---"
if [ -f $1.s ]; then
rm $1.s
fi
if [ -f $1.o ]; then
rm $1.o
fi
if [ -f $1.bin ]; then
rm $1.bin
fi
if [ -f $1.hex ]; then
rm $1.hex
fi
cc65 -t sym1 -O $1.c
ca65 $1.s
ld65 -C sym1-4k.cfg -m $1.map -o $1.bin $1.o sym1.lib
if [ -f $1.bin ]; then
bin2hex $1.bin $1.hex > /dev/null 2>&1
fi
if [ -f $1.hex ]; then
echo "--- $1.hex made ---"
else
echo "--- $1.hex FAIL ---"
fi
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
#
# clean.sh
if [ -f $1.c ]; then
echo
echo "--- Cleaning $1 ---"
rm $1.s $1.o $1.map $1.bin $1.hex > /dev/null 2>&1
echo "--- Cleaned $1 ---"
fi

View File

@@ -0,0 +1,11 @@
These simple build scripts can be used to build any single-file C program
you might write. Notice the diference in the linker line for the 4k build
compared with the 32k build. Small programs can be compiled with either
build script, but they won't run on a 4k machine if compiled for a 32k
system. So if you have a program that's small enough to fit in 4k, it is
probably better to build with the 4k script so it will run on Sym-1 machines
that do not have an expansion memory board.
Usage: build <program> (don't include the .c extension)
clean <program> (removes intermediate and output files)

View File

@@ -0,0 +1,384 @@
// --------------------------------------------------------------------------
// Sym-1 front panel display example
//
// Wayne Parham
//
// wayne@parhamdata.com
// --------------------------------------------------------------------------
#include <symio.h>
void main (void) {
int delay = 10;
int flashes = 255;
int displayable = 1;
int e = 0;
int r = 0;
int d = 0;
int i = 0;
int l = 0;
int t = 0;
int z = 0;
char c = 0x00;
char buffer[41] = { 0x00 };
puts( "\nType a message (40 chars max) and press ENTER, please:\n" );
while( (c != '\r') && (i < 41) ) {
c = getchar();
putchar( c );
buffer[i] = c;
i++;
if( i == 40 ) {
puts( "\n\n--- Reached 40 character limit. ---" );
}
}
i--; // index is one past end
while( z == 0 ) {
puts( "\n\nHow many times (0 for forever) to repeat?" );
c = getchar();
putchar( c );
if( (c >= '0') && (c <= '9') ) { // between 1 and 9 loops allowed
z = 1; // a number was pressed
t = c - '0'; // convert char to int
puts( "\n\nLook at the front panel.\n" );
}
else {
puts( "\nWhat?" );
z = 0; // keep asking for a number
}
}
z = 0;
while( (z < t) || (t == 0) ) {
z++;
putchar( '\r' ); // Send CR to console
set_D0( DISP_SPACE ); // Clear the display
set_D1( DISP_SPACE );
set_D2( DISP_SPACE );
set_D3( DISP_SPACE );
set_D4( DISP_SPACE );
set_D5( DISP_SPACE );
set_D6( DISP_SPACE );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
for( l = 0; l <= i; l++ ) {
displayable = 1; // Assume character is mapped
switch( buffer[l] ) { // Put the typed charaters
case '1': // into the display buffer
set_D6( DISP_1 ); // one at a time
break;
case '2':
set_D6( DISP_2 );
break;
case '3':
set_D6( DISP_3 );
break;
case '4':
set_D6( DISP_4 );
break;
case '5':
set_D6( DISP_5 );
break;
case '6':
set_D6( DISP_6 );
break;
case '7':
set_D6( DISP_7 );
break;
case '8':
set_D6( DISP_8 );
break;
case '9':
set_D6( DISP_9 );
break;
case '0':
set_D6( DISP_0 );
break;
case 'A':
set_D6( DISP_A );
break;
case 'a':
set_D6( DISP_A );
break;
case 'B':
set_D6( DISP_b );
break;
case 'b':
set_D6( DISP_b );
break;
case 'C':
set_D6( DISP_C );
break;
case 'c':
set_D6( DISP_c );
break;
case 'D':
set_D6( DISP_d );
break;
case 'd':
set_D6( DISP_d );
break;
case 'E':
set_D6( DISP_E );
break;
case 'e':
set_D6( DISP_e );
break;
case 'F':
set_D6( DISP_F );
break;
case 'f':
set_D6( DISP_F );
break;
case 'G':
set_D6( DISP_G );
break;
case 'g':
set_D6( DISP_g );
break;
case 'H':
set_D6( DISP_H );
break;
case 'h':
set_D6( DISP_h );
break;
case 'I':
set_D6( DISP_I );
break;
case 'i':
set_D6( DISP_i );
break;
case 'J':
set_D6( DISP_J );
break;
case 'j':
set_D6( DISP_J );
break;
case 'K':
set_D6( DISP_K );
break;
case 'k':
set_D6( DISP_K );
break;
case 'L':
set_D6( DISP_L );
break;
case 'l':
set_D6( DISP_L );
break;
case 'M':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_M_2 );
break;
case 'm':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_M_2 );
break;
case 'N':
set_D6( DISP_n );
break;
case 'n':
set_D6( DISP_n );
break;
case 'O':
set_D6( DISP_O );
break;
case 'o':
set_D6( DISP_o );
break;
case 'P':
set_D6( DISP_P );
break;
case 'p':
set_D6( DISP_P );
break;
case 'Q':
set_D6( DISP_q );
break;
case 'q':
set_D6( DISP_q );
break;
case 'R':
set_D6( DISP_r );
break;
case 'r':
set_D6( DISP_r );
break;
case 'S':
set_D6( DISP_S );
break;
case 's':
set_D6( DISP_S );
break;
case 'T':
set_D6( DISP_t );
break;
case 't':
set_D6( DISP_t );
break;
case 'U':
set_D6( DISP_U );
break;
case 'u':
set_D6( DISP_u );
break;
case 'V':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_V_2 );
break;
case 'v':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_V_2 );
break;
case 'W':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_W_2 );
break;
case 'w':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
set_D6( DISP_M_1 );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
set_D6( DISP_W_2 );
break;
case 'Y':
set_D6( DISP_Y );
break;
case 'y':
set_D6( DISP_Y );
break;
case 'Z':
set_D6( DISP_Z );
break;
case 'z':
set_D6( DISP_Z );
break;
case ' ':
set_D6( DISP_SPACE );
break;
case '.':
set_D6( DISP_PERIOD );
break;
case '-':
set_D6( DISP_HYPHEN );
break;
case '\'':
set_D6( DISP_APOSTR );
break;
case '"':
set_D6( DISP_APOSTR );
break;
case '=':
set_D6( DISP_EQUAL );
break;
case '_':
set_D6( DISP_BOTTOM );
break;
case '/':
set_D6( DISP_SLASH );
break;
case '\\':
set_D6( DISP_BACKSLASH );
break;
default:
displayable = 0; // Character not mapped
}
if( displayable ) {
putchar( buffer[l] ); // Send it to the console
set_D0( get_D1() ); // Scroll to the left
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
}
}
for( e = 0; e < 6; e++ ) { // Gradually fill the
set_D0( get_D1() ); // display with spaces
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_SPACE );
set_D6( DISP_SPACE );
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}
}
}
puts( "\n\nEnjoy your day!\n\n" );
return;
}

View File

@@ -0,0 +1,39 @@
// --------------------------------------------------------------------------
// Hello World for Sym-1
//
// Wayne Parham
//
// wayne@parhamdata.com
// --------------------------------------------------------------------------
#include <symio.h>;
void main(void) {
char c = 0x00;
int d = 0x00;
int l = 0x00;
printf( "\nHello World!\n\n" );
for( l = 0; l < 2; l++ ) {
beep();
for( d = 0; d < 10 ; d++ ) {
}
}
printf( "Type a line and press ENTER, please.\n\n" );
while( c != '\r' ) {
c = getchar();
putchar( c );
}
printf( "\n\nThanks!\n\n" );
for( l = 0; l < 5; l++ ) {
beep();
for( d = 0; d < 10 ; d++ ) {
}
}
return;
}

View File

@@ -0,0 +1,170 @@
// --------------------------------------------------------------------------
// Sym-1 digital I/O interface example
//
// Wayne Parham
//
// wayne@parhamdata.com
// --------------------------------------------------------------------------
#include <stdio.h>;
#include <symio.h>;
#include <stdlib.h>;
#include <string.h>;
void main(void) {
int ddr1a = 0x00;
int ior1a = 0x00;
int ddr1b = 0x00;
int ior1b = 0x00;
int ddr2a = 0x00;
int ior2a = 0x00;
int ddr2b = 0x00;
int ior2b = 0x00;
int ddr3a = 0x00;
int ior3a = 0x00;
int ddr3b = 0x00;
int ior3b = 0x00;
int l = 0x00;
int val = 0x00;
int going = 0x01;
int instr = 0x01;
char* vp = 0x00;
char cmd[20] = { 0x00 };
while( going ) {
putchar( '\r' );
for( l = 0; l < 25; l++ ) {
putchar( '\n' );
}
ddr1a = get_DDR1A();
ior1a = get_IOR1A();
ddr1b = get_DDR1B();
ior1b = get_IOR1B();
ddr2a = get_DDR2A();
ior2a = get_IOR2A();
ddr2b = get_DDR2B();
ior2b = get_IOR2B();
ddr3a = get_DDR3A();
ior3a = get_IOR3A();
ddr3b = get_DDR3B();
ior3b = get_IOR3B();
puts( "================== Digital I/O Status ==================" );
puts( " Port1A Port1B Port2A Port2B Port3A Port3B" );
printf( "DDR %02X %02X %02X %02X %02X %02X\n\r",ddr1a,ddr1b,ddr2a,ddr2b,ddr3a,ddr3b );
printf( "IOR %02X %02X %02X %02X %02X %02X\n\r",ior1a,ior1b,ior2a,ior2b,ior3a,ior3b );
puts( "========================================================\n" );
if( instr ) {
puts( "You can set any register by typing 'register value' so" );
puts( "as an example, to set register IOR2A with the top five" );
puts( "bits off and the bottom three on, type 'IOR2A 07'." );
puts( "Press ENTER without any command to see register values" );
puts( "without changing any of them. Type 'help' to see these" );
puts( "instructions again and type 'stop' to end the program.\n");
puts( "Available registers: DDR1A, IOR1A, DDR1B, IOR1B, DDR2A" );
puts( "IOR2A, DDR2B, IOR2B, DDR3A, IOR3A, DDR3B and IOR3B." );
instr = 0;
}
printf( "\n Command: " );
fgets(cmd, sizeof(cmd)-1, stdin);
cmd[strlen(cmd)-1] = '\0';
if( strncasecmp(cmd, "stop", 4) == 0) {
going = 0;
}
else if( strncasecmp(cmd, "help", 4) == 0) {
instr = 1;
}
else if( strncasecmp(cmd, "ddr1a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR1A( val );
}
}
else if( strncasecmp(cmd, "ior1a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR1A( val );
}
}
else if( strncasecmp(cmd, "ddr1b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR1B( val );
}
}
else if( strncasecmp(cmd, "ior1b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR1B( val );
}
}
else if( strncasecmp(cmd, "ddr2a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR2A( val );
}
}
else if( strncasecmp(cmd, "ior2a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR2A( val );
}
}
else if( strncasecmp(cmd, "ddr2b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR2B( val );
}
}
else if( strncasecmp(cmd, "ior2b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR2B( val );
}
}
else if( strncasecmp(cmd, "ddr3a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR3A( val );
}
}
else if( strncasecmp(cmd, "ior3a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR3A( val );
}
}
else if( strncasecmp(cmd, "ddr3b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR3B( val );
}
}
else if( strncasecmp(cmd, "ior3b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR3B( val );
}
}
}
return;
}

View File

@@ -0,0 +1,42 @@
// --------------------------------------------------------------------------
// Hello World for Sym-1
//
// Uses only getchar, putchar and puts, generating smaller code than printf
//
// Wayne Parham
//
// wayne@parhamdata.com
// --------------------------------------------------------------------------
#include <symio.h>;
void main(void) {
char c = 0x00;
int d = 0x00;
int l = 0x00;
puts( "Hello World!\n" );
puts( "Type a line and press ENTER, please:\n" );
for( l = 0; l < 2; l++ ) {
beep();
for( d = 0; d < 10 ; d++ ) {
}
}
while( c != '\r' ) {
c = getchar();
putchar( c );
}
puts( "\n\nThanks!\n" );
for( l = 0; l < 5; l++ ) {
beep();
for( d = 0; d < 10 ; d++ ) {
}
}
return;
}