puts() whitespace style change

This commit is contained in:
Wayne Parham
2021-06-16 16:47:38 -05:00
parent bed61df837
commit 82bdc77e41
5 changed files with 46 additions and 46 deletions

View File

@@ -30,22 +30,22 @@ int main (void) {
buffer[i] = c; buffer[i] = c;
i++; i++;
if( i == 40 ) { if( i == 40 ) {
puts( "\n\n--- Reached 40 character limit. ---" ); puts ("\n\n--- Reached 40 character limit. ---");
} }
} }
i--; // index is one past end i--; // index is one past end
while( z == 0 ) { while( z == 0 ) {
puts( "\n\nHow many times (0 for forever) to repeat?" ); puts ("\n\nHow many times (0 for forever) to repeat?");
c = getchar(); c = getchar();
if( (c >= '0') && (c <= '9') ) { // between 1 and 9 loops allowed if( (c >= '0') && (c <= '9') ) { // between 1 and 9 loops allowed
z = 1; // a number was pressed z = 1; // a number was pressed
t = c - '0'; // convert char to int t = c - '0'; // convert char to int
puts( "\n\nLook at the front panel.\n" ); puts ("\n\nLook at the front panel.\n");
} }
else { else {
puts( "\nWhat?" ); puts ("\nWhat?");
z = 0; // keep asking for a number z = 0; // keep asking for a number
} }
} }
@@ -352,7 +352,7 @@ int main (void) {
} }
} }
puts( "\n\nEnjoy your day!\n\n" ); puts ("\n\nEnjoy your day!\n\n");
return 0; return 0;
} }

View File

@@ -9,7 +9,7 @@
#include <stdio.h> #include <stdio.h>
#include <sym1.h> #include <sym1.h>
int main(void) { int main (void) {
char c = 0x00; char c = 0x00;
int d = 0x00; int d = 0x00;
int l = 0x00; int l = 0x00;

View File

@@ -11,7 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
int main(void) { int main (void) {
unsigned char ddr1a = 0x00; unsigned char ddr1a = 0x00;
unsigned char ior1a = 0x00; unsigned char ior1a = 0x00;
unsigned char ddr1b = 0x00; unsigned char ddr1b = 0x00;
@@ -51,21 +51,21 @@ int main(void) {
ddr3b = VIA3.ddrb; ddr3b = VIA3.ddrb;
ior3b = VIA3.prb; ior3b = VIA3.prb;
puts( "================== Digital I/O Status ==================" ); puts ("================== Digital I/O Status ==================");
puts( " Port1A Port1B Port2A Port2B Port3A Port3B" ); puts (" Port1A Port1B Port2A Port2B Port3A Port3B" );
printf( "DDR %02X %02X %02X %02X %02X %02X\n\r",ddr1a,ddr1b,ddr2a,ddr2b,ddr3a,ddr3b ); 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 ); printf( "IOR %02X %02X %02X %02X %02X %02X\n\r",ior1a,ior1b,ior2a,ior2b,ior3a,ior3b );
puts( "========================================================\n" ); puts ("========================================================\n");
if( instr ) { if( instr ) {
puts( "You can set any register by typing 'register value' so" ); puts ("You can set any register by typing 'register value' so");
puts( "as an example, to set register IOR2A with the top five" ); puts ("as an example, to set register IOR2A with the top five");
puts( "bits off and the bottom three on, type 'IOR2A 07'." ); puts ("bits off and the bottom three on, type 'IOR2A 07'.");
puts( "Press ENTER without any command to see register values" ); puts ("Press ENTER without any command to see register values");
puts( "without changing any of them. Type 'help' to see these" ); puts ("without changing any of them. Type 'help' to see these");
puts( "instructions again and type 'quit' to end the program.\n"); puts ("instructions again and type 'quit' to end the program.\n");
puts( "Available registers: DDR1A, IOR1A, DDR1B, IOR1B, DDR2A" ); puts ("Available registers: DDR1A, IOR1A, DDR1B, IOR1B, DDR2A");
puts( "IOR2A, DDR2B, IOR2B, DDR3A, IOR3A, DDR3B and IOR3B." ); puts ("IOR2A, DDR2B, IOR2B, DDR3A, IOR3A, DDR3B and IOR3B.");
instr = 0; instr = 0;
} }
@@ -166,7 +166,7 @@ int main(void) {
} }
} }
puts( "\n\nEnjoy your day!\n\n" ); puts ("\n\nEnjoy your day!\n\n");
return 0; return 0;
} }

View File

