Merge pull request #303 from TC1995/master

NE/2 changed to a NE/2 compatible card (Ethernext/MC).
This commit is contained in:
OBattler
2018-08-11 19:12:02 +02:00
committed by GitHub
6 changed files with 155 additions and 95 deletions

View File

@@ -9,10 +9,11 @@
* Implementation of the following network controllers:
* - Novell NE1000 (ISA 8-bit);
* - Novell NE2000 (ISA 16-bit);
* - Novell NE/2 compatible (NetWorth Inc. Ethernext/MC) (MCA 16-bit);
* - Realtek RTL8019AS (ISA 16-bit, PnP);
* - Realtek RTL8029AS (PCI).
*
* Version: @(#)net_ne2000.c 1.0.7 2018/07/24
* Version: @(#)net_ne2000.c 1.0.8 2018/08/11
*
* Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy
*
@@ -459,25 +460,6 @@ asic_read(nic_t *dev, uint32_t off, unsigned int len)
case 0x0f: /* Reset register */
nic_soft_reset(dev);
break;
case 0x10:
case 0x11:
case 0x12:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x18:
case 0x19:
case 0x1a:
case 0x1b:
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
retval = 0;
break;
default:
nelog(3, "%s: ASIC read invalid address %04x\n",
@@ -531,25 +513,7 @@ asic_write(nic_t *dev, uint32_t off, uint32_t val, unsigned len)
case 0x0f: /* Reset register */
/* end of reset pulse */
break;
case 0x10:
case 0x11:
case 0x12:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x18:
case 0x19:
case 0x1a:
case 0x1b:
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
break;
break;
default: /* this is invalid, but happens under win95 device detection */
nelog(3, "%s: ASIC write invalid address %04x, ignoring\n",
@@ -1739,18 +1703,7 @@ nic_iocheckremove(nic_t *dev, uint16_t addr)
static void
nic_ioset(nic_t *dev, uint16_t addr)
{
if (dev->is_mca) {
io_sethandler(addr, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
io_sethandler(addr+16, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
io_sethandler(addr+0x1f, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
}
else if (dev->is_pci) {
if (dev->is_pci) {
io_sethandler(addr, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
@@ -1783,18 +1736,7 @@ nic_ioset(nic_t *dev, uint16_t addr)
static void
nic_ioremove(nic_t *dev, uint16_t addr)
{
if (dev->is_mca) {
io_removehandler(addr, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
io_removehandler(addr+16, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
io_removehandler(addr+0x1f, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
}
else if (dev->is_pci) {
if (dev->is_pci) {
io_removehandler(addr, 16,
nic_readb, nic_readw, nic_readl,
nic_writeb, nic_writew, nic_writel, dev);
@@ -2272,17 +2214,17 @@ nic_mca_read(int port, void *priv)
return(dev->pos_regs[port & 7]);
}
#define MCA_7154_IO_PORTS { 0x1000, 0x2020, 0x8020, 0xa0a0, 0xb0b0, 0xc0c0, \
0xc3d0 }
#define MCA_611F_IO_PORTS { 0x300, 0x340, 0x320, 0x360, 0x1300, 0x1340, \
0x1320, 0x1360 }
#define MCA_7154_IRQS { 3, 4, 5, 9 }
#define MCA_611F_IRQS { 2, 3, 4, 5, 10, 11, 12, 15 }
static void
nic_mca_write(int port, uint8_t val, void *priv)
{
nic_t *dev = (nic_t *)priv;
uint16_t novell_base[7] = MCA_7154_IO_PORTS;
int8_t novell_irq[4] = MCA_7154_IRQS;
uint16_t base[] = MCA_611F_IO_PORTS;
int8_t irq[] = MCA_611F_IRQS;
/* MCA does not write registers below 0x0100. */
if (port < 0x0102) return;
@@ -2294,10 +2236,10 @@ nic_mca_write(int port, uint8_t val, void *priv)
/* This is always necessary so that the old handler doesn't remain. */
/* Get the new assigned I/O base address. */
dev->base_address = novell_base[((dev->pos_regs[2] & 0xE) >> 1) - 1];
dev->base_address = base[(dev->pos_regs[2] & 0xE0) >> 4];
/* Save the new IRQ values. */
dev->base_irq = novell_irq[(dev->pos_regs[2] & 0x60) >> 5];
dev->base_irq = irq[(dev->pos_regs[2] & 0xE) >> 1];
dev->bios_addr = 0x0000;
dev->has_bios = 0;
@@ -2315,6 +2257,11 @@ nic_mca_write(int port, uint8_t val, void *priv)
/* Card enabled; register (new) I/O handler. */
nic_ioset(dev, dev->base_address);
nic_reset(dev);
nelog(2, "EtherNext/MC: Port=%04x, IRQ=%d\n", dev->base_address, dev->base_irq);
}
}
@@ -2354,14 +2301,12 @@ nic_init(const device_t *info)
rom = (dev->board == NE2K_NE1000) ? NULL : ROM_PATH_NE2000;
break;
case NE2K_NE2_MCA:
nelog(3, "NE/2 adapter\n");
dev->is_mca = 1;
dev->maclocal[0] = 0x00; /* 00:00:D8 (Novell OID) */
case NE2K_ETHERNEXT_MC:
dev->maclocal[0] = 0x00; /* 00:00:D8 (Networth Inc. OID) */
dev->maclocal[1] = 0x00;
dev->maclocal[2] = 0xD8;
dev->pos_regs[0] = 0x54;
dev->pos_regs[1] = 0x71;
dev->maclocal[2] = 0x79;
dev->pos_regs[0] = 0x1F;
dev->pos_regs[1] = 0x61;
rom = NULL;
break;
@@ -2386,7 +2331,7 @@ nic_init(const device_t *info)
dev->has_bios = 0;
}
} else {
if (dev->board != NE2K_NE2_MCA) {
if (dev->board != NE2K_ETHERNEXT_MC) {
dev->base_address = device_get_config_hex16("base");
dev->base_irq = device_get_config_int("irq");
if (dev->board == NE2K_NE2000) {
@@ -2409,7 +2354,7 @@ nic_init(const device_t *info)
* Make this device known to the I/O system.
* PnP and PCI devices start with address spaces inactive.
*/
if (dev->board < NE2K_RTL8019AS && dev->board != NE2K_NE2_MCA)
if (dev->board < NE2K_RTL8019AS && dev->board != NE2K_ETHERNEXT_MC)
nic_ioset(dev, dev->base_address);
/* Set up our BIOS ROM space, if any. */
@@ -2432,7 +2377,7 @@ nic_init(const device_t *info)
}
memcpy(dev->dp8390.physaddr, dev->maclocal, sizeof(dev->maclocal));
nelog(0, "%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
nelog(2, "%s: I/O=%04x, IRQ=%d, MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
dev->name, dev->base_address, dev->base_irq,
dev->dp8390.physaddr[0], dev->dp8390.physaddr[1], dev->dp8390.physaddr[2],
dev->dp8390.physaddr[3], dev->dp8390.physaddr[4], dev->dp8390.physaddr[5]);
@@ -2570,8 +2515,9 @@ nic_init(const device_t *info)
}
}
/* Reset the board. */
nic_reset(dev);
if (dev->board != NE2K_ETHERNEXT_MC)
/* Reset the board. */
nic_reset(dev);
/* Attach ourselves to the network module. */
network_attach(dev, dev->dp8390.physaddr, nic_rx);
@@ -2796,10 +2742,10 @@ const device_t ne2000_device = {
ne2000_config
};
const device_t ne2_device = {
"Novell NE/2",
const device_t ethernext_mc_device = {
"NetWorth EtherNext/MC",
DEVICE_MCA,
NE2K_NE2_MCA,
NE2K_ETHERNEXT_MC,
nic_init, nic_close, NULL,
NULL, NULL, NULL,
mca_mac_config

View File

@@ -8,7 +8,7 @@
*
* Definitions for the NE2000 ethernet controller.
*
* Version: @(#)net_ne2000.h 1.0.3 2018/07/19
* Version: @(#)net_ne2000.h 1.0.4 2018/08/11
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -40,7 +40,7 @@ enum {
NE2K_NONE = 0,
NE2K_NE1000 = 1, /* 8-bit ISA NE1000 */
NE2K_NE2000 = 2, /* 16-bit ISA NE2000 */
NE2K_NE2_MCA = 3, /* 16-bit MCA NE/2 */
NE2K_ETHERNEXT_MC = 3, /* 16-bit MCA EtherNext/MC */
NE2K_RTL8019AS = 4, /* 16-bit ISA PnP Realtek 8019AS */
NE2K_RTL8029AS = 5 /* 32-bit PCI Realtek 8029AS */
};
@@ -48,7 +48,7 @@ enum {
extern const device_t ne1000_device;
extern const device_t ne2000_device;
extern const device_t ne2_device;
extern const device_t ethernext_mc_device;
extern const device_t rtl8019as_device;
extern const device_t rtl8029as_device;

View File

@@ -12,7 +12,7 @@
* it should be malloc'ed and then linked to the NETCARD def.
* Will be done later.
*
* Version: @(#)network.c 1.0.6 2018/06/19
* Version: @(#)network.c 1.0.7 2018/08/11
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*
@@ -80,7 +80,7 @@ static netcard_t net_cards[] = {
NULL },
{ "[ISA] Western Digital WD8013EBT","wd8013ebt", &wd8013ebt_device,
NULL },
{ "[MCA] Novell NE/2", "ne2", &ne2_device,
{ "[MCA] NetWorth Ethernet/MC", "ethernextmc", &ethernext_mc_device,
NULL },
{ "[MCA] Western Digital WD8013EP/A","wd8013epa", &wd8013epa_device,
NULL },

View File

@@ -1,7 +1,21 @@
/*PCem v0.8 by Tom Walker
Windows Sound System emulation*/
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Windows Sound System emulation.
*
* Version: @(#)snd_wss.c 1.0.0 2018/08/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* TheCollector1995, <mariogplayer@gmail.com>
*
* Copyright 2012-2018 Sarah Walker.
* Copyright 2018 TheCollector1995.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@@ -10,6 +24,7 @@
#include <math.h>
#include "../86box.h"
#include "../io.h"
#include "../mca.h"
#include "../pic.h"
#include "../dma.h"
#include "../device.h"
@@ -40,6 +55,9 @@ typedef struct wss_t
ad1848_t ad1848;
opl_t opl;
int opl_enabled;
uint8_t pos_regs[8];
} wss_t;
uint8_t wss_read(uint16_t addr, void *p)
@@ -98,6 +116,66 @@ void *wss_init(const device_t *info)
return wss;
}
static uint8_t ncr_audio_mca_read(int port, void *p)
{
wss_t *wss = (wss_t *)p;
return wss->pos_regs[port & 7];
}
static void ncr_audio_mca_write(int port, uint8_t val, void *p)
{
wss_t *wss = (wss_t *)p;
uint16_t ports[4] = {0x530, 0xE80, 0xF40, 0x604};
uint16_t addr;
if (port < 0x102)
return;
wss->opl_enabled = (wss->pos_regs[2] & 0x20) ? 1 : 0;
addr = ports[(wss->pos_regs[2] & 0x18) >> 3];
io_removehandler(0x0388, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &wss->opl);
io_removehandler(addr, 0x0004, wss_read, NULL, NULL, wss_write, NULL, NULL, wss);
io_removehandler(addr+4, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &wss->ad1848);
//pclog("WSS MCA: opl=%d, addr=%03x\n", wss->opl_enabled, addr);
wss->pos_regs[port & 7] = val;
if (wss->pos_regs[2] & 1)
{
addr = ports[(wss->pos_regs[2] & 0x18) >> 3];
if (wss->opl_enabled)
io_sethandler(0x0388, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &wss->opl);
io_sethandler(addr, 0x0004, wss_read, NULL, NULL, wss_write, NULL, NULL, wss);
io_sethandler(addr+4, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &wss->ad1848);
}
}
void *ncr_audio_init(const device_t *info)
{
wss_t *wss = malloc(sizeof(wss_t));
memset(wss, 0, sizeof(wss_t));
opl3_init(&wss->opl);
ad1848_init(&wss->ad1848);
ad1848_setirq(&wss->ad1848, 7);
ad1848_setdma(&wss->ad1848, 3);
mca_add(ncr_audio_mca_read, ncr_audio_mca_write, wss);
wss->pos_regs[0] = 0x16;
wss->pos_regs[1] = 0x51;
sound_add_handler(wss_get_buffer, wss);
return wss;
}
void wss_close(void *p)
{
wss_t *wss = (wss_t *)p;
@@ -122,3 +200,14 @@ const device_t wss_device =
NULL,
NULL
};
const device_t ncr_business_audio_device =
{
"NCR Business Audio",
DEVICE_MCA, 0,
ncr_audio_init, wss_close, NULL,
NULL,
wss_speed_changed,
NULL,
NULL
};

View File

@@ -1 +1,25 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Windows Sound System emulation.
*
* Version: @(#)snd_wss.c 1.0.0 2018/08/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* TheCollector1995, <mariogplayer@gmail.com>
*
* Copyright 2012-2018 Sarah Walker.
* Copyright 2018 TheCollector1995.
*/
#ifndef SND_WSS_H
# define SND_WSS_H
extern const device_t wss_device;
extern const device_t ncr_business_audio_device;
#endif /*SND_WSS_H*/

View File

@@ -8,7 +8,7 @@
*
* Sound emulation core.
*
* Version: @(#)sound.c 1.0.17 2018/04/29
* Version: @(#)sound.c 1.0.18 2018/08/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -100,6 +100,7 @@ static const SOUND_CARD sound_cards[] =
#endif
{ "[ISA] Windows Sound System", "wss", &wss_device },
{ "[MCA] Adlib", "adlib_mca", &adlib_mca_device },
{ "[MCA] NCR Business Audio","ncraudio", &ncr_business_audio_device },
{ "[MCA] Sound Blaster MCV", "sbmcv", &sb_mcv_device },
{ "[MCA] Sound Blaster Pro MCV","sbpromcv", &sb_pro_mcv_device },
{ "[PCI] Ensoniq AudioPCI (ES1371)","es1371", &es1371_device},