From 52708bc160da106cd406c26f8b797d46e58cc423 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 23 Mar 2026 07:19:20 -0400 Subject: Use macros for ind_act_*() funcs, shaves 33 bytes off the .xex. --- src/addrs.c | 6 ++++++ src/addrs.h | 6 ++++++ src/indic8.c | 38 +++----------------------------------- src/indic8.h | 27 +++++++++++++++++---------- src/screen.c | 2 -- 5 files changed, 32 insertions(+), 47 deletions(-) diff --git a/src/addrs.c b/src/addrs.c index b9f0921..4c5545b 100644 --- a/src/addrs.c +++ b/src/addrs.c @@ -52,3 +52,9 @@ u8 *screen_lastlines[7] = { at the bottom (2 unused lines), for now at least. addresses: 0xab80 0xaf68 0xb398 0xb780 0xbb68 0xbf50 */ u8 *status_box = (u8 *)0xa798; + +/* 1 byte, leftmost column of GR.1 line at bottom */ +u8 *ind_net_status = (u8 *)0xa7c0; + +/* 1 byte, 2nd column of GR.1 line at bottom */ +u8 *ind_act_status = (u8 *)0xa7c1; diff --git a/src/addrs.h b/src/addrs.h index 67a59c8..9f056d1 100644 --- a/src/addrs.h +++ b/src/addrs.h @@ -38,3 +38,9 @@ extern u8 *screen_lastlines[7]; /* bottom 2 lines, shared by all screens */ extern u8 *status_box; + +/* network status indicator */ +extern u8 *ind_net_status; + +/* activity indicator */ +extern u8 *ind_act_status; diff --git a/src/indic8.c b/src/indic8.c index 33d7d31..2be86d6 100644 --- a/src/indic8.c +++ b/src/indic8.c @@ -2,22 +2,10 @@ #include #include "addrs.h" +#include "indic8.h" extern char hz; -#define NET_TX_CHR 0x5c /* COLOR1 up-arrow */ -#define NET_RX_CHR 0x5d /* COLOR1 down-arrow */ -#define NET_ERR_CHR 0xe1 /* COLOR3 exclamation mark */ -#define NET_IDLE_CHR 0 /* null (renders as a space) */ - -#define J_CHR 0x4a /* COLOR1 J */ -#define P_CHR 0x50 /* COLOR1 P */ -#define Q_CHR 0x51 /* COLOR1 Q */ -#define M_CHR 0x4d /* COLOR1 M */ -#define CHAN_CHR 0x63 /* COLOR1 # */ - -char *ind_net_status; /* initialized in screen.c, scr_init() */ - static void ind_start_timer(void) { /* 3.7 sec is just what The_Doctor__ ordered! */ OS.cdtmv5 = (hz / 10) * 37; @@ -39,31 +27,11 @@ void ind_net_idle(void) { *ind_net_status = NET_IDLE_CHR; } -static void ind_act(char c) { - ind_net_status[1] = c; +void ind_act(char c) { + *ind_act_status = c; ind_start_timer(); } -void ind_act_pm(void) { - ind_act(M_CHR); -} - -void ind_act_chantext(void) { - ind_act(CHAN_CHR); -} - -void ind_act_join(void) { - ind_act(J_CHR); -} - -void ind_act_part(void) { - ind_act(P_CHR); -} - -void ind_act_quit(void) { - ind_act(Q_CHR); -} - void ind_check_timer(void) { if(!OS.cdtmv5) ind_net_status[1] = 0; diff --git a/src/indic8.h b/src/indic8.h index 4a28d41..5b29740 100644 --- a/src/indic8.h +++ b/src/indic8.h @@ -1,18 +1,25 @@ -extern char *ind_net_status; +#define NET_TX_CHR 0x5c /* COLOR1 up-arrow */ +#define NET_RX_CHR 0x5d /* COLOR1 down-arrow */ +#define NET_ERR_CHR 0xe1 /* COLOR3 exclamation mark */ +#define NET_IDLE_CHR 0 /* null (renders as a space) */ + +#define J_CHR 0x4a /* COLOR1 J */ +#define P_CHR 0x50 /* COLOR1 P */ +#define Q_CHR 0x51 /* COLOR1 Q */ +#define M_CHR 0x4d /* COLOR1 M */ +#define CHAN_CHR 0x63 /* COLOR1 # */ + +void ind_act(char c); void ind_net_rx(void); void ind_net_tx(void); void ind_net_down(void); void ind_net_idle(void); -void ind_act_pm(void); -void ind_act_chantext(void); -void ind_act_join(void); -void ind_act_part(void); -void ind_act_quit(void); +#define ind_act_pm() ind_act(M_CHR) +#define ind_act_chantext() ind_act(CHAN_CHR) +#define ind_act_join() ind_act(J_CHR) +#define ind_act_part() ind_act(P_CHR) +#define ind_act_quit() ind_act(Q_CHR) void ind_check_timer(void); - -/* -void ind_clear(void); -*/ diff --git a/src/screen.c b/src/screen.c index 3c61f01..42a7e65 100644 --- a/src/screen.c +++ b/src/screen.c @@ -43,8 +43,6 @@ void scr_init(void) { OS.sdmctl = 0; /* disappear the screen */ - ind_net_status = status_box + 40; - scr_waitvcount(112); /* after the last GR.0 line */ *SDLST = DLIST_BOT_ADDR; OS.chbas = FONT_ADDR_HI; -- cgit v1.2.3