mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
Add space after every function or statement, before parenthesis
This commit is contained in:
parent
82bdc77e41
commit
5d90087e66
@ -23,23 +23,23 @@ int main (void) {
|
||||
char c = 0x00;
|
||||
char buffer[41] = { 0x00 };
|
||||
|
||||
puts( "\nType a message (40 chars max) and press ENTER, please:\n" );
|
||||
puts ("\nType a message (40 chars max) and press ENTER, please:\n");
|
||||
|
||||
while( (c != '\n') && (i < 40) ) {
|
||||
while ( (c != '\n') && (i < 40) ) {
|
||||
c = getchar();
|
||||
buffer[i] = c;
|
||||
i++;
|
||||
if( i == 40 ) {
|
||||
if ( i == 40 ) {
|
||||
puts ("\n\n--- Reached 40 character limit. ---");
|
||||
}
|
||||
}
|
||||
|
||||
i--; // index is one past end
|
||||
|
||||
while( z == 0 ) {
|
||||
while ( z == 0 ) {
|
||||
puts ("\n\nHow many times (0 for forever) to repeat?");
|
||||
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
|
||||
t = c - '0'; // convert char to int
|
||||
puts ("\n\nLook at the front panel.\n");
|
||||
@ -51,11 +51,11 @@ int main (void) {
|
||||
}
|
||||
|
||||
z = 0;
|
||||
while( (z < t) || (t == 0) ) {
|
||||
while ( (z < t) || (t == 0) ) {
|
||||
|
||||
z++;
|
||||
|
||||
putchar( '\r' ); // Send CR to console
|
||||
putchar ( '\r' ); // Send CR to console
|
||||
|
||||
DISPLAY.d0 = DISP_SPACE; // Clear the display
|
||||
DISPLAY.d1 = DISP_SPACE;
|
||||
@ -65,15 +65,15 @@ int main (void) {
|
||||
DISPLAY.d5 = DISP_SPACE;
|
||||
DISPLAY.d6 = DISP_SPACE;
|
||||
|
||||
for( d = 0; d < flashes ; d++ ) {
|
||||
for ( d = 0; d < flashes ; d++ ) {
|
||||
fdisp(); // Display
|
||||
}
|
||||
|
||||
for( l = 0; l <= i; l++ ) {
|
||||
for ( l = 0; l <= i; l++ ) {
|
||||
|
||||
displayable = 1; // Assume character is mapped
|
||||
|
||||
switch( buffer[l] ) { // Put the typed charaters
|
||||
switch ( buffer[l] ) { // Put the typed charaters
|
||||
case '1': // into the display buffer
|
||||
DISPLAY.d6 = DISP_1; // one at a time
|
||||
break;
|
||||
@ -321,9 +321,9 @@ int main (void) {
|
||||
displayable = 0; // Character not mapped
|
||||
}
|
||||
|
||||
if( displayable ) {
|
||||
if ( displayable ) {
|
||||
|
||||
putchar( buffer[l] ); // Send it to the console
|
||||
putchar ( buffer[l] ); // Send it to the console
|
||||
|
||||
DISPLAY.d0 = DISPLAY.d1; // Scroll to the left
|
||||
DISPLAY.d1 = DISPLAY.d2;
|
||||
@ -332,13 +332,13 @@ int main (void) {
|
||||
DISPLAY.d4 = DISPLAY.d5;
|
||||
DISPLAY.d5 = DISPLAY.d6;
|
||||
|
||||
for( d = 0; d < flashes ; d++ ) {
|
||||
for ( d = 0; d < flashes ; d++ ) {
|
||||
fdisp(); // Display
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( e = 0; e < 6; e++ ) { // Gradually fill the
|
||||
for ( e = 0; e < 6; e++ ) { // Gradually fill the
|
||||
DISPLAY.d0 = DISPLAY.d1; // display with spaces
|
||||
DISPLAY.d1 = DISPLAY.d2;
|
||||
DISPLAY.d2 = DISPLAY.d3;
|
||||
@ -346,7 +346,7 @@ int main (void) {
|
||||
DISPLAY.d4 = DISPLAY.d5;
|
||||
DISPLAY.d5 = DISP_SPACE;
|
||||
DISPLAY.d6 = DISP_SPACE;
|
||||
for( d = 0; d < flashes ; d++ ) {
|
||||
for ( d = 0; d < flashes ; d++ ) {
|
||||
fdisp(); // Display
|
||||
}
|
||||
}
|
||||
|
@ -14,24 +14,24 @@ int main (void) {
|
||||
int d = 0x00;
|
||||
int l = 0x00;
|
||||
|
||||
printf( "\nHello World!\n\n" );
|
||||
printf ("\nHello World!\n\n");
|
||||
|
||||
for( l = 0; l < 2; l++ ) {
|
||||
for ( l = 0; l < 2; l++ ) {
|
||||
beep();
|
||||
for( d = 0; d < 10 ; d++ ) {
|
||||
for ( d = 0; d < 10 ; d++ ) {
|
||||
}
|
||||
}
|
||||
printf( "Type a line and press ENTER, please.\n\n" );
|
||||
printf ("Type a line and press ENTER, please.\n\n");
|
||||
|
||||
while( c != '\n' ) {
|
||||
while ( c != '\n' ) {
|
||||
c = getchar();
|
||||
}
|
||||
|
||||
printf( "\n\nThanks!\n\n" );
|
||||
printf ("\n\nThanks!\n\n");
|
||||
|
||||
for( l = 0; l < 5; l++ ) {
|
||||
for ( l = 0; l < 5; l++ ) {
|
||||
beep();
|
||||
for( d = 0; d < 10 ; d++ ) {
|
||||
for ( d = 0; d < 10 ; d++ ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,11 +31,11 @@ int main (void) {
|
||||
char* vp = 0x00;
|
||||
char cmd[20] = { 0x00 };
|
||||
|
||||
while( going ) {
|
||||
while ( going ) {
|
||||
|
||||
putchar( '\r' );
|
||||
for( l = 0; l < 25; l++ ) {
|
||||
putchar( '\n' );
|
||||
putchar ( '\r' );
|
||||
for ( l = 0; l < 25; l++ ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
|
||||
ddr1a = VIA1.ddra;
|
||||
@ -53,11 +53,11 @@ int main (void) {
|
||||
|
||||
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 );
|
||||
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 ) {
|
||||
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'.");
|
||||
@ -69,97 +69,97 @@ int main (void) {
|
||||
instr = 0;
|
||||
}
|
||||
|
||||
printf( "\n Command: " );
|
||||
printf ("\n Command: ");
|
||||
|
||||
fgets(cmd, sizeof(cmd)-1, stdin);
|
||||
fgets ( cmd, sizeof(cmd)-1, stdin );
|
||||
cmd[strlen(cmd)-1] = '\0';
|
||||
|
||||
if( strncasecmp(cmd, "quit", 4) == 0) {
|
||||
if ( strncasecmp(cmd, "quit", 4) == 0 ) {
|
||||
going = 0;
|
||||
}
|
||||
else if( strncasecmp(cmd, "help", 4) == 0) {
|
||||
else if ( strncasecmp(cmd, "help", 4) == 0 ) {
|
||||
instr = 1;
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr1a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr1a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA1.ddra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior1a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior1a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA1.pra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr1b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr1b", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA1.ddrb = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior1b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior1b", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA1.prb = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr2a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr2a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA2.ddra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior2a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior2a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA2.pra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr2b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr2b", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA2.ddrb = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior2b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior2b", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA2.prb = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr3a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr3a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA3.ddra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior3a", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior3a", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA3.pra = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ddr3b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ddr3b", 5) == 0 ) {
|
||||
vp = strchr ( cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA3.ddrb = val;
|
||||
}
|
||||
}
|
||||
else if( strncasecmp(cmd, "ior3b", 5) == 0) {
|
||||
vp = strchr(cmd, ' ');
|
||||
if( vp ) {
|
||||
else if ( strncasecmp(cmd, "ior3b", 5) == 0 ) {
|
||||
vp = strchr (cmd, ' ' );
|
||||
if ( vp ) {
|
||||
val = (unsigned char) strtol( vp, NULL, 0 );
|
||||
VIA3.prb = val;
|
||||
}
|
||||
|
@ -34,53 +34,53 @@ int main (void) {
|
||||
|
||||
heap_size = _heapmaxavail();
|
||||
|
||||
if( heap_size > TAPIO_MAX_SIZE ) { // No need to malloc more than
|
||||
if ( heap_size > TAPIO_MAX_SIZE ) { // No need to malloc more than
|
||||
heap_size = TAPIO_MAX_SIZE; // the interface allows
|
||||
}
|
||||
|
||||
buffer = malloc( heap_size );
|
||||
memset( buffer, 0x00, heap_size );
|
||||
buffer = malloc ( heap_size );
|
||||
memset ( buffer, 0x00, heap_size );
|
||||
|
||||
if( buffer == 0x00 ) {
|
||||
if ( buffer == 0x00 ) {
|
||||
puts ("Memory full.");
|
||||
running = 0;
|
||||
}
|
||||
|
||||
tapio[0] = 0x00; // Check tape interface memory
|
||||
if( tapio[0] != 0x00 )
|
||||
if ( tapio[0] != 0x00 )
|
||||
error = 1;
|
||||
|
||||
tapio[0] = 0xFF;
|
||||
if( tapio[0] != 0xFF )
|
||||
if ( tapio[0] != 0xFF )
|
||||
error = 1;
|
||||
|
||||
tapio[TAPIO_MAX_SIZE] = 0x00;
|
||||
if( tapio[TAPIO_MAX_SIZE] != 0x00 )
|
||||
if ( tapio[TAPIO_MAX_SIZE] != 0x00 )
|
||||
error = 1;
|
||||
|
||||
tapio[TAPIO_MAX_SIZE] = 0xFF;
|
||||
if( tapio[TAPIO_MAX_SIZE] != 0xFF )
|
||||
if ( tapio[TAPIO_MAX_SIZE] != 0xFF )
|
||||
error = 1;
|
||||
|
||||
if( error ) {
|
||||
printf( "\nNo memory at location %p, aborting.\n", tapio );
|
||||
if ( error ) {
|
||||
printf ("\nNo memory at location %p, aborting.\n", tapio);
|
||||
running = 0;
|
||||
}
|
||||
else {
|
||||
memset( tapio, 0, TAPIO_MAX_SIZE );
|
||||
memset ( tapio, 0, TAPIO_MAX_SIZE );
|
||||
}
|
||||
|
||||
|
||||
while( running ) {
|
||||
while ( running ) {
|
||||
|
||||
putchar( '\r' );
|
||||
for( l = 0; l < 25; l++ ) {
|
||||
putchar( '\n' );
|
||||
putchar ( '\r' );
|
||||
for ( l = 0; l < 25; l++ ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
|
||||
puts ("===================== Sym-1 Notepad ====================");
|
||||
|
||||
if( instruction_needed ) {
|
||||
if ( instruction_needed ) {
|
||||
puts ("Enter text and you can save it to tape for reloading");
|
||||
puts ("later. There are four special 'command' characters:\n");
|
||||
puts (" Control-S Save to tape");
|
||||
@ -90,92 +90,92 @@ int main (void) {
|
||||
puts ("========================================================\n");
|
||||
}
|
||||
|
||||
while( writing ) {
|
||||
while ( writing ) {
|
||||
|
||||
c = getchar();
|
||||
|
||||
if( c == 0x08 ) { // Backspace
|
||||
if( p > 0 ) {
|
||||
if ( c == 0x08 ) { // Backspace
|
||||
if ( p > 0 ) {
|
||||
buffer[p] = 0x00;
|
||||
p--;
|
||||
}
|
||||
}
|
||||
else if( c == 0x13 ) { // Save
|
||||
else if ( c == 0x13 ) { // Save
|
||||
puts ("\n========================= Save =========================");
|
||||
puts ("\nPress any key to save.");
|
||||
c = getchar();
|
||||
for( l = 0; l <= p; l++ ) {
|
||||
for ( l = 0; l <= p; l++ ) {
|
||||
tapio[l] = buffer[l];
|
||||
}
|
||||
l++;
|
||||
tapio[l] = 0x00;
|
||||
puts ("Saving to tape.");
|
||||
error = dumpt( 'N', tapio, tapio+p );
|
||||
if( error ) {
|
||||
error = dumpt ( 'N', tapio, tapio+p );
|
||||
if ( error ) {
|
||||
puts ("\nTape error.");
|
||||
}
|
||||
else
|
||||
{
|
||||
putchar( '\r' );
|
||||
for( l = 0; l < 25; l++ ) {
|
||||
putchar( '\n' );
|
||||
putchar ( '\r' );
|
||||
for ( l = 0; l < 25; l++ ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
}
|
||||
puts ("===================== Sym-1 Notepad ====================\n");
|
||||
for( l = 0; l <= p; l++ ) {
|
||||
putchar( buffer[l] );
|
||||
for ( l = 0; l <= p; l++ ) {
|
||||
putchar ( buffer[l] );
|
||||
}
|
||||
}
|
||||
else if( c == 0x0C ) { // Load
|
||||
else if ( c == 0x0C ) { // Load
|
||||
p = 0;
|
||||
puts ("\nLoading from tape.");
|
||||
memset( buffer, 0, heap_size );
|
||||
memset( tapio, 0, TAPIO_MAX_SIZE );
|
||||
error = loadt( 'N' );
|
||||
if( error ) {
|
||||
memset ( buffer, 0, heap_size );
|
||||
memset ( tapio, 0, TAPIO_MAX_SIZE );
|
||||
error = loadt ( 'N' );
|
||||
if ( error ) {
|
||||
puts ("\nTape error.");
|
||||
puts ("===================== Sym-1 Notepad ====================\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
for( l = 0; l <= heap_size; l++ ) {
|
||||
for ( l = 0; l <= heap_size; l++ ) {
|
||||
buffer[l] = tapio[l];
|
||||
}
|
||||
|
||||
p = strlen( buffer );
|
||||
p = strlen ( buffer );
|
||||
|
||||
putchar( '\r' );
|
||||
for( l = 0; l < 25; l++ ) {
|
||||
putchar( '\n' );
|
||||
putchar ( '\r' );
|
||||
for ( l = 0; l < 25; l++ ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
puts ("===================== Sym-1 Notepad ====================\n");
|
||||
|
||||
for( l = 0; l <= p; l++ ) {
|
||||
putchar( buffer[l] );
|
||||
for ( l = 0; l <= p; l++ ) {
|
||||
putchar ( buffer[l] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( c == 0x03 ) { // Clear
|
||||
else if ( c == 0x03 ) { // Clear
|
||||
p = 0;
|
||||
memset( buffer, 0, heap_size );
|
||||
putchar( '\r' );
|
||||
for( l = 0; l < 25; l++ ) {
|
||||
putchar( '\n' );
|
||||
memset ( buffer, 0, heap_size );
|
||||
putchar ( '\r' );
|
||||
for ( l = 0; l < 25; l++ ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
puts ("===================== Sym-1 Notepad ====================\n");
|
||||
}
|
||||
else if( c == 0x18 ) { // Exit
|
||||
else if ( c == 0x18 ) { // Exit
|
||||
writing = 0;
|
||||
running = 0;
|
||||
}
|
||||
else {
|
||||
if( p >= heap_size - 1 ) {
|
||||
if ( p >= heap_size - 1 ) {
|
||||
puts ("\n========================= End =========================");
|
||||
puts ("Buffer full.");
|
||||
}
|
||||
else {
|
||||
if( c == '\n' ) {
|
||||
putchar( '\n' );
|
||||
if ( c == '\n' ) {
|
||||
putchar ( '\n' );
|
||||
}
|
||||
buffer[p] = c;
|
||||
}
|
||||
@ -184,7 +184,7 @@ int main (void) {
|
||||
}
|
||||
}
|
||||
|
||||
free( buffer );
|
||||
free ( buffer );
|
||||
|
||||
puts ("\nEnjoy your day!\n");
|
||||
|
||||
|
@ -20,21 +20,21 @@ int main (void) {
|
||||
|
||||
puts ("Type a line and press ENTER, please:\n");
|
||||
|
||||
for( l = 0; l < 2; l++ ) {
|
||||
for ( l = 0; l < 2; l++ ) {
|
||||
beep();
|
||||
for( d = 0; d < 10 ; d++ ) {
|
||||
for ( d = 0; d < 10 ; d++ ) {
|
||||
}
|
||||
}
|
||||
|
||||
while( c != '\n' ) {
|
||||
while ( c != '\n' ) {
|
||||
c = getchar();
|
||||
}
|
||||
|
||||
puts ("\n\nThanks!\n");
|
||||
|
||||
for( l = 0; l < 5; l++ ) {
|
||||
for ( l = 0; l < 5; l++ ) {
|
||||
beep();
|
||||
for( d = 0; d < 10 ; d++ ) {
|
||||
for ( d = 0; d < 10 ; d++ ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user