From 007f596e3d75131086d0c165fc8848ad630aa82b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 1 Apr 2026 01:55:51 -0400 Subject: More edbox stuff in asm. 5347 bytes free. --- src/edbox.c | 64 ++++++++++--------------------------------------------------- 1 file changed, 10 insertions(+), 54 deletions(-) (limited to 'src/edbox.c') 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 -- cgit v1.2.3