Figured out some CRLF differences
This commit is contained in:
@@ -16,12 +16,14 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef __CC65__
|
#ifdef __CC65__
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
#define CRLF "\n"
|
||||||
#else
|
#else
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#define cgetc() (getchar())
|
#define cgetc() (getchar())
|
||||||
#define cputc(c) (putchar(c))
|
#define cputc(c) (putchar(c))
|
||||||
#pragma pack(2)
|
#pragma pack(2)
|
||||||
|
#define CRLF "\r\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Definitions section */
|
/* Definitions section */
|
||||||
@@ -150,45 +152,45 @@ enum EquiErrors {
|
|||||||
void trapout(errcode) {
|
void trapout(errcode) {
|
||||||
if(errcode > 0) {
|
if(errcode > 0) {
|
||||||
if(curtask)
|
if(curtask)
|
||||||
fprintf(stderr, "\nError %d at 0x%x (task 0x%x, instruction %c): ", errcode, curtask->pc, curtask->id, flatram[curtask->pc]);
|
fprintf(stderr, CRLF "Error %d at 0x%x (task 0x%x, instruction %c): ", errcode, curtask->pc, curtask->id, flatram[curtask->pc]);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "\nSystem error %d: ", errcode);
|
fprintf(stderr, CRLF "System error %d: ", errcode);
|
||||||
switch(errcode) {
|
switch(errcode) {
|
||||||
case STACK_OVERFLOW:
|
case STACK_OVERFLOW:
|
||||||
cerr("Stack overflow\n");
|
cerr("Stack overflow" CRLF);
|
||||||
break;
|
break;
|
||||||
case STACK_UNDERFLOW:
|
case STACK_UNDERFLOW:
|
||||||
cerr("Stack underflow\n");
|
cerr("Stack underflow" CRLF);
|
||||||
break;
|
break;
|
||||||
case DIV_BY_ZERO:
|
case DIV_BY_ZERO:
|
||||||
cerr("Division by zero\n");
|
cerr("Division by zero" CRLF);
|
||||||
break;
|
break;
|
||||||
case CLT_OVERFLOW:
|
case CLT_OVERFLOW:
|
||||||
cerr("Compilation lookup table full\n");
|
cerr("Compilation lookup table full" CRLF);
|
||||||
break;
|
break;
|
||||||
case CMD_OVERFLOW:
|
case CMD_OVERFLOW:
|
||||||
cerr("Command buffer full\n");
|
cerr("Command buffer full" CRLF);
|
||||||
break;
|
break;
|
||||||
case INVALID_INSTRUCTION:
|
case INVALID_INSTRUCTION:
|
||||||
cerr("Invalid instruction\n");
|
cerr("Invalid instruction" CRLF);
|
||||||
break;
|
break;
|
||||||
case INVALID_WORD:
|
case INVALID_WORD:
|
||||||
cerr("Word not found in CLT\n");
|
cerr("Word not found in CLT" CRLF);
|
||||||
break;
|
break;
|
||||||
case PORT_IO_ERROR:
|
case PORT_IO_ERROR:
|
||||||
cerr("Port I/O error\n");
|
cerr("Port I/O error" CRLF);
|
||||||
break;
|
break;
|
||||||
case PERSIST_IO_ERROR:
|
case PERSIST_IO_ERROR:
|
||||||
cerr("Persistent storage I/O error\n");
|
cerr("Persistent storage I/O error" CRLF);
|
||||||
break;
|
break;
|
||||||
case RESTRICTED_WRITE_ERROR:
|
case RESTRICTED_WRITE_ERROR:
|
||||||
cerr("Attempt to write to a restricted RAM area\n");
|
cerr("Attempt to write to a restricted RAM area" CRLF);
|
||||||
break;
|
break;
|
||||||
case OUT_OF_BOUNDS_JUMP:
|
case OUT_OF_BOUNDS_JUMP:
|
||||||
cerr("Attempt to jump outside the task context\n");
|
cerr("Attempt to jump outside the task context" CRLF);
|
||||||
break;
|
break;
|
||||||
case TASK_SLOTS_FULL:
|
case TASK_SLOTS_FULL:
|
||||||
cerr("All task slots busy and active\n");
|
cerr("All task slots busy and active" CRLF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(curtask) /* if we're in a task, only terminate it */
|
if(curtask) /* if we're in a task, only terminate it */
|
||||||
@@ -415,7 +417,7 @@ void portIO(ushort port, ushort p2, ushort p1) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "[PORTIO] Unimplemented call to port 0x%X with P1=%X and P2=%X\n", port, p1, p2);
|
fprintf(stderr, "[PORTIO] Unimplemented call to port 0x%X with P1=%X and P2=%X" CRLF, port, p1, p2);
|
||||||
}
|
}
|
||||||
pushMain(r1);
|
pushMain(r1);
|
||||||
pushMain(r2);
|
pushMain(r2);
|
||||||
@@ -742,7 +744,7 @@ int main(int argc, char* argv[]) {
|
|||||||
#else /* VT100-compatible terminal init */
|
#else /* VT100-compatible terminal init */
|
||||||
printf("\033c");
|
printf("\033c");
|
||||||
#endif
|
#endif
|
||||||
printf("Welcome to Equi v" EQUI_VER " by Luxferre, 2022\r\nSystem RAM: %d bytes\r\nEqui ready\r\n\r\n> ", (int) sizeof(ram));
|
printf("Welcome to Equi v" EQUI_VER " by Luxferre, 2022" CRLF "System RAM: %d bytes" CRLF "Equi ready" CRLF CRLF "> ", (int) sizeof(ram));
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) { /* Now, we're in the command mode loop */
|
while(1) { /* Now, we're in the command mode loop */
|
||||||
@@ -770,6 +772,7 @@ int main(int argc, char* argv[]) {
|
|||||||
break; /* and exit the command mode immediately */
|
break; /* and exit the command mode immediately */
|
||||||
} else {
|
} else {
|
||||||
/* if not in II or minification mode, process EOF or Q instruction: trigger interpreter loop */
|
/* if not in II or minification mode, process EOF or Q instruction: trigger interpreter loop */
|
||||||
|
cputc(INS_QUIT);
|
||||||
if(!smode) {
|
if(!smode) {
|
||||||
cputc(CR); /* echo CR */
|
cputc(CR); /* echo CR */
|
||||||
cputc(LF); /* echo LF */
|
cputc(LF); /* echo LF */
|
||||||
|
|||||||
Reference in New Issue
Block a user