From f844caecef4174f1fd52c1e810a836489935a01d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 13 Apr 2026 02:08:22 -0400 Subject: Save a tiny bit of space. 7701 bytes free. --- src/cmd.c | 6 +++--- src/irc.c | 4 ++-- src/irc.h | 3 +++ src/main.c | 2 -- src/txbuf.s | 6 ++++++ 5 files changed, 14 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/cmd.c b/src/cmd.c index 9055c33..fad8a93 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -199,7 +199,7 @@ static void do_optional_chan(void) { } txbuf_set_str(cmd_def->cmd); - txbuf_append_chr(' '); + txbuf_append_spc(); txbuf_append_str(target); if(arg2) txbuf_append_str2(" :", arg2); @@ -218,7 +218,7 @@ static void send_ctcp(void) { txbuf_append_str(arg2); if(arg3) txbuf_append_str2(" ", arg3); - txbuf_append_chr('\x01'); + txbuf_append_01(); txbuf_send(); } @@ -409,7 +409,7 @@ static char cmd_local(void) { static void cmd_remote(void) { txbuf_set_str(command); if(arg1) { - txbuf_append_chr(' '); + txbuf_append_spc(); txbuf_append_str(arg1); } txbuf_send(); diff --git a/src/irc.c b/src/irc.c index f87e9f2..97ca2d8 100644 --- a/src/irc.c +++ b/src/irc.c @@ -201,9 +201,9 @@ static void do_ctcp(char is_notice) { txbuf_set_str3("NOTICE ", msg_src, " :\x01"); txbuf_append_str(ctcp_type); - txbuf_append_chr(' '); + txbuf_append_spc(); txbuf_append_str(resp); - txbuf_append_chr('\x01'); + txbuf_append_01(); txbuf_send(); } } diff --git a/src/irc.h b/src/irc.h index 0c5c7ed..55f1d4d 100644 --- a/src/irc.h +++ b/src/irc.h @@ -13,6 +13,9 @@ extern char reconnect_timeout; /* clears the transmit buffer. */ void txbuf_init(void); +/* these are in txbuf.s: */ +void txbuf_append_01(void); +void txbuf_append_spc(void); void txbuf_append_chr(char c); /* appends a string to the transmit buffer, updates txbuflen. */ diff --git a/src/main.c b/src/main.c index 4d80a78..cfc9641 100644 --- a/src/main.c +++ b/src/main.c @@ -42,8 +42,6 @@ void txbuf_send(void) { /* always terminate with *ASCII* CRLF. DO NOT USE '\n' or even '\x0a', cc65 turns it into $9b! */ - // tx_buf[txbuflen++] = 0x0d; - // tx_buf[txbuflen++] = 0x0a; txbuf_append_chr(0x0d); txbuf_append_chr(0x0a); diff --git a/src/txbuf.s b/src/txbuf.s index bc1d1c2..dba52c3 100644 --- a/src/txbuf.s +++ b/src/txbuf.s @@ -8,8 +8,14 @@ .import _txbuflen .export _txbuf_append_chr, _txbuf_append_str + .export _txbuf_append_spc, _txbuf_append_01 .importzp sreg ; avoid ptr1 & friends, callers may use +_txbuf_append_01: + lda #$01 + .byte $2c ; BIT abs, skip next instruction +_txbuf_append_spc: + lda #' ' _txbuf_append_chr: tax lda #