Stylistic changes

This commit is contained in:
Wayne Parham 2021-06-15 16:39:28 -05:00
parent 4db50e8e93
commit 11d81b1f43
11 changed files with 170 additions and 155 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -21,7 +21,7 @@ Please note that Sym-1 specific functions are just mentioned here, they are desc
<sect>Binary format<p>
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.
<p>
@ -98,14 +98,13 @@ This header exposes Sym-specific I/O functions that are useful for reading and w
<sect2>Limited memory applications<p>
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.
<sect3>Sample programs<p>
All the samples will run on the &quot;stock&quot; 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 &quot;stock&quot; 4KB Sym-1, except for symIO and symNotepad, which require 32KB. These sample programs can be found in the targettest/sym1 directory:
<itemize>
<item>helloworld is the traditional &quot;Hello World!&quot; program, using printf().</item>
<item>symHello prints &quot;Hello World!&quot; and then inputs characters, which are echoed on the screen. It also makes a &quot;beep&quot; sound.</item>
<item>symTiny does the same as symhello, but does it with puts() rather than printf() to show the difference in compiled binary size.</item>
<item>symDisplay allows entry of a message, which is then displayed by scrolling it across the front panel display.</item>

View File

@ -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 */

View File

@ -312,7 +312,7 @@ EXELIST_supervision = \
supervisionhello
EXELIST_sym1 = \
helloworld
notavailable
EXELIST_telestrat = \
ascii \

View File

@ -1,8 +0,0 @@
// Traditional "Hello World" program
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}

View File

@ -1,7 +1,3 @@
# Run 'make SYS=<target>'; 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)

View File

@ -10,18 +10,18 @@
#include <sym1.h>
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" );
}

View File

@ -12,24 +12,24 @@
#include <string.h>
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 ) {

View File

@ -17,18 +17,18 @@
#include <stdlib.h>
#include <string.h>
#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" );
}