diff --git a/src/Home/Telnet/ANSI.ZC b/src/Home/Telnet/ANSI.ZC new file mode 100644 index 00000000..f7183627 --- /dev/null +++ b/src/Home/Telnet/ANSI.ZC @@ -0,0 +1,129 @@ +#define MODE_TEXT 0 +#define MODE_ESCAPE 1 +#define MODE_CSI 2 + +#define CMD_RESET 0 +#define CMD_SLOW_BLINK 5 +#define CMD_FAST_BLINK 6 +#define CMD_FG 3 +#define CMD_BG 4 +#define CMB_B_FG 9 +#define CMD_B_BG 1 + +U0 PrintANSI(U8 *str, I64 len=-1) { + U64 state = MODE_TEXT; + U64 cmd = -1; + if (len < 0) len = StrLen(str); + U64 i; + for (i=0; i '9') + throw('ICSIC'); + + U64 code = ch - '0'; + #define next_ch { if (i+1 >= len) { throw("Expected character"); } ch = str[++i]; code = ch - '0'; } + + switch (code) { + case CMD_RESET: + "$$FG$$$$BG$$"; + break; + case CMD_SLOW_BLINK: + case CMD_FAST_BLINK: + // FIXME: Add blink + break; + case 'A': // Cursor Up + case 'B': // Cursor Down + case 'C': // Cursor Forward (Right) + case 'D': // Cursor Backward (Left) + case 'E': // Cursor Next Line + case 'F': // Cursor Previous Line + case 'G': // Cursor Horizontal Absolute + case 'H': // Cursor Position (default: top-left corner) + case 'f': // Same as 'H' + case 'J': // Erase Display + ptr++; + DocClear; + break; + case 'K': // Erase Line + case 'S': // Scroll Up + case 'T': // Scroll Down + case '?': // DEC Private Mode + case 'h': // Set Mode + case 'l': // Reset Mode + case 'c': // Device Attributes (Request) + case CMD_FG: + next_ch; + + switch (code) { + case 0: "$$BLACK$$"; break; + case 1: "$$RED$$"; break; + case 2: "$$GREEN$$"; break; + case 3: "$$YELLOW$$"; break; + case 4: "$$BLUE$$"; break; + case 5: "$$PURPLE$$"; break; + case 6: "$$CYAN$$"; break; + case 7: "$$WHITE$$"; break; + // FIXME: Handle 8 + case 9: "$$FG$$"; break; + } + break; + case CMD_BG: + next_ch; + + switch (code) { + case 0: "$$BG,BLACK$$"; break; + case 1: "$$BG,RED$$"; break; + case 2: "$$BG,GREEN$$"; break; + case 3: "$$BG,YELLOW$$"; break; + case 4: "$$BG,BLUE$$"; break; + case 5: "$$BG,PURPLE$$"; break; + case 6: "$$BG,CYAN$$"; break; + case 7: "$$BG,WHITE$$"; break; + // FIXME: Handle 8 + case 9: "$$BG$$"; break; + } + break; + default: + "\nCOde: %d\n", code; + throw('ICSI'); + } + + next_ch; + if (ch == ';') { + next_ch; + goto csi; + } + goto start_iter; + break; + default: + throw('ISTE'); + } + + next_iter: + } +} + +// PrintANSI("He\x1b[33;45mllo\x1b[0m yoooo\n"); diff --git a/src/Home/Telnet/Art/MATRIX.ANS b/src/Home/Telnet/Art/MATRIX.ANS new file mode 100644 index 00000000..0a598544 Binary files /dev/null and b/src/Home/Telnet/Art/MATRIX.ANS differ diff --git a/src/Home/Telnet/Art/ZealBanner.DD b/src/Home/Telnet/Art/ZealBanner.DD new file mode 100644 index 00000000..24346eb2 --- /dev/null +++ b/src/Home/Telnet/Art/ZealBanner.DD @@ -0,0 +1,7 @@ + oooooooooooo oooo oooooooooo. oooooooooo. .oooooo..o +d'""""""d888' `888 `888' `Y8b `888' `Y8b d8P' `Y8 + .888P .ooooo. .oooo. 888 888 888 888 888 Y88bo. + d888' d88' `88b `P )88b 888 888oooo888' 888oooo888' `"Y8888o. + .888P 888ooo888 .oP"888 888 888 `88b 888 `88b `"Y88b + d888' .P 888 .o d8( 888 888 888 .88P 888 .88P oo .d8P +.8888888888P `Y8bod8P' `Y888""8o o888o o888bood8P' o888bood8P' 8""88888P' diff --git a/src/Home/Telnet/Art/ZealSplash.ans b/src/Home/Telnet/Art/ZealSplash.ans new file mode 100644 index 00000000..86b640b7 --- /dev/null +++ b/src/Home/Telnet/Art/ZealSplash.ans @@ -0,0 +1,21 @@ +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±±±±±±²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±°°  ²²²² +²²²²²²² °±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±°°°   ²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²² °±±±°°°  ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²   °°±±±±±±±±±±±±±±± ²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±± ²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±°²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±± ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±± ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±±°²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²±±±±±±±±±±±±±±±±±±±±± ²²²²²²²²²² ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±²²²²²²²² +²²²²²±±±±±±±±±±±±±±±±±±±±± ²²²²²²²²²²²±±±±±±±±±±±±±±±±±±±±±±±±±±±±±°°°   ²²²²²²² +²²²²²²²²² °±±±±±±±±±±° ²²²²²²²²²² ±±±±±±±°°°   ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²² ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² +²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²² + \ No newline at end of file diff --git a/src/Home/Net/Programs/Telnet.ZC b/src/Home/Telnet/Telnet.ZC similarity index 93% rename from src/Home/Net/Programs/Telnet.ZC rename to src/Home/Telnet/Telnet.ZC index 4fbf68fb..47c8b112 100755 --- a/src/Home/Net/Programs/Telnet.ZC +++ b/src/Home/Telnet/Telnet.ZC @@ -115,7 +115,7 @@ U0 HandleControlCodes(U8 ch) { DocClear; break; case 13: // CR (Carriage Return) - "\r\n\0"; + // "\r\n\0"; skip_input = TRUE; break; case 14: // SO (Shift Out) @@ -128,7 +128,8 @@ U0 HandleControlCodes(U8 ch) { break; } } else { - "%c", ch; + // dont print for now + // "%c", ch; } } @@ -138,6 +139,19 @@ U0 Telnet(U8 *host, U16 port=TELNET_PORT) { U8 buffer[BUF_SIZE], input_buffer[BUF_SIZE], *ptr, ch; Bool force_disconnect = FALSE; + // would be nice to resize to 25x80 + // CTask *task; + // task=User; + // TaskWait(task); + // task->border_src=BDS_CONST; + // task->border_attr=LTGRAY<<4+DriveTextAttrGet(':')&15; + // task->text_attr =LTGRAY<<4+BLUE; + // task->win_inhibit= WIG_TASK_DEFAULT-WIF_SELF_BORDER; + // WinHorz(Fs->win_left,Fs->win_right,task); + // WinVert(Fs->win_top,(Fs->win_top+Fs->win_bottom)>>2-1,task); + // WinVert(task->win_bottom+3,Fs->win_bottom); + // WinToTop(Fs); + sock = TelnetOpen(host, port); if (sock <= 0) { return; @@ -247,6 +261,7 @@ U0 Telnet(U8 *host, U16 port=TELNET_PORT) { ptr++; // Skip 'h' or 'l' break; } else { + ptr++; break; // Invalid character, exit loop } } @@ -257,6 +272,7 @@ U0 Telnet(U8 *host, U16 port=TELNET_PORT) { ptr++; } } + skip_input = WaitForInputOrTimeout(TIMEOUT_DURATION); if (!skip_input) @@ -326,6 +342,9 @@ U0 TelnetPrompt() { // Dev auto-connect to test server // Telnet("mbrserver.com"); -Telnet("freechess.org"); -//Telnet("dura-bbs.net", 6359); -//Telnet("darkrealms.ca"); \ No newline at end of file +// Telnet("freechess.org"); +// Telnet("dura-bbs.net", 6359); +// Telnet("darkrealms.ca"); + +// ZealBBS dev server +Telnet("localhost", 8888); \ No newline at end of file