From eb932c7c313b5461ffaee0fd6ed0db1e9f5ca32b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 2 Mar 2026 03:26:47 -0500 Subject: Go back to loading at $2000, make stack 1 page, protocol decoding WIP. --- Makefile | 1 + size.pl | 2 +- src/atari.cfg | 4 ++-- src/irc.c | 35 ++++++++++++++++++++--------------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 7b8aa9a..01e1b8f 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ PARTS=memsetup.xex font_dl.xex client.xex ATASM=atasm -s -a all: clean fnchat.xex + cp fnchat.xex /var/tnfs/ fnchat.xex: $(PARTS) cat $(PARTS) > fnchat.xex diff --git a/size.pl b/size.pl index c38c274..1fc8b19 100644 --- a/size.pl +++ b/size.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # from src/atari.cfg: -my $code_start = 0x0700; +my $code_start = 0x2000; my $stack_size = 0x0100; # from memsetup.asm: diff --git a/src/atari.cfg b/src/atari.cfg index 97b265e..38e166a 100644 --- a/src/atari.cfg +++ b/src/atari.cfg @@ -1,10 +1,10 @@ FEATURES { - STARTADDRESS: default = $0700; + STARTADDRESS: default = $2000; } SYMBOLS { __EXEHDR__: type = import; __AUTOSTART__: type = import; # force inclusion of autostart "trailer" - __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSIZE__: type = weak, value = $0200; __STARTADDRESS__: type = export, value = %S; __RESERVED_MEMORY__: type = weak, value = $0000; } diff --git a/src/irc.c b/src/irc.c index 18cd32d..3a25096 100644 --- a/src/irc.c +++ b/src/irc.c @@ -33,9 +33,8 @@ static void print_reason(void) { if(msg_text) { scr_print_active(": "); scr_print_active(msg_text); - } else { - scr_print_active("\n"); } + scr_eol_active(); } static void do_pong(void) { @@ -46,6 +45,7 @@ static void do_pong(void) { static void do_chan_nick(void) { scr_print_active("<"); + scr_print_active(msg_src); if(scr_active == SCR_SERVER) { /* if we don't have a window for it */ scr_print_active("/"); @@ -66,7 +66,8 @@ static void do_privmsg(void) { else do_priv_nick(); - scr_print_active(msg_text); /* text ends with an EOL, don't print another */ + scr_print_active(msg_text); + scr_eol_active(); } static void do_join(void) { @@ -79,7 +80,7 @@ static void do_join(void) { scr_print_active(msg_src); scr_print_active(" has joined "); scr_print_active(msg_dest); - scr_print_active("\n"); + scr_eol_active(); } } @@ -93,7 +94,7 @@ static void do_nick(void) { } scr_print_active(" now known as "); scr_print_active(msg_dest); - scr_print_active("\n"); + scr_eol_active(); } static void do_quit(void) { @@ -109,9 +110,8 @@ static void do_part(void) { if(msg_text) { scr_print_active(": "); scr_print_active(msg_text); - } else { - scr_print_active("\n"); } + scr_eol_active(); } static void do_topic(void) { @@ -120,6 +120,7 @@ static void do_topic(void) { scr_print_active(msg_dest); scr_print_active(" to: "); scr_print_active(msg_text); + scr_eol_active(); /* TODO: set topic in the screen! */ } @@ -140,7 +141,7 @@ static void do_mode(void) { scr_print_active(" "); scr_print_active(msg_args[i]); } - scr_print_active("\n"); + scr_eol_active(); } /* numerics call this with arg==1, since arg 0 is always our nick. @@ -163,6 +164,7 @@ static void do_catchall(int arg) { scr_print_active(" "); scr_print_active(msg_text); } + scr_eol_active(); } /* permutes last character (doesn't add one), so for "Bob" you get: @@ -256,6 +258,7 @@ static void do_numeric(void) { scr_print(s, msg_args[1]); scr_print(s, ": "); scr_print(s, msg_text); + scr_putc(s, '\n'); break; case RPL_TOPICWHOTIME: @@ -317,8 +320,8 @@ static void dispatch_msg(void) { } /* msgbuf contains a complete message from the server, whose - length is msgbuf_len. the last character *must* be CH_EOL, - and the last argument ends with CH_EOL. */ + length is msgbuf_len. The EOL that was at the end of the message + is *not* present here (been replaced with a null already). */ static void parse_msg(void) { char *p; @@ -326,7 +329,7 @@ static void parse_msg(void) { msg = msgbuf; /* ignore empty message */ - if(*msg == CH_EOL) return; + if(!*msg) return; /* if there's a final multiword arg... */ /* FIXME: channel names can have colons, which breaks this... */ @@ -378,7 +381,7 @@ static void parse_msg(void) { if((p = strstr(msg_src, "!"))) { msg_src++; *p = '\0'; - } else { + } else if(strstr(msg_src, ".")) { msg_src = 0; } } @@ -396,7 +399,9 @@ static void irc_split_Lines(void) { for(i = 0; i < rxbuflen; i++) { msgbuf[msgbuf_len] = *p; if(*p == CH_EOL) { - msgbuf[msgbuf_len + 1] = '\0'; + // msgbuf[msgbuf_len + 1] = '\0'; + /* do not include the EOL */ + msgbuf[msgbuf_len] = '\0'; parse_msg(); msgbuf_len = 0; } else { @@ -434,8 +439,8 @@ int irc_read(void) { // Get # of bytes waiting, no more than size of rx_buf rxbuflen = OS.dvstat[1] * 256 + OS.dvstat[0]; - if(rxbuflen > sizeof(rx_buf)) - rxbuflen = sizeof(rx_buf); + if(rxbuflen > MAX_MSG) + rxbuflen = MAX_MSG; if(rxbuflen > 0) { err = nread(url, rx_buf, rxbuflen); -- cgit v1.2.3