aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-04-01 01:55:51 -0400
committerB. Watson <urchlay@slackware.uk>2026-04-01 01:56:03 -0400
commit007f596e3d75131086d0c165fc8848ad630aa82b (patch)
tree95658d05370d507ecf491a5c0f7ef68be94665e2
parent3fde0115504756dedf2ff352da5bf7ef1933cf65 (diff)
downloadfujinet-chat-007f596e3d75131086d0c165fc8848ad630aa82b.tar.gz
More edbox stuff in asm. 5347 bytes free.
-rw-r--r--src/edbox.c64
-rw-r--r--src/screen.c16
-rw-r--r--src/screen.h2
3 files changed, 19 insertions, 63 deletions
diff --git a/src/edbox.c b/src/edbox.c
index 126762a..39b142b 100644
--- a/src/edbox.c
+++ b/src/edbox.c
@@ -8,9 +8,16 @@
#include "keytab.h"
#include "irc.h"
+/* private API stuff (not in edbox.h) that's been rewritten in asm. */
+void hide_cursor(void);
+void show_cursor(void);
+void storechr(char c);
+void copy_to_old(void);
+void restore_old(void);
+
char old_edbox[EDBOX_SIZE];
-static char old_len;
-static char typeover;
+char old_len;
+char typeover;
char edbox_visible = 0;
char edbox_pos; /* range 0 to EDBOX_SIZE - 1 */
@@ -18,14 +25,6 @@ char edbox_len; /* idem */
void (*edbox_callback)(void);
-void hide_cursor(void) {
- edit_box[edbox_pos] &= 0x7f;
-}
-
-void show_cursor(void) {
- edit_box[edbox_pos] |= 0x80;
-}
-
void edbox_show(void) {
u16 addr;
@@ -34,7 +33,7 @@ void edbox_show(void) {
else
addr = (u16)edit_box + edbox_pos - 79;
- scr_waitvcount(116);
+ scr_waitvcount_116();
*dlist_status_lms = addr;
*dlist_last_line = 0x02; /* ANTIC GR.0 */
@@ -52,10 +51,6 @@ void move_right(void) {
memmove(edit_box + edbox_pos + 1, edit_box + edbox_pos, EDBOX_MAXPOS - edbox_pos);
}
-void storechr(char c) {
- edit_box[edbox_pos] = c;
-}
-
void inschr(char c) {
if(edbox_len == EDBOX_MAXPOS) {
/* buffer full, can't insert */
@@ -91,19 +86,6 @@ void edbox_putc(char c) {
}
}
-static void copy_to_old(void) {
- if(!edbox_len) return;
- memcpy(old_edbox, edit_box, edbox_len);
- bzero(old_edbox + edbox_len, EDBOX_MAXPOS - edbox_len);
- old_len = edbox_len;
-}
-
-static void restore_old(void) {
- edbox_clear();
- hide_cursor();
- memcpy(edit_box, old_edbox, old_len);
- edbox_pos = edbox_len = old_len;
-}
static void del_char(void) {
if(!edbox_len) return;
@@ -284,29 +266,3 @@ void edbox_keystroke(char c) {
show_cursor();
if(edbox_visible) edbox_show();
}
-
-/* see edboxutl.s for the asm rewrites of these */
-#if 0
-void edbox_clear(void) {
- bzero(edit_box, EDBOX_SIZE + 1);
- edbox_pos = edbox_len = 0;
- show_cursor(); // not needed? seems it is..
-}
-
-void edbox_addchr(char c) {
- edit_box[edbox_len++] = c;
- edbox_pos = edbox_len;
-}
-
-void edbox_space(void) {
- edbox_addchr(' ');
-}
-
-void edbox_set(char *contents) {
- edbox_clear();
- while(*contents) {
- edit_box[edbox_len++] = *contents++;
- }
- edbox_pos = edbox_len;
-}
-#endif
diff --git a/src/screen.c b/src/screen.c
index 748cb8b..02cc45a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -25,8 +25,8 @@ char scr_names[7][32];
static char xpos;
-void scr_waitvcount(u8 c) {
- while(ANTIC.vcount < c)
+void scr_waitvcount_116(void) {
+ while(ANTIC.vcount < 116)
/* NOP */;
}
@@ -56,7 +56,7 @@ void scr_init(void) {
OS.sdmctl = 0; /* disappear the screen */
- scr_waitvcount(112); /* after the last GR.0 line */
+ scr_waitvcount_116();
*SDLST = DLIST_BOT_ADDR;
OS.chbas = FONT_ADDR_HI;
@@ -122,7 +122,7 @@ void scr_display(char s) {
scr_status[s] = SCR_INACTIVE;
scr_current = s;
- scr_waitvcount(112);
+ scr_waitvcount_116();
*dlist_bot_lms = (u16)screen_bot_addrs[s];
scr_show_status(s);
@@ -130,21 +130,21 @@ void scr_display(char s) {
void scr_scrollback_bonus(void) {
if(bonus_addrs[scr_current]) {
- scr_waitvcount(112);
+ scr_waitvcount_116();
*dlist_top_lms = (u16)bonus_addrs[scr_current];
}
}
void scr_scrollback(void) {
// OS.color2 = 0;
- scr_waitvcount(112);
+ scr_waitvcount_116();
*dlist_top_lms = (u16)screen_top_addrs[scr_current];
*SDLST = (u16)dlist_top;
}
void scr_end_scrollback(void) {
// OS.color2 = 192;
- scr_waitvcount(112);
+ scr_waitvcount_116();
*SDLST = (u16)dlist_bot;
}
@@ -183,7 +183,7 @@ void scr_show_status(char s) {
// *p++ = 0xbe;
if(!edbox_visible) {
- scr_waitvcount(112);
+ scr_waitvcount_116();
*dlist_status_lms = (u16)status_box;
*dlist_last_line = 0x06; /* ANTIC GR.1 */
}
diff --git a/src/screen.h b/src/screen.h
index 34f069f..2959b1e 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -105,7 +105,7 @@ void scr_activate(char s);
char *scr_get_cur_name(void);
/* XXX: this really should be in a utils.c or common.c... */
-void scr_waitvcount(u8 c);
+void scr_waitvcount_116(void);
/* print decimal numbers (see printnum.s) */
void scr_cur_printnum(u16 c);