Skip to content

Commit 31b8a47

Browse files
committed
Swapped "#ifdef" filled timing function from 6551 modem support for SDL_GetTicks
1 parent df09f67 commit 31b8a47

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

6551_modem.c

+5-22
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ static struct machine* oric = NULL;
4141

4242
#define CMD_BUF_SIZE 4
4343
static Uint8 mdm_cmd_buf[CMD_BUF_SIZE];
44-
static Uint64 mdm_time_buf[CMD_BUF_SIZE];
44+
// SDL_GetTicks() counts from 0 on SDL_Init, so overrun would only
45+
// happen if you ran Oricutron for ~50 days solid
46+
static Uint32 mdm_time_buf[CMD_BUF_SIZE];
4547

4648
#define DATA_BUF_SIZE 4096
4749
static int mdm_in = 0;
@@ -68,8 +70,6 @@ static int socket_write(int sock, const unsigned char* data, int len);
6870
static int socket_read(int sock, unsigned char* data, int* len);
6971
static int socket_close(int sock);
7072

71-
static Uint64 time_getmillisec(void);
72-
7373
static char* trim(char* line)
7474
{
7575
if(line && *line)
@@ -361,7 +361,7 @@ static void mdm_escape(Uint8 data)
361361
mdm_time_buf[0] = mdm_time_buf[1];
362362
mdm_time_buf[1] = mdm_time_buf[2];
363363
mdm_time_buf[2] = mdm_time_buf[3];
364-
mdm_time_buf[3] = time_getmillisec();
364+
mdm_time_buf[3] = SDL_GetTicks();
365365

366366
if( mdm_cmd_buf[1] == '+' && mdm_cmd_buf[2] == '+' && mdm_cmd_buf[3] == '+')
367367
{
@@ -436,7 +436,7 @@ SDL_bool acia_init_modem( struct acia* acia )
436436
mdm_in_buf[0] = 0x00;
437437
mdm_out_buf[0] = 0x00;
438438
memset(mdm_cmd_buf, 0, sizeof(Uint8)*CMD_BUF_SIZE);
439-
memset(mdm_time_buf, 0, sizeof(Uint64)*CMD_BUF_SIZE);
439+
memset(mdm_time_buf, 0, sizeof(Uint32)*CMD_BUF_SIZE);
440440

441441
acia->done = modem_done;
442442
acia->stat = modem_stat;
@@ -764,21 +764,4 @@ int socket_close(int sock)
764764
return 1;
765765
}
766766

767-
static Uint64 time_getmillisec(void)
768-
{
769-
#ifdef __LINUX__
770-
struct timespec ts;
771-
clock_gettime(CLOCK_MONOTONIC, &ts);
772-
return ((ts.tv_sec * 1000000000) + ts.tv_nsec)/1000;
773-
#endif
774-
#if defined(__APPLE__) || defined(__amigaos4__) || defined(__MORPHOS__)
775-
struct timeval ts;
776-
gettimeofday(&ts, NULL);
777-
return ((ts.tv_sec * 1000000LL) + ts.tv_usec)/1000LL;
778-
#endif
779-
#ifdef WIN32
780-
return GetTickCount();
781-
#endif
782-
}
783-
784767
#endif /* BACKEND_MODEM */

oricutron.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ lightpen = no
134134
; baudrate, data bits, parity and stop bits can be set as needed
135135
; ex.: Windows: 'com:115200,8,N,1,COM1'
136136
; Linux: 'com:115200,8,N,1,/dev/ttyUSB0'
137-
serial = 'none'
137+
serial = 'modem'
138138

139139
; Joystick interface for Atmos/Oric-1 mode. Telestrat has its own built-in standard.
140140
; Options are 'none', 'altai', 'pase' or 'ijk'

0 commit comments

Comments
 (0)