@@ -20,7 +20,7 @@
#define TAPIO_ADDRESS 0xE000 #define TAPIO_ADDRESS 0xE000
#define TAPIO_MAX_SIZE 0x0FFF #define TAPIO_MAX_SIZE 0x0FFF
int main(void) { int main (void) {
char c = 0x00; char c = 0x00;
int l = 0x00; int l = 0x00;
int p = 0x00; int p = 0x00;
@@ -42,7 +42,7 @@ int main(void) {
memset( buffer, 0x00, heap_size ); memset( buffer, 0x00, heap_size );
if( buffer == 0x00 ) { if( buffer == 0x00 ) {
puts( "Memory full." ); puts ("Memory full.");
running = 0; running = 0;
} }
@@ -78,16 +78,16 @@ int main(void) {
putchar( '\n' ); putchar( '\n' );
} }
puts( "===================== Sym-1 Notepad ====================" ); puts ("===================== Sym-1 Notepad ====================");
if( instruction_needed ) { if( instruction_needed ) {
puts( "Enter text and you can save it to tape for reloading" ); puts ("Enter text and you can save it to tape for reloading");
puts( "later. There are four special 'command' characters:\n" ); puts ("later. There are four special 'command' characters:\n");
puts( " Control-S Save to tape" ); puts (" Control-S Save to tape");
puts( " Control-L Load from tape" ); puts (" Control-L Load from tape");
puts( " Control-C Clear memory" ); puts (" Control-C Clear memory");
puts( " Control-X Exit" ); puts (" Control-X Exit");
puts( "========================================================\n" ); puts ("========================================================\n");
} }
while( writing ) { while( writing ) {
@@ -101,18 +101,18 @@ int main(void) {
} }
} }
else if( c == 0x13 ) { // Save else if( c == 0x13 ) { // Save
puts( "\n========================= Save =========================" ); puts ("\n========================= Save =========================");
puts( "\nPress any key to save." ); puts ("\nPress any key to save.");
c = getchar(); c = getchar();
for( l = 0; l <= p; l++ ) { for( l = 0; l <= p; l++ ) {
tapio[l] = buffer[l]; tapio[l] = buffer[l];
} }
l++; l++;
tapio[l] = 0x00; tapio[l] = 0x00;
puts( "Saving to tape." ); puts ("Saving to tape.");
error = dumpt( 'N', tapio, tapio+p ); error = dumpt( 'N', tapio, tapio+p );
if( error ) { if( error ) {
puts( "\nTape error." ); puts ("\nTape error.");
} }
else else
{ {
@@ -121,20 +121,20 @@ int main(void) {
putchar( '\n' ); putchar( '\n' );
} }
} }
puts( "===================== Sym-1 Notepad ====================\n" ); puts ("===================== Sym-1 Notepad ====================\n");
for( l = 0; l <= p; l++ ) { for( l = 0; l <= p; l++ ) {
putchar( buffer[l] ); putchar( buffer[l] );
} }
} }
else if( c == 0x0C ) { // Load else if( c == 0x0C ) { // Load
p = 0; p = 0;
puts( "\nLoading from tape." ); puts ("\nLoading from tape.");
memset( buffer, 0, heap_size ); memset( buffer, 0, heap_size );
memset( tapio, 0, TAPIO_MAX_SIZE ); memset( tapio, 0, TAPIO_MAX_SIZE );
error = loadt( 'N' ); error = loadt( 'N' );
if( error ) { if( error ) {
puts( "\nTape error." ); puts ("\nTape error.");
puts( "===================== Sym-1 Notepad ====================\n" ); puts ("===================== Sym-1 Notepad ====================\n");
} }
else else
{ {
@@ -148,7 +148,7 @@ int main(void) {
for( l = 0; l < 25; l++ ) { for( l = 0; l < 25; l++ ) {
putchar( '\n' ); putchar( '\n' );
} }
puts( "===================== Sym-1 Notepad ====================\n" ); puts ("===================== Sym-1 Notepad ====================\n");
for( l = 0; l <= p; l++ ) { for( l = 0; l <= p; l++ ) {
putchar( buffer[l] ); putchar( buffer[l] );
@@ -162,7 +162,7 @@ int main(void) {
for( l = 0; l < 25; l++ ) { for( l = 0; l < 25; l++ ) {
putchar( '\n' ); putchar( '\n' );
} }
puts( "===================== Sym-1 Notepad ====================\n" ); puts ("===================== Sym-1 Notepad ====================\n");
} }
else if( c == 0x18 ) { // Exit else if( c == 0x18 ) { // Exit
writing = 0; writing = 0;
@@ -170,8 +170,8 @@ int main(void) {
} }
else { else {
if( p >= heap_size - 1 ) { if( p >= heap_size - 1 ) {
puts( "\n========================= End =========================" ); puts ("\n========================= End =========================");
puts( "Buffer full." ); puts ("Buffer full.");
} }
else { else {
if( c == '\n' ) { if( c == '\n' ) {
@@ -186,7 +186,7 @@ int main(void) {
free( buffer ); free( buffer );
puts( "\nEnjoy your day!\n" ); puts ("\nEnjoy your day!\n");
return 0; return 0;
} }

View File

@@ -11,14 +11,14 @@
#include <stdio.h> #include <stdio.h>
#include <sym1.h> #include <sym1.h>
int main(void) { int main (void) {
char c = 0x00; char c = 0x00;
int d = 0x00; int d = 0x00;
int l = 0x00; int l = 0x00;
puts( "Hello World!\n" ); puts ("Hello World!\n");
puts( "Type a line and press ENTER, please:\n" ); puts ("Type a line and press ENTER, please:\n");
for( l = 0; l < 2; l++ ) { for( l = 0; l < 2; l++ ) {
beep(); beep();
@@ -30,7 +30,7 @@ int main(void) {
c = getchar(); c = getchar();
} }
puts( "\n\nThanks!\n" ); puts ("\n\nThanks!\n");
for( l = 0; l < 5; l++ ) { for( l = 0; l < 5; l++ ) {
beep(); beep();