diff options
Diffstat (limited to 'config/config.c')
| -rw-r--r-- | config/config.c | 68 |
1 files changed, 59 insertions, 9 deletions
diff --git a/config/config.c b/config/config.c index 64924f0..0fb2fab 100644 --- a/config/config.c +++ b/config/config.c @@ -10,6 +10,8 @@ #include <peekpoke.h> #include "../src/config.h" +#include "../src/timers.h" +#include "os2ram.h" #ifndef VERSION #define VERSION "?????" @@ -38,18 +40,31 @@ char *servers[] = { 0 }; +conf_t *conf = (conf_t *)0x0400; + char have_dos = 0; char filename[101] = "D:FNCHAT.CFG"; char buf[128]; char numbuf[4]; char server[101]; char port[6]; +char use_xl_ram = 1; + +unsigned int *bonus_addrs = (unsigned int *)0xd4; /* aka FR0 */ + +void setup_timers_and_exit(void) { + timers.hz = (GTIA_READ.pal & 0x0e) ? 60 : 50; + timers.one_tenth_sec = timers.hz / 10; + timers.one_sec = timers.hz * 60; + timers.net_ind_time = (timers.hz / 10) * 37; + exit(0); +} char lcgetc(void) { char c; c = cgetc(); - if(c == 0x03) exit(0); + if(c == 0x03) setup_timers_and_exit(); return c; } @@ -183,7 +198,14 @@ void prompt_alert_type(void) { } void no_dos(void) { - print("No DOS booted\n"); + print("No DOS booted (using $0700 area for\nextra scrollback)\n"); + bonus_addrs[0] = 0x0700; + bonus_addrs[1] = 0x0ae8; + bonus_addrs[2] = 0x1000; /* start on a 4K boundary */ + bonus_addrs[3] = 0x13e8; + bonus_addrs[4] = 0x17d0; + bonus_addrs[5] = 0x1bb8; + bonus_addrs[6] = 0; /* screen #7 doesn't have this */ } char want_overwrite() { @@ -331,7 +353,11 @@ char prompt_main(void) { print("[E]dit [C]onnect [C]? "); c = tolower(lcgetc()); - if(c == 0x15) { + if(c == 0x14) { + strcpy(conf->nick, "Urch600XL"); + conf->channels[1][0] = conf->channels[2][0] = 0; + c = 'c'; + } else if(c == 0x15) { /* super-secret Urchlay mode... */ strcpy(conf->nick, "Urch600XL"); c = 'c'; @@ -509,6 +535,20 @@ void prompt_server() { } } +void detect_xl(void) { + if(!is_xl()) { + print("400/800 detected, no extra RAM\n"); + use_xl_ram = 0; + return; + } + + use_xl_ram = yn("XL/XE detected, use extra RAM", use_xl_ram); + if(!use_xl_ram) return; + + os_to_ram(); +} + + void set_default_config(void) { memcpy(conf, &defaults, sizeof(conf_t)); } @@ -516,8 +556,15 @@ void set_default_config(void) { void main(void) { char bad; + /* disable Break key. don't have to do it again in the client! */ + POKE(0x10, PEEK(0x10) & 0x7f); + POKE(0xd20e, PEEK(0x10)); + /* loading1.xex left the original DL address at $fe */ - POKEW(0x0230, PEEKW(0xfe)); + if(PEEKW(0xfe)) POKEW(0x0230, PEEKW(0xfe)); + + /* clear the bonus screen addresses in case something left junk there */ + memset(bonus_addrs, 0, 14); set_default_config(); @@ -529,6 +576,8 @@ void main(void) { print("Version " VERSION "\n\n"); detect_dos(); + // detect_xl(); // not yet + if(!load(0)) print("Using built-in default config.\n"); @@ -540,7 +589,7 @@ void main(void) { print("remaining questions.\n\n"); if(memcmp(&defaults, conf, sizeof(defaults)) != 0) - if(yn("\nReset to defaults", 0)) + if(yn("Reset to defaults", 0)) set_default_config(); parse_url(); @@ -548,6 +597,7 @@ void main(void) { prompt("Nick", conf->nick, 25); prompt_server(); + make_url(); do { bad = 0; @@ -561,15 +611,13 @@ void main(void) { prompt("Name ", conf->real_name, 25); prompt_colors(); prompt_alert_type(); - conf->show_ping = yn("Show PING/PONG", conf->show_ping); + // conf->show_ping = yn("Show PING/PONG", conf->show_ping); conf->atract_away = yn("Set AWAY on ATRACT", conf->atract_away); conf->hide_motd = yn("Hide MOTD", conf->hide_motd); - conf->disable_keyclick = yn("Disable keyclick (XL/XE)", conf->disable_keyclick); + conf->disable_keyclick = yn("Disable keyclick", conf->disable_keyclick); prompt_channels(); prompt_extra_channels(); - make_url(); - print("\nURL: "); print(conf->url); putchar('\n'); @@ -580,4 +628,6 @@ void main(void) { Clearing the screen here band-aids it: a byte of the client's screen memory is getting zeroed out, but it's a byte that was already zero... */ print("\x7d"); + + setup_timers_and_exit(); } |
