diff --git a/build.bat b/build.bat index 2087411..61877f8 100644 --- a/build.bat +++ b/build.bat @@ -1,37 +1,25 @@ @echo off -cls del /S/Q target rd target md target cd src\samples -rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-sample.c -o ..\..\target\u-sample.prg -rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-menu.c -o ..\..\target\u-menu.prg -rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-shell.c -o ..\..\target\u-shell.prg -rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat64.prg -rem cl65 -O -t c64 ..\lib\ultimate_lib.c u-echoserver.c -o ..\..\target\u-echoserver.prg +cl65 -O -t c64 ..\lib\ultimate_lib.c u-sample.c -o ..\..\target\u-sample.prg +cl65 -O -t c64 ..\lib\ultimate_lib.c u-menu.c -o ..\..\target\u-menu.prg +cl65 -O -t c64 ..\lib\ultimate_lib.c u-shell.c -o ..\..\target\u-shell.prg +cl65 -O -t c64 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat64.prg +cl65 -O -t c64 ..\lib\ultimate_lib.c u-echoserver.c -o ..\..\target\u-echoserver.prg cl65 -O -t c64 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term64.prg -rem cl65 -O -t c128 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term128.prg -rem cl65 -O -t c128 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat128.prg -rem cl65 -t geos-cbm -O -o ..\..\target\geouterm.cvt geouterm-res.grc ..\lib\ultimate_lib.c geouterm.c +cl65 -O -t c128 ..\lib\ultimate_lib.c screen_utility.c ultimateterm.c -o ..\..\target\u-term128.prg +cl65 -O -t c128 ..\lib\ultimate_lib.c u-chat.c -o ..\..\target\u-chat128.prg +cl65 -t geos-cbm -O -o ..\..\target\geouterm.cvt geouterm-res.grc ..\lib\ultimate_lib.c geouterm.c -cd ..\.. - -choice /c yn /n /m "Run on Ultimate64 Yes, No?" -if %ERRORLEVEL% == 2 exit /b - -u64remote 192.168.7.64 reset -u64remote 192.168.7.64 run target\u-term64.prg - - -exit /b +petcat -w2 -o ..\..\target\loader.prg loader.bas del *.o del ..\lib\*.o -petcat -w2 -o ..\..\target\loader.prg loader.bas - cd ..\..\target c1541 -format "ultimatedemos,sh" d64 UltimateTerm-and-demos.d64 @@ -53,4 +41,4 @@ c1541 -attach UltimateTerm-and-demos.d64 -write ..\src\samples\u-term.seq u-term del /Q geouterm.cvt del /Q loader.prg - +cd .. diff --git a/src/lib/ultimate_lib.c b/src/lib/ultimate_lib.c index a7a5640..3b90541 100644 --- a/src/lib/ultimate_lib.c +++ b/src/lib/ultimate_lib.c @@ -20,9 +20,9 @@ static unsigned char *statusreg = (unsigned char *)STATUS_REG; static unsigned char *respdatareg = (unsigned char *)RESP_DATA_REG; static unsigned char *statusdatareg = (unsigned char *)STATUS_DATA_REG; -unsigned char uii_status[STATUS_QUEUE_SZ]; -unsigned char uii_data[DATA_QUEUE_SZ*2]; -unsigned char temp_string_onechar[2]; +char uii_status[STATUS_QUEUE_SZ]; +char uii_data[DATA_QUEUE_SZ*2]; +char temp_string_onechar[2]; int uii_data_index; int uii_data_len; diff --git a/src/lib/ultimate_lib.h b/src/lib/ultimate_lib.h index 97d363c..6b2339f 100644 --- a/src/lib/ultimate_lib.h +++ b/src/lib/ultimate_lib.h @@ -89,8 +89,8 @@ Patches and pull requests are welcome #define uii_success() (uii_status[0] == '0' && uii_status[1] == '0') -extern unsigned char uii_status[STATUS_QUEUE_SZ]; -extern unsigned char uii_data[DATA_QUEUE_SZ*2]; +extern char uii_status[STATUS_QUEUE_SZ]; +extern char uii_data[DATA_QUEUE_SZ*2]; struct DirectoryEntry { unsigned char attributes; diff --git a/src/samples/geouterm.c b/src/samples/geouterm.c index a72ab0a..8def21c 100644 --- a/src/samples/geouterm.c +++ b/src/samples/geouterm.c @@ -42,8 +42,8 @@ unsigned char cx,cy; unsigned char socketnr = 0; int datacount = 0; char buff[2] = {0,0}; -unsigned char fontbuff40[1000]; -unsigned char fontbuff80[600]; +char fontbuff40[1000]; +char fontbuff80[600]; char host[80]; char portbuf[9]; unsigned short port; @@ -78,7 +78,7 @@ void loadFonts() void clearTerminal(unsigned char fontsize) { - unsigned char *s = " GeoUTerm "; + char *s = " GeoUTerm "; unsigned short hdrY = 0; if ((osType & GEOS64) == GEOS64) // c64 @@ -218,8 +218,8 @@ void handle_io(void) unsigned char ch = 0; unsigned char x = 0; unsigned char t = 0; - unsigned char *dat; - unsigned char buf[3]; + char *dat; + char buf[3]; #ifdef TESTING return; @@ -400,7 +400,7 @@ void switch4080(void) SetNewMode(); set40col(); - DoMenu(&mainMenu); + DoMenu((struct menu *)&mainMenu); } void main(void) @@ -418,20 +418,20 @@ void main(void) { DlgBoxOk ("GeoUTerm v1.0", "Commodore 128 40 column mode"); set40col(); - DoMenu(&mainMenu); + DoMenu((struct menu *)&mainMenu); } else { DlgBoxOk ("GeoUTerm v1.0", "Commodore 128 80 column mode"); set40col(); - DoMenu(&mainMenu); + DoMenu((struct menu *)&mainMenu); } } else { DlgBoxOk ("GeoUTerm v1.0", "For the Commodore 64"); set40col(); - DoMenu(&mainMenu); + DoMenu((struct menu *)&mainMenu); } #ifndef TESTING diff --git a/src/samples/u-chat.c b/src/samples/u-chat.c index 26601ac..83df144 100644 --- a/src/samples/u-chat.c +++ b/src/samples/u-chat.c @@ -61,7 +61,7 @@ void irc_updateheader(char *chan); void irc_login(void); void irc_refreshscreen(void); void irc_print(char *buf, int newlineflg); -void irc_pong(unsigned char *buf); +void irc_pong(char *buf); void irc_help(void); void irc_handleinput(char *buf); void getconfig(void); @@ -193,7 +193,7 @@ void irc_login(void) // Handle IRC login procedures char USER_STRING[128]; char *chan; - chan = (unsigned char*) malloc(50 * sizeof(unsigned char)); + chan = (char*) malloc(50 * sizeof(unsigned char)); sprintf(NICK_STRING, "nick %s\r\n", nick); // NICK user sprintf(USER_STRING, "user %s * 0 :%s\r\n", nick, strlen(realname) == 0 ? nick : realname); // USER user * 0 :Real name @@ -347,7 +347,7 @@ void irc_print(char *buf, int newlineflg) } -void irc_pong(unsigned char *buf) +void irc_pong(char *buf) { buf[0] = 'p'; buf[1] = 'o'; @@ -537,8 +537,8 @@ void main(void) unsigned char newline = 0; unsigned char connected = 0; char *msgptr; - unsigned char* sender; - unsigned char* tmpPtr; + char* sender; + char* tmpPtr; //unsigned char* tmpPtr2; POKEW(0xD020,0); @@ -593,7 +593,7 @@ void main(void) { if (strstr(inbuf, " privmsg ") != 0) { - sender = (unsigned char*) malloc(40 * sizeof(unsigned char)); + sender = (char*) malloc(40 * sizeof(char)); i = 1; while(inbuf[i] != '!') @@ -606,7 +606,7 @@ void main(void) if (strstr(inbuf, "action ") != 0) { - tmpPtr = (unsigned char*) malloc(80 * sizeof(unsigned char)); + tmpPtr = (char*) malloc(80 * sizeof(char)); strcpy(tmpPtr," * "); strcat(tmpPtr,sender); strcat(tmpPtr," "); @@ -648,7 +648,7 @@ void main(void) } else if (strstr(inbuf, " join ") != 0) { - sender = (unsigned char*) malloc(80 * sizeof(unsigned char)); + sender = (char*) malloc(80 * sizeof(char)); i = 1; while(inbuf[i] != '!') { @@ -669,7 +669,7 @@ void main(void) } else if (strstr(inbuf, " part ") != 0) { - sender = (unsigned char*) malloc(80 * sizeof(unsigned char)); + sender = (char*) malloc(80 * sizeof(char)); i = 1; while(inbuf[i] != '!') { @@ -690,7 +690,7 @@ void main(void) } else if (strstr(inbuf, " quit ") != 0) { - sender = (unsigned char*) malloc(80 * sizeof(unsigned char)); + sender = (char*) malloc(80 * sizeof(char)); i = 1; while(inbuf[i] != '!') { @@ -711,7 +711,7 @@ void main(void) } else if (strstr(inbuf, " nick ") != 0) { - sender = (unsigned char*) malloc(80 * sizeof(unsigned char)); + sender = (char*) malloc(80 * sizeof(char)); i = 1; while(inbuf[i] != '!') { @@ -737,7 +737,7 @@ void main(void) } else if (strstr(inbuf, " quit ") != 0) { - sender = (unsigned char*) malloc(80 * sizeof(unsigned char)); + sender = (char*) malloc(80 * sizeof(char)); i = 1; while(inbuf[i] != '!') { diff --git a/src/samples/u-sample.c b/src/samples/u-sample.c index 193f0df..2d56b1d 100644 --- a/src/samples/u-sample.c +++ b/src/samples/u-sample.c @@ -67,7 +67,7 @@ void main(void) printf("\n\nIdentify: %s\nStatus: %s", uii_data, uii_status); uii_getinterfacecount(); - printf("\n\nInterface count: %d\nStatus: %s", atoi(uii_data), uii_status); + printf("\n\nInterface count: %d\nStatus: %us", atoi(uii_data), uii_status); uii_getipaddress(); printf("\n\nIP Address: %d.%d.%d.%d", uii_data[0], uii_data[1], uii_data[2], uii_data[3]); diff --git a/src/samples/u-shell.c b/src/samples/u-shell.c index cbc43f8..198ee41 100644 --- a/src/samples/u-shell.c +++ b/src/samples/u-shell.c @@ -8,9 +8,9 @@ #define MAXINPUT 160 #define MAXPARAM_SZ 20 -unsigned char buf[MAXINPUT]; +char buf[MAXINPUT]; -unsigned char params[4][MAXPARAM_SZ]; +char params[4][MAXPARAM_SZ]; unsigned char paramcount = 0; unsigned char running = 1; diff --git a/src/samples/ultimateterm.c b/src/samples/ultimateterm.c index 0f80dd4..8b55552 100644 --- a/src/samples/ultimateterm.c +++ b/src/samples/ultimateterm.c @@ -20,6 +20,8 @@ Demo program does not alter any data #include #include +// #define DEBUG_MODE + #ifdef __C128__ #include #define RESET_MACHINE asm("jmp $FF3D"); @@ -105,7 +107,7 @@ void blank_vicII(void); #define ANSI_PRIVATE 0x3f // ? #define ANSI_DEC_h 0x68 // h #define ANSI_DEC_l 0x68 // h -#define ANSI_HPA 0x62 // b +#define ANSI_HPA 0x62 // b #define ANSI_VPA 0x64 // d #define ANSI_VALUE_BUFFER_SIZE 10 @@ -190,17 +192,19 @@ unsigned char telnet_done = 0; unsigned char telnet_binary = 0; unsigned char pb_loaded = 0; unsigned char phonebookctr = 0; -unsigned char phonebook[21][80]; +char phonebook[21][80]; unsigned char dev = 0; unsigned char pbtopidx = 0; unsigned char pbselectedidx = 0; -unsigned char pb_bytes[PB_SIZE+1]; -unsigned char hst[80]; +char pb_bytes[PB_SIZE+1]; +char hst[80]; unsigned file_index; unsigned char y = 0; unsigned char px = 0; unsigned char py = 0; +#ifdef DEBUG_MODE unsigned char debug = 0; +#endif int intbuff = 0; int datacount; @@ -352,7 +356,7 @@ void delete_phonebook_entry(void) { ch = (ctr == pbselectedidx) ? '>' : ' '; printf(ctr<=phonebookctr ? "%c %-36s" : SPACE38,ch,phonebook[ctr]); } - cputcxy(1,y,'>'); + cputcxy(1,y,(char) '>'); } void add_phonebook_entry(void) { @@ -444,7 +448,7 @@ void quit(void) { } void load_phonebook(void) { - unsigned char *file = "0:u-term,s"; + char *file = "0:u-term,s"; unsigned char c, ctr; int bytesRead = 0; pbtopidx = 0; @@ -462,8 +466,7 @@ void load_phonebook(void) { strcpy(phonebook[0], "MANUAL ENTRY"); if (dev < 8 || bytesRead <= 0) { // No drive or no file // Default phonebook - //strcpy(phonebook[1], "bbs.retrocampus.com 6510"); - strcpy(phonebook[1], "192.168.7.51 23"); + strcpy(phonebook[1], "bbs.retrocampus.com 6510"); strcpy(phonebook[2], "afterlife.dynu.com 6400"); strcpy(phonebook[3], "borderlinebbs.dyndns.org 6400"); strcpy(phonebook[4], "commodore4everbbs.dynu.net 6400"); @@ -656,7 +659,6 @@ void send_char(unsigned char c) { buff[0] = c; buff[1] = 0; uii_socketwrite(socketnr, buff); - //printf("Sent [%d]\n", c); } void send3chars(unsigned char c1, unsigned char c2, unsigned char c3) { @@ -723,9 +725,9 @@ void main(void) // Read from remote - if (telnet_done) { - datacount = uii_socketread(socketnr, 892); - } else { + if (telnet_done) { + datacount = uii_socketread(socketnr, 892); + } else { datacount = uii_socketread(socketnr, 1); // Special handling during telnet negotiation - read single character at a time } @@ -742,15 +744,19 @@ void main(void) handle_telnet_iac(); character_mode = MODE_ANSI; first_char = 0; - BORDER(12) // light gray + BORDER(12) // light + cursor_off(); printf("%c (Telnet)%c\n\n", CG_COLOR_L_GREEN, CG_COLOR_L_GRAY); + cursor_on(); continue; // Top of terminal loop } else { first_char = 0; telnet_done = 1; + cursor_off(); printf("%c\n\n", CG_COLOR_CYAN); + cursor_on(); } } @@ -765,8 +771,8 @@ void main(void) else // Finally regular data - just display { telnet_done = 1; - cursor_off(); - + cursor_off(); + switch (character_mode) { case MODE_PETSCII: @@ -774,7 +780,7 @@ void main(void) break; case MODE_ASCII: - putstring_ascii(uii_data + 2); + putstring_ascii(uii_data + 2); break; case MODE_ANSI: @@ -787,8 +793,8 @@ void main(void) } cursor_on(); - } - } // datacount == -1 means "wait state" + } + } // datacount == -1 means "wait state" // Handle keyboard @@ -808,9 +814,11 @@ void main(void) } else if (c == 136) // KEY F7: close connection break; + #ifdef DEBUG_MODE else if (c == 140) { // KEY F8: Debugging debug = !debug; } + #endif else { switch (character_mode) @@ -1574,17 +1582,17 @@ int parse_ansi_value(char* buf) { char* parse_ansi_escape(char* str) { - unsigned char valbuffer[ANSI_VALUE_BUFFER_SIZE] = { 0 }; + char valbuffer[ANSI_VALUE_BUFFER_SIZE] = { 0 }; int vb = 0; int values[2] = { 0 }; int vi = 0; - str++; - datacount--; + str++; + datacount--; - if (*str != ANSI_BRACKET) { // Invalid escape sequence, ignore and move to next char - return str; + if (*str != ANSI_BRACKET) { // Invalid escape sequence, ignore and move to next char + return str; } while (1) { @@ -1601,14 +1609,14 @@ char* parse_ansi_escape(char* str) { switch (*str) { case ANSI_CURSOR_HOME: - putchar(HOME); + putchar(HOME); break; case ANSI_CLEAR_SCREEN: - putchar(CLRSCR); + putchar(CLRSCR); break; - case ANSI_CLEAR_LINE: + case ANSI_CLEAR_LINE: // Not handled yet break; @@ -1689,13 +1697,14 @@ void putstring_ansi(char* str) { break; default: + #ifdef DEBUG_MODE if (debug) { printf("\nRECV ASC:[%d=%c]\n", *str, *str); printf("RECV PET:[%d=%c]\n", ascToPet[*str], ascToPet[*str]); } - else { + else + #endif putchar(ascToPet[*str]); - } break; } } diff --git a/target/UltimateTerm-and-demos.d64 b/target/UltimateTerm-and-demos.d64 index f855b81..de9f704 100644 Binary files a/target/UltimateTerm-and-demos.d64 and b/target/UltimateTerm-and-demos.d64 differ diff --git a/target/u-chat128.prg b/target/u-chat128.prg index e88c947..fd9974f 100644 Binary files a/target/u-chat128.prg and b/target/u-chat128.prg differ diff --git a/target/u-chat64.prg b/target/u-chat64.prg index 9c08dc1..15a611e 100644 Binary files a/target/u-chat64.prg and b/target/u-chat64.prg differ diff --git a/target/u-echoserver.prg b/target/u-echoserver.prg index 6538b1a..7d5c8a3 100644 Binary files a/target/u-echoserver.prg and b/target/u-echoserver.prg differ diff --git a/target/u-menu.prg b/target/u-menu.prg index be52866..f0a1807 100644 Binary files a/target/u-menu.prg and b/target/u-menu.prg differ diff --git a/target/u-sample.prg b/target/u-sample.prg index 644858f..df8394a 100644 Binary files a/target/u-sample.prg and b/target/u-sample.prg differ diff --git a/target/u-shell.prg b/target/u-shell.prg index d6c75c6..5b26ae3 100644 Binary files a/target/u-shell.prg and b/target/u-shell.prg differ diff --git a/target/u-term128.prg b/target/u-term128.prg index dc6ea3d..09aae56 100644 Binary files a/target/u-term128.prg and b/target/u-term128.prg differ diff --git a/target/u-term64.prg b/target/u-term64.prg index ea0e2dd..9c82db4 100644 Binary files a/target/u-term64.prg and b/target/u-term64.prg differ