diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 7019473a8..76c61c83b 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -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 diff --git a/src/WIN/86Box.rc b/src/WIN/86Box.rc index 693244026..7e79008c3 100644 --- a/src/WIN/86Box.rc +++ b/src/WIN/86Box.rc @@ -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", diff --git a/src/gameport.c b/src/gameport.c index a80d962b7..7cb0e0142 100644 --- a/src/gameport.c +++ b/src/gameport.c @@ -204,7 +204,7 @@ void gameport_update_joystick_type() void *gameport_init() { - gameport_t *gameport; + gameport_t *gameport = NULL; if (joystick_type == 7) { diff --git a/src/pc.c b/src/pc.c index dc4ba68ae..0df42a936 100644 --- a/src/pc.c +++ b/src/pc.c @@ -366,7 +366,9 @@ void initmodules(void) /* Initialize modules. */ network_init(); mouse_init(); +#ifdef WALTJE serial_init(); +#endif disc_random_init(); joystick_init(); diff --git a/src/serial_old.c b/src/serial_old.c index 639c792cd..c6bc83e4c 100644 --- a/src/serial_old.c +++ b/src/serial_old.c @@ -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); } diff --git a/src/timer.c b/src/timer.c index d3fd618a7..82eabe39c 100644 --- a/src/timer.c +++ b/src/timer.c @@ -8,7 +8,7 @@ #include "sound_wss.h"*/ #include "timer.h" -#define TIMERS_MAX 32 +#define TIMERS_MAX 64 int TIMER_USEC;