aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd.c6
-rw-r--r--src/irc.c4
-rw-r--r--src/irc.h3
-rw-r--r--src/main.c2
-rw-r--r--src/txbuf.s6
5 files changed, 14 insertions, 7 deletions
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 #<tx_buf