aboutsummaryrefslogtreecommitdiff
path: root/config/config.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-04-06 06:08:45 -0400
committerB. Watson <urchlay@slackware.uk>2026-04-06 06:08:59 -0400
commita17902373dc3fd2f06f0796ed2621109cb4acdd3 (patch)
tree7c2bac0d8fca91b1916e72a79fef5a3b3520c6ad /config/config.c
parente00d109f7997ea3c238677a28271ced8fa8f9d4e (diff)
downloadfujinet-chat-a17902373dc3fd2f06f0796ed2621109cb4acdd3.tar.gz
Precalculate timer intervals (in config segment; client gets them preset). 6780 bytes free.
Diffstat (limited to 'config/config.c')
-rw-r--r--config/config.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/config/config.c b/config/config.c
index ae3b110..0fb2fab 100644
--- a/config/config.c
+++ b/config/config.c
@@ -10,6 +10,7 @@
#include <peekpoke.h>
#include "../src/config.h"
+#include "../src/timers.h"
#include "os2ram.h"
#ifndef VERSION
@@ -51,11 +52,19 @@ 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;
}
@@ -619,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();
}