diff options
| -rw-r--r-- | src/irc.c | 2 | ||||
| -rw-r--r-- | src/main.c | 16 | ||||
| -rw-r--r-- | src/nio.c | 16 | ||||
| -rw-r--r-- | src/nio.h | 12 |
4 files changed, 23 insertions, 23 deletions
@@ -739,7 +739,7 @@ int irc_read(void) { ind_net_rx(); if(rxbuflen > 0) { - err = nread(rx_buf, rxbuflen); + err = nread_rxbuf(); if(err != 1) { ind_net_down(); print_errnum(); @@ -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(); } @@ -73,23 +73,27 @@ char nstatus(void) { return OS.dvstat[DVSTAT_EXTENDED_ERROR]; // return extended status } -char nread(char *buf, unsigned short len) { +char nread_rxbuf(void) { + extern unsigned int rxbuflen; + extern char *rx_buf; set_defaults(); OS.dcb.dcomnd = 'R'; // read OS.dcb.dstats = DREAD; - OS.dcb.dbuf = buf; - OS.dcb.dbyt = OS.dcb.daux = len; // Set the buffer size AND daux with length + OS.dcb.dbuf = rx_buf; + OS.dcb.dbyt = OS.dcb.daux = rxbuflen; // Set the buffer size AND daux with length siov(); return get_status(); } -char nwrite(char *buf, unsigned short len) { +char nwrite_txbuf(void) { + extern unsigned int txbuflen; + extern char *tx_buf; set_defaults(); OS.dcb.dcomnd = 'W'; // write OS.dcb.dstats = DWRITE; - OS.dcb.dbuf = buf; - OS.dcb.dbyt = OS.dcb.daux = len; + OS.dcb.dbuf = tx_buf; + OS.dcb.dbyt = OS.dcb.daux = txbuflen; siov(); return get_status(); @@ -25,16 +25,8 @@ char nopen(void); char nclose(void); char nstatus(void); -char nread(char *buf, unsigned short len); -char nwrite(char *buf, unsigned short len); +char nread_rxbuf(void); +char nwrite_txbuf(void); char nreset(void); -/** - * Send username and password credentials - * @param devicespec - The devicespec. - * @param login - The username to send - * @param password - The password to send - */ -// unsigned char nlogin(char* devicespec, char* login, char* password); - #endif /* NIO_H */ |
