aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index a705714..8b6fc28 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,17 +28,19 @@ unsigned int txbuflen; // TX buffer length
char hz; /* 50 for PAL, 60 for NSTC */
char reconnect_timeout = 1;
-/* TODO: user modes (default +iw), fg/bg color... */
-
extern void ih(); // defined in intr.s
+void txbuf_append_chr(char c) {
+ tx_buf[txbuflen++] = c;
+}
+
void txbuf_init(void) {
txbuflen = tx_buf[0] = 0;
}
void txbuf_append_str(const char *str) {
while(*str) {
- tx_buf[txbuflen++] = *str++;
+ txbuf_append_chr(*str++);
}
}
@@ -74,11 +76,13 @@ 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;
+ // tx_buf[txbuflen++] = 0x0d;
+ // tx_buf[txbuflen++] = 0x0a;
+ txbuf_append_chr(0x0d);
+ txbuf_append_chr(0x0a);
ind_net_tx();
- nwrite(tx_buf, txbuflen);
+ nwrite_txbuf();
ind_net_idle();
txbuf_init();
}