From 11d81b1f436f4f1fc4e5f6e0b952b2df500e76c4 Mon Sep 17 00:00:00 2001 From: Wayne Parham Date: Tue, 15 Jun 2021 16:39:28 -0500 Subject: [PATCH] Stylistic changes --- cfg/sym1-32k.cfg | 54 ++++++++++++++++++------------------ cfg/sym1-4k.cfg | 54 ++++++++++++++++++------------------ cfg/sym1.cfg | 54 ++++++++++++++++++------------------ doc/sym1.sgml | 7 ++--- include/sym1.h | 50 +++++++++++++++++++++++++++------ samples/Makefile | 2 +- samples/helloworld.c | 8 ------ targettest/sym1/Makefile | 14 ++++------ targettest/sym1/symDisplay.c | 23 ++++++++------- targettest/sym1/symIO.c | 36 ++++++++++++------------ targettest/sym1/symNotepad.c | 23 +++++++-------- 11 files changed, 170 insertions(+), 155 deletions(-) delete mode 100644 samples/helloworld.c diff --git a/cfg/sym1-32k.cfg b/cfg/sym1-32k.cfg index ee3bc9d63..ad0d760f3 100644 --- a/cfg/sym1-32k.cfg +++ b/cfg/sym1-32k.cfg @@ -6,41 +6,41 @@ FEATURES { STARTADDRESS: default = $0200; - CONDES: segment = STARTUP, - type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__; - CONDES: segment = STARTUP, - type = destructor, - label = __DESTRUCTOR_TABLE__, - count = __DESTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__; } SYMBOLS { - __STACKSIZE__: type = weak, value = $0200; # 512 byte program stack - __STARTADDRESS__: type = export, value = %S; + __STACKSIZE__: type = weak, value = $0200; # 512 byte program stack + __STARTADDRESS__: type = export, value = %S; } MEMORY { - ZP: file = %O, define = yes, start = $0000, size = $00F7; - CPUSTACK: file = "", define = yes, start = $0100, size = $0100; - RAM: file = %O, define = yes, start = %S, size = $8000 - %S - __STACKSIZE__; - MONROM: file = "", define = yes, start = $8000, size = $1000; - EXT: file = "", define = yes, start = $9000, size = $1000; - IO: file = "", define = yes, start = $A000, size = $1000; - RAE1: file = "", define = yes, start = $B000, size = $1000; - BASROM: file = "", define = yes, start = $C000, size = $1000; - RAE2: file = "", define = yes, start = $E000, size = $1000; - TOP: file = "", define = yes, start = $F000, size = $1000; + ZP: file = %O, define = yes, start = $0000, size = $00F7; + CPUSTACK: file = "", define = yes, start = $0100, size = $0100; + RAM: file = %O, define = yes, start = %S, size = $8000 - %S - __STACKSIZE__; + MONROM: file = "", define = yes, start = $8000, size = $1000; + EXT: file = "", define = yes, start = $9000, size = $1000; + IO: file = "", define = yes, start = $A000, size = $1000; + RAE1: file = "", define = yes, start = $B000, size = $1000; + BASROM: file = "", define = yes, start = $C000, size = $1000; + RAE2: file = "", define = yes, start = $E000, size = $1000; + TOP: file = "", define = yes, start = $F000, size = $1000; } SEGMENTS { - ZEROPAGE: load = ZP, type = zp, define = yes; - STARTUP: load = RAM, type = ro, define = yes; - CODE: load = RAM, type = ro, define = yes; - RODATA: load = RAM, type = ro, define = yes; - ONCE: load = RAM, type = ro, define = yes; - DATA: load = RAM, type = rw, define = yes; - BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro, define = yes; + ONCE: load = RAM, type = ro, define = yes; + DATA: load = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss, define = yes; } diff --git a/cfg/sym1-4k.cfg b/cfg/sym1-4k.cfg index 8570b6077..32d3cbb3a 100644 --- a/cfg/sym1-4k.cfg +++ b/cfg/sym1-4k.cfg @@ -6,41 +6,41 @@ FEATURES { STARTADDRESS: default = $0200; - CONDES: segment = STARTUP, - type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__; - CONDES: segment = STARTUP, - type = destructor, - label = __DESTRUCTOR_TABLE__, - count = __DESTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__; } SYMBOLS { - __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack - __STARTADDRESS__: type = export, value = %S; + __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack + __STARTADDRESS__: type = export, value = %S; } MEMORY { - ZP: file = %O, define = yes, start = $0000, size = $00F7; - CPUSTACK: file = "", define = yes, start = $0100, size = $0100; - RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__; - MONROM: file = "", define = yes, start = $8000, size = $1000; - EXT: file = "", define = yes, start = $9000, size = $1000; - IO: file = "", define = yes, start = $A000, size = $1000; - RAE1: file = "", define = yes, start = $B000, size = $1000; - BASROM: file = "", define = yes, start = $C000, size = $1000; - RAE2: file = "", define = yes, start = $E000, size = $1000; - TOP: file = "", define = yes, start = $F000, size = $1000; + ZP: file = %O, define = yes, start = $0000, size = $00F7; + CPUSTACK: file = "", define = yes, start = $0100, size = $0100; + RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__; + MONROM: file = "", define = yes, start = $8000, size = $1000; + EXT: file = "", define = yes, start = $9000, size = $1000; + IO: file = "", define = yes, start = $A000, size = $1000; + RAE1: file = "", define = yes, start = $B000, size = $1000; + BASROM: file = "", define = yes, start = $C000, size = $1000; + RAE2: file = "", define = yes, start = $E000, size = $1000; + TOP: file = "", define = yes, start = $F000, size = $1000; } SEGMENTS { - ZEROPAGE: load = ZP, type = zp, define = yes; - STARTUP: load = RAM, type = ro, define = yes; - CODE: load = RAM, type = ro, define = yes; - RODATA: load = RAM, type = ro, define = yes; - ONCE: load = RAM, type = ro, define = yes; - DATA: load = RAM, type = rw, define = yes; - BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro, define = yes; + ONCE: load = RAM, type = ro, define = yes; + DATA: load = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss, define = yes; } diff --git a/cfg/sym1.cfg b/cfg/sym1.cfg index 8570b6077..32d3cbb3a 100644 --- a/cfg/sym1.cfg +++ b/cfg/sym1.cfg @@ -6,41 +6,41 @@ FEATURES { STARTADDRESS: default = $0200; - CONDES: segment = STARTUP, - type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__; - CONDES: segment = STARTUP, - type = destructor, - label = __DESTRUCTOR_TABLE__, - count = __DESTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__; + CONDES: segment = STARTUP, + type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__; } SYMBOLS { - __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack - __STARTADDRESS__: type = export, value = %S; + __STACKSIZE__: type = weak, value = $0080; # 128 byte program stack + __STARTADDRESS__: type = export, value = %S; } MEMORY { - ZP: file = %O, define = yes, start = $0000, size = $00F7; - CPUSTACK: file = "", define = yes, start = $0100, size = $0100; - RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__; - MONROM: file = "", define = yes, start = $8000, size = $1000; - EXT: file = "", define = yes, start = $9000, size = $1000; - IO: file = "", define = yes, start = $A000, size = $1000; - RAE1: file = "", define = yes, start = $B000, size = $1000; - BASROM: file = "", define = yes, start = $C000, size = $1000; - RAE2: file = "", define = yes, start = $E000, size = $1000; - TOP: file = "", define = yes, start = $F000, size = $1000; + ZP: file = %O, define = yes, start = $0000, size = $00F7; + CPUSTACK: file = "", define = yes, start = $0100, size = $0100; + RAM: file = %O, define = yes, start = %S, size = $1000 - %S - __STACKSIZE__; + MONROM: file = "", define = yes, start = $8000, size = $1000; + EXT: file = "", define = yes, start = $9000, size = $1000; + IO: file = "", define = yes, start = $A000, size = $1000; + RAE1: file = "", define = yes, start = $B000, size = $1000; + BASROM: file = "", define = yes, start = $C000, size = $1000; + RAE2: file = "", define = yes, start = $E000, size = $1000; + TOP: file = "", define = yes, start = $F000, size = $1000; } SEGMENTS { - ZEROPAGE: load = ZP, type = zp, define = yes; - STARTUP: load = RAM, type = ro, define = yes; - CODE: load = RAM, type = ro, define = yes; - RODATA: load = RAM, type = ro, define = yes; - ONCE: load = RAM, type = ro, define = yes; - DATA: load = RAM, type = rw, define = yes; - BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro, define = yes; + ONCE: load = RAM, type = ro, define = yes; + DATA: load = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss, define = yes; } diff --git a/doc/sym1.sgml b/doc/sym1.sgml index c32fcf2cb..75c44b422 100644 --- a/doc/sym1.sgml +++ b/doc/sym1.sgml @@ -21,7 +21,7 @@ Please note that Sym-1 specific functions are just mentioned here, they are desc Binary format

-The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a popular open-source conversion utility program. A HEX file has ASCII representations of the hexadecimal byte values of the machine-language program. +The output format generated by the linker for the Sym-1 target is a raw binary BIN file, which is essentially a memory image. You can convert this to a HEX file using BIN2HEX, which is a popular open-source conversion utility program. A HEX file has ASCII representations of the hexadecimal byte values of the machine-language program. So the HEX file can be transferred to the Sym-1 using the RS-232 terminal port, just as if the machine-code was entered by hand. Enter 'm 200' in the monitor and start the HEX file transfer.

@@ -98,14 +98,13 @@ This header exposes Sym-specific I/O functions that are useful for reading and w Limited memory applications

-As stated earlier, there are config files for 4KB and 32KB systems. If you have 32KB RAM, then you will probably want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may want to use functions like getchar, putchar, gets and puts rather than printf. Printf requires about 1KB because it needs to know how to process all the format specifiers. +As stated earlier, there are config files for 4KB and 32KB systems. If you have 32KB RAM, then you will probably want to use the sym1-32k configuration, but if not - if you are using the sym1-4k configuration - then you may want to use functions like getchar, putchar, gets and puts rather than functions like scanf and printf. Printf, for example, requires about 1KB because it needs to know how to process all the format specifiers. Sample programs

-All the samples will run on the "stock" 4KB Sym-1, except for symIO and symNotepad, which require 32KB. These sample programs can be found in the samples and targettest/sym1 directories: +All the samples will run on the "stock" 4KB Sym-1, except for symIO and symNotepad, which require 32KB. These sample programs can be found in the targettest/sym1 directory: -helloworld is the traditional "Hello World!" program, using printf(). symHello prints "Hello World!" and then inputs characters, which are echoed on the screen. It also makes a "beep" sound. symTiny does the same as symhello, but does it with puts() rather than printf() to show the difference in compiled binary size. symDisplay allows entry of a message, which is then displayed by scrolling it across the front panel display. diff --git a/include/sym1.h b/include/sym1.h index bedaa7913..e0eb81ecf 100644 --- a/include/sym1.h +++ b/include/sym1.h @@ -1,8 +1,33 @@ -// sym1.h -// -// I/O primitives for Sym-1 -// -// Wayne Parham +/*****************************************************************************/ +/* */ +/* sym1.h */ +/* */ +/* Sym-1 system-specific definitions */ +/* */ +/* */ +/* */ +/* (C) 2020 Wayne Parham */ +/* EMail: wayne@parhamdata.com */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ @@ -122,10 +147,17 @@ struct _display { -void beep (void); // Beep sound -void fdisp (void); // Flash display -int __fastcall__ loadt (unsigned char); // Read from tape (id) -int __fastcall__ dumpt (unsigned char, const void*, const void*); // Write to tape (id, start_addr, end_addr) +void beep (void); +/* Beep sound. */ + +void fdisp (void); +/* Flash display */ + +int __fastcall__ loadt (unsigned char); +/* Read from tape */ + +int __fastcall__ dumpt (unsigned char, const void*, const void*); +/* Write to tape */ diff --git a/samples/Makefile b/samples/Makefile index 32a0086d8..1679b7d96 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -312,7 +312,7 @@ EXELIST_supervision = \ supervisionhello EXELIST_sym1 = \ - helloworld + notavailable EXELIST_telestrat = \ ascii \ diff --git a/samples/helloworld.c b/samples/helloworld.c deleted file mode 100644 index b4e1ee6a3..000000000 --- a/samples/helloworld.c +++ /dev/null @@ -1,8 +0,0 @@ -// Traditional "Hello World" program - -#include - -int main(void) { - printf("Hello, World!\n"); - return 0; -} diff --git a/targettest/sym1/Makefile b/targettest/sym1/Makefile index c8508f1e0..23742f6d1 100644 --- a/targettest/sym1/Makefile +++ b/targettest/sym1/Makefile @@ -1,7 +1,3 @@ -# Run 'make SYS='; or, set a SYS env. -# var. to build for another target system. -SYS ?= sym1 - # Just the usual way to find out if we're # using cmd.exe to execute make rules. ifneq ($(shell echo),) @@ -33,19 +29,19 @@ endif all: symHello.bin symTiny.bin symDisplay.bin symIO.bin symNotepad.bin symHello.bin: symHello.c - $(CL) -t $(SYS) -C sym1-4k.cfg -O -o symHello.bin symHello.c + $(CL) -t sym1 -O -o symHello.bin symHello.c symTiny.bin: symTiny.c - $(CL) -t $(SYS) -C sym1-4k.cfg -O -o symTiny.bin symTiny.c + $(CL) -t sym1 -O -o symTiny.bin symTiny.c symDisplay.bin: symDisplay.c - $(CL) -t $(SYS) -C sym1-4k.cfg -O -o symDisplay.bin symDisplay.c + $(CL) -t sym1 -O -o symDisplay.bin symDisplay.c symIO.bin: symIO.c - $(CL) -t $(SYS) -C sym1-32k.cfg -O -o symIO.bin symIO.c + $(CL) -t sym1 -C sym1-32k.cfg -O -o symIO.bin symIO.c symNotepad.bin: symNotepad.c - $(CL) -t $(SYS) -C sym1-32k.cfg -O -o symNotepad.bin symNotepad.c + $(CL) -t sym1 -C sym1-32k.cfg -O -o symNotepad.bin symNotepad.c clean: @$(DEL) symHello.bin 2>$(NULLDEV) diff --git a/targettest/sym1/symDisplay.c b/targettest/sym1/symDisplay.c index e97518c79..ff9ff90b2 100644 --- a/targettest/sym1/symDisplay.c +++ b/targettest/sym1/symDisplay.c @@ -10,18 +10,18 @@ #include void main (void) { - int delay = 10; - int flashes = 255; + 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 }; + 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" ); @@ -351,6 +351,5 @@ void main (void) { } } } - puts( "\n\nEnjoy your day!\n\n" ); } diff --git a/targettest/sym1/symIO.c b/targettest/sym1/symIO.c index 99b020be2..0b1dee40b 100644 --- a/targettest/sym1/symIO.c +++ b/targettest/sym1/symIO.c @@ -12,24 +12,24 @@ #include void main(void) { - unsigned char ddr1a = 0x00; - unsigned char ior1a = 0x00; - unsigned char ddr1b = 0x00; - unsigned char ior1b = 0x00; - unsigned char ddr2a = 0x00; - unsigned char ior2a = 0x00; - unsigned char ddr2b = 0x00; - unsigned char ior2b = 0x00; - unsigned char ddr3a = 0x00; - unsigned char ior3a = 0x00; - unsigned char ddr3b = 0x00; - unsigned char ior3b = 0x00; - unsigned char val = 0x00; - int going = 0x01; - int instr = 0x01; - int l = 0x00; - char* vp = 0x00; - char cmd[20] = { 0x00 }; + unsigned char ddr1a = 0x00; + unsigned char ior1a = 0x00; + unsigned char ddr1b = 0x00; + unsigned char ior1b = 0x00; + unsigned char ddr2a = 0x00; + unsigned char ior2a = 0x00; + unsigned char ddr2b = 0x00; + unsigned char ior2b = 0x00; + unsigned char ddr3a = 0x00; + unsigned char ior3a = 0x00; + unsigned char ddr3b = 0x00; + unsigned char ior3b = 0x00; + unsigned char val = 0x00; + int going = 0x01; + int instr = 0x01; + int l = 0x00; + char* vp = 0x00; + char cmd[20] = { 0x00 }; while( going ) { diff --git a/targettest/sym1/symNotepad.c b/targettest/sym1/symNotepad.c index c47d1ac98..f2c85756c 100644 --- a/targettest/sym1/symNotepad.c +++ b/targettest/sym1/symNotepad.c @@ -17,18 +17,18 @@ #include #include -#define TAPIO_ADDRESS 0xE000 -#define TAPIO_MAX_SIZE 0x0FFF +#define TAPIO_ADDRESS 0xE000 +#define TAPIO_MAX_SIZE 0x0FFF void main(void) { - char c = 0x00; - int l = 0x00; - int p = 0x00; - int error = 0x00; - int running = 0x01; - int writing = 0x01; - int instruction_needed = 0x01; - int heap_size = 0x00; + cha c = 0x00; + int l = 0x00; + int p = 0x00; + int error = 0x00; + int running = 0x01; + int writing = 0x01; + int instruction_needed = 0x01; + int heap_size = 0x00; char* tapio = (char*) TAPIO_ADDRESS; char* buffer; @@ -183,9 +183,6 @@ void main(void) { } } } - free( buffer ); - puts( "\nEnjoy your day!\n" ); } -