diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd.c | 3 | ||||
| -rw-r--r-- | src/indic8.c | 6 | ||||
| -rw-r--r-- | src/irc.c | 9 | ||||
| -rw-r--r-- | src/irc.h | 1 | ||||
| -rw-r--r-- | src/main.c | 6 | ||||
| -rw-r--r-- | src/pollkbd.s | 4 | ||||
| -rw-r--r-- | src/timers.h | 8 |
7 files changed, 22 insertions, 15 deletions
@@ -8,6 +8,7 @@ #include "edbox.h" #include "config.h" #include "streq.h" +#include "timers.h" /* A "command" is actually anything the user types, whether or not it starts with a / character. */ @@ -173,7 +174,7 @@ static void do_quit(void) { static void pause(void) { OS.rtclok[2] = 0; - while(OS.rtclok[2] < hz) + while(OS.rtclok[2] < timers.hz) /* NOP */; } diff --git a/src/indic8.c b/src/indic8.c index 1dc7e9d..260994d 100644 --- a/src/indic8.c +++ b/src/indic8.c @@ -3,12 +3,10 @@ #include <atari.h> #include "addrs.h" #include "indic8.h" - -extern char hz; +#include "timers.h" static void ind_start_timer(void) { - /* 3.7 sec is just what The_Doctor__ ordered! */ - OS.cdtmv5 = (hz / 10) * 37; + OS.cdtmv5 = timers.net_ind_time; } void ind_net_rx(void) { @@ -16,6 +16,7 @@ #include "keytab.h" #include "kgetc.h" #include "streq.h" +#include "timers.h" #ifndef VERSION #define VERSION "?????" @@ -132,10 +133,10 @@ static void print_ping_time(char *p) { pingtime = now - pingtime; - sec = pingtime / hz; - frac = pingtime % hz; + sec = pingtime / timers.hz; + frac = pingtime % timers.hz; frac *= 100; - frac /= hz; + frac /= timers.hz; scr_print_active("*** "); scr_print_active(msg_src); @@ -677,7 +678,7 @@ void print_errnum(void) { static void start_minute_timer() { OS.cdtmf4 = 0xff; - OS.cdtmv4 = 60 * hz; + OS.cdtmv4 = timers.one_sec; } static char service_minute_timer() { @@ -9,7 +9,6 @@ extern unsigned int txbuflen; extern unsigned char err; extern unsigned char trip; extern char reconnect_timeout; -extern char hz; /* 50 for PAL, 60 for NTSC, natch */ /* clears the transmit buffer. */ void txbuf_init(void); @@ -17,6 +17,7 @@ #include "config.h" #include "kgetc.h" #include "indic8.h" +#include "timers.h" unsigned char err; // error code of last operation. unsigned char trip = 0; // if trip == 1, fujinet is asking us for attention. @@ -24,7 +25,6 @@ char old_enabled = 0; // were interrupts enabled for old vector void *old_vprced; // old PROCEED vector, restored on exit. unsigned int rxbuflen; // RX buffer length unsigned int txbuflen; // TX buffer length -char hz; /* 50 for PAL, 60 for NSTC */ char reconnect_timeout = 1; extern void ih(); // defined in intr.s @@ -150,7 +150,7 @@ void reconnect(void) { OS.cdtmf3 = OS.ch = 0xff; if(reconnect_timeout) { - OS.cdtmv3 = reconnect_timeout * hz; + OS.cdtmv3 = reconnect_timeout * timers.hz; scr_print_current(" or wait "); scr_cur_printnum(reconnect_timeout); scr_print_current(" sec"); @@ -175,8 +175,6 @@ void main(void) { OS.color3 = 0x46; /* red for highlight */ OS.noclik = config.disable_keyclick; - hz = (GTIA_READ.pal & 0x0e) ? 60 : 50; - edbox_clear(); scr_init(); init_channels(); diff --git a/src/pollkbd.s b/src/pollkbd.s index 795e6f7..2d44976 100644 --- a/src/pollkbd.s +++ b/src/pollkbd.s @@ -31,7 +31,9 @@ .export _poll_keyboard .import _keypress, _kgetc, _start_latch, _start_keystroke - .import _edbox_keystroke, _hz, _txbuf_send_str, _irc_away + .import _edbox_keystroke, _txbuf_send_str, _irc_away + + _hz = $f0 ; must agree with timers.h! .rodata away: diff --git a/src/timers.h b/src/timers.h new file mode 100644 index 0000000..a3e41f8 --- /dev/null +++ b/src/timers.h @@ -0,0 +1,8 @@ +typedef struct { + char hz; /* 50 for PAL, 60 for NTSC */ + char one_tenth_sec; /* 5 for PAL, 6 for NTSC */ + unsigned int one_sec; /* 1 sec, "hz" times 60 */ + unsigned int net_ind_time; /* 3.7 sec (just what The_Doctor__ ordered) */ +} timers_t; + +#define timers (*(timers_t *)(0xf0)) |
