diff --git a/src/device.c b/src/device.c index 6fadc901b7..42cc7344af 100644 --- a/src/device.c +++ b/src/device.c @@ -494,6 +494,8 @@ device_get_name(const device_t *dev, int bus, char *name) sbus = "COM"; else if (dev->flags & DEVICE_LPT) sbus = "LPT"; + else if (dev->flags & DEVICE_PCMCIA) + sbus = "PCMCIA"; if (sbus != NULL) { /* First concatenate [] before the device's name. */ @@ -758,7 +760,7 @@ device_is_valid(const device_t *device, int m) if ((device->flags & DEVICE_CBUS) && !machine_has_bus(m, MACHINE_BUS_CBUS)) return 0; - if ((device->flags & DEVICE_PCMCIA) && !machine_has_bus(m, MACHINE_BUS_PCMCIA)) + if ((device->flags & DEVICE_PCMCIA) && !machine_has_bus(m, MACHINE_BUS_PCMCIA) && !machine_has_bus(m, MACHINE_BUS_ISA)) return 0; if ((device->flags & DEVICE_MCA) && !machine_has_bus(m, MACHINE_BUS_MCA)) diff --git a/src/include/86box/network.h b/src/include/86box/network.h index 9588de86a2..7613ae590a 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -211,6 +211,7 @@ extern const device_t ne1000_device; extern const device_t ne1000_compat_device; extern const device_t ne2000_device; extern const device_t ne2000_compat_device; +extern const device_t ne2000_compat_pcmcia_device; extern const device_t ethernext_mc_device; extern const device_t rtl8019as_device; extern const device_t de220p_device; diff --git a/src/include/86box/pcmcia.h b/src/include/86box/pcmcia.h index a190fab585..6e462e0211 100644 --- a/src/include/86box/pcmcia.h +++ b/src/include/86box/pcmcia.h @@ -38,7 +38,7 @@ struct pcmcia_socket_t { void (*ready_changed)(bool ready, pcmcia_socket_t* socket); /* Signals interrupt to the socket. */ - void (*interrupt)(bool set, pcmcia_socket_t* socket); + void (*interrupt)(bool set, bool level, pcmcia_socket_t* socket); /* Resets the card. */ void (*reset)(void *priv); diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index 4d8df5f0d9..927e1bdcc1 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -199,7 +199,7 @@ nic_interrupt(void *priv, int set) nic_t *dev = (nic_t *) priv; if (dev->pcmcia_socket) { - dev->pcmcia_socket->interrupt(!!set, dev->pcmcia_socket); + dev->pcmcia_socket->interrupt(!!set, !!(dev->pcmcia_config & (1 << 6)), dev->pcmcia_socket); return; } @@ -990,10 +990,7 @@ nic_pcmcia_read(uint32_t addr, int reg, void* priv) static uint16_t nic_pcmcia_readw(uint32_t addr, int reg, void* priv) { - if ((addr & 1) && !reg) - return nic_pcmcia_read(addr + 1, reg, priv) << 8; - - return nic_pcmcia_read(addr, reg, priv); + return nic_pcmcia_read(addr, reg, priv) | (nic_pcmcia_read(addr + 1, reg, priv) << 8); } static void @@ -1022,7 +1019,8 @@ nic_pcmcia_write(uint32_t addr, uint8_t val, int reg, void* priv) static void nic_pcmcia_writew(uint32_t addr, uint16_t val, int reg, void* priv) { - nic_pcmcia_writew(addr, val, reg, priv); + nic_pcmcia_write(addr, val & 0xFF, reg, priv); + nic_pcmcia_write(addr + 1, (val >> 8) & 0xFF, reg, priv); } static void diff --git a/src/network/network.c b/src/network/network.c index d0ebe8ef38..cf23b789fe 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -115,6 +115,7 @@ static const device_t *net_cards[] = { &de220p_device, &ne1000_compat_device, &ne2000_compat_device, + &ne2000_compat_pcmcia_device, &ne1000_device, &ne2000_device, &pcnet_am79c960_eb_device, diff --git a/src/pcmcia.c b/src/pcmcia.c index d95959ca44..af713474f9 100644 --- a/src/pcmcia.c +++ b/src/pcmcia.c @@ -8,12 +8,15 @@ #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/io.h> +#include <86box/device.h> #include <86box/timer.h> #include <86box/pcmcia.h> static pcmcia_socket_t *pcmcia_sockets[4]; static uint8_t pcmcia_registered_sockets_num = 0; +extern const device_t pd6710_device; + void pcmcia_reset(void) { @@ -35,6 +38,9 @@ pcmcia_socket_is_free(pcmcia_socket_t *socket) pcmcia_socket_t * pcmcia_search_for_slots(void) { + if (!pcmcia_registered_sockets_num) { + device_add(&pd6710_device); + } for (int i = 0; i < pcmcia_registered_sockets_num; i++) { if (pcmcia_sockets[i] && !pcmcia_sockets[i]->card_priv) return pcmcia_sockets[i]; diff --git a/src/pcmcia/pcmcia_socket_pd6710.c b/src/pcmcia/pcmcia_socket_pd6710.c index f860a9a96e..4b2df74eaf 100644 --- a/src/pcmcia/pcmcia_socket_pd6710.c +++ b/src/pcmcia/pcmcia_socket_pd6710.c @@ -135,13 +135,17 @@ pd67xx_mgmt_interrupt(pcmcia_socket_pd67xx *pd67xx, int set) if (set && !!((pd67xx->management_interrupt_conf >> 4) & 0xF)) picint(1 << (pd67xx->management_interrupt_conf >> 4)); + else if (!!((pd67xx->management_interrupt_conf >> 4) & 0xF)) { + picintc(1 << (pd67xx->management_interrupt_conf >> 4)); + } } void -pd67xx_card_interrupt(bool set, pcmcia_socket_t *socket) +pd67xx_card_interrupt(bool set, bool level, pcmcia_socket_t *socket) { pcmcia_socket_pd67xx *pd67xx = socket->socket_priv; - bool level = !!(pd67xx->misc_control_1 & (1 << 3)); + if (pd67xx->misc_control_1 & (1 << 3)) + level = false; if (set && !!(pd67xx->interrupt_general_control & 0xF)) { if (level) picintlevel(1 << (pd67xx->interrupt_general_control), &pd67xx->irq_state); @@ -149,6 +153,8 @@ pd67xx_card_interrupt(bool set, pcmcia_socket_t *socket) picint(1 << (pd67xx->interrupt_general_control)); } else if (!set && level) picintclevel(1 << (pd67xx->interrupt_general_control), &pd67xx->irq_state); + else + picintc(1 << (pd67xx->interrupt_general_control)); } void @@ -198,7 +204,7 @@ pd67xx_ready_changed(bool status, pcmcia_socket_t *socket) bool signal_change = false; if (pd67xx->interrupt_general_control & (1 << 5)) { - pd67xx_card_interrupt(!status, socket); + pd67xx_card_interrupt(!status, true, socket); return; } @@ -827,7 +833,8 @@ pd67xx_reset(void *priv) pcmcia_socket_pd67xx *pd67xx = priv; int i = 0; - pd67xx_card_interrupt(false, &pd67xx->socket); + pd67xx_card_interrupt(false, false, &pd67xx->socket); + pd67xx_card_interrupt(false, true, &pd67xx->socket); pd67xx_mgmt_interrupt(pd67xx, false); pd67xx->mapping_enable = 0; @@ -881,6 +888,7 @@ pd6710_init(const device_t *info) pd67xx->socket.card_inserted = pd67xx_card_inserted; pd67xx->socket.ready_changed = pd67xx_ready_changed; pd67xx->socket.status_changed = pd67xx_status_changed; + pd67xx->socket.socket_priv = pd67xx; io_sethandler(0x3e0, 2, pd67xx_port_read, NULL, NULL, pd67xx_port_write, NULL, NULL, pd67xx);