Increased maximum number of timers to 64;

Redid some things in serial_old.c;
Made win_serial.c only compile and link if make is started with WALTJE=y;
The NVR path text box in the Settings dialog now has ES_AUTOHSCROLL set.
This commit is contained in:
OBattler
2017-07-18 19:22:16 +02:00
parent 95ac6ebe1d
commit 89fd3e467f
6 changed files with 63 additions and 46 deletions

View File

@@ -133,6 +133,7 @@ endif
ifeq ($(WALTJE), y)
SERIAL = serial.o
WSERIAL = win_serial.o
WFLAGS = -DWALTJE
else
SERIAL = serial_old.o
@@ -241,7 +242,7 @@ WINOBJ = win.o \
win_ddraw.o win_ddraw_fs.o win_ddraw_screenshot.o \
win_d3d.o win_d3d_fs.o \
win_language.o win_status.o win_opendir.o win_dynld.o \
win_video.o win_serial.o win_keyboard.o win_mouse.o \
win_video.o $(WSERIAL) win_keyboard.o win_mouse.o \
win_iodev.o win_joystick.o win_midi.o \
win_settings.o win_deviceconfig.o win_joystickconfig.o \
86Box.res

View File

@@ -255,7 +255,7 @@ BEGIN
12,12
LTEXT "MB",IDT_1705,123,64,10,10
LTEXT "Memory:",IDT_1706,7,64,30,10
LTEXT "NVR Path:",IDT_1700,7,83,60,10
LTEXT "NVR Path:",IDT_1700,7,83,60,10,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_NVR_PATH,71,82,138,12
PUSHBUTTON "&Specify...",IDC_BUTTON_NVR_PATH,214,82,46,12
CONTROL "Dynamic Recompiler",IDC_CHECK_DYNAREC,"Button",

View File

@@ -204,7 +204,7 @@ void gameport_update_joystick_type()
void *gameport_init()
{
gameport_t *gameport;
gameport_t *gameport = NULL;
if (joystick_type == 7)
{

View File

@@ -366,7 +366,9 @@ void initmodules(void)
/* Initialize modules. */
network_init();
mouse_init();
#ifdef WALTJE
serial_init();
#endif
disc_random_init();
joystick_init();

View File

@@ -244,7 +244,7 @@ void serial_recieve_callback(void *p)
}
}
uint16_t base_address[2] = { 0x3f8, 0x2f8 };
uint16_t base_address[2] = { 0x0000, 0x0000 };
void serial_remove(int port)
{
@@ -259,68 +259,82 @@ void serial_remove(int port)
return;
}
if (!base_address[port - 1])
{
return;
}
pclog("Removing serial port %i at %04X...\n", port, base_address[port - 1]);
io_removehandler(base_address[port - 1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, (port == 1) ? &serial1 : &serial2);
base_address[port - 1] = 0x0000;
switch(port)
{
case 1:
io_removehandler(base_address[0], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
base_address[0] = 0x0000;
break;
case 2:
io_removehandler(base_address[1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
base_address[1] = 0x0000;
break;
}
}
void serial_setup(int port, uint16_t addr, int irq)
{
SERIAL *p;
if ((port < 1) || (port > 2))
{
fatal("serial_setup(): Invalid serial port: %i\n", port);
exit(-1);
}
if (!serial_enabled[port - 1])
{
return;
}
if (base_address[port - 1] != 0x0000)
{
serial_remove(port);
}
if (addr == 0x0000)
{
pclog("Serial port %i at %04X, ignoring...\n", port, base_address[port - 1]);
return;
}
if (port == 1)
{
p = &serial1;
}
else if (port == 2)
{
p = &serial2;
}
pclog("Adding serial port %i at %04X...\n", port, addr);
base_address[port - 1] = addr;
io_sethandler(base_address[port - 1], 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, p);
p->irq = irq;
switch(port)
{
case 1:
if (base_address[0] != 0x0000)
{
serial_remove(port);
}
if (addr != 0x0000)
{
base_address[0] = addr;
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
}
serial1.irq = irq;
break;
case 2:
if (base_address[1] != 0x0000)
{
serial_remove(port);
}
if (addr != 0x0000)
{
base_address[1] = addr;
io_sethandler(addr, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
}
serial2.irq = irq;
break;
default:
fatal("serial_setup(): Invalid serial port: %i\n", port);
break;
}
}
void serial_init(void)
{
base_address[0] = 0x03f8;
base_address[1] = 0x02f8;
if (serial_enabled[0])
{
pclog("Adding serial port 1...\n");
serial_setup(1, 0x3f8, 4);
memset(&serial1, 0, sizeof(serial1));
io_sethandler(0x3f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial1);
serial1.irq = 4;
serial1.rcr_callback = NULL;
timer_add(serial_recieve_callback, &serial1.recieve_delay, &serial1.recieve_delay, &serial1);
}
if (serial_enabled[1])
{
pclog("Adding serial port 2...\n");
serial_setup(2, 0x2f8, 3);
memset(&serial2, 0, sizeof(serial2));
io_sethandler(0x2f8, 0x0008, serial_read, NULL, NULL, serial_write, NULL, NULL, &serial2);
serial2.irq = 3;
serial2.rcr_callback = NULL;
timer_add(serial_recieve_callback, &serial2.recieve_delay, &serial2.recieve_delay, &serial2);
}

View File

@@ -8,7 +8,7 @@
#include "sound_wss.h"*/
#include "timer.h"
#define TIMERS_MAX 32
#define TIMERS_MAX 64
int TIMER_USEC;