Merge branch '86Box:master' into nec-v20

This commit is contained in:
Jasmine Iwanek
2022-02-18 17:39:47 -05:00
committed by GitHub
14 changed files with 209 additions and 119 deletions

View File

@@ -3,6 +3,9 @@ name: CMake
on: on:
push: push:
branches:
- master
paths: paths:
- src/** - src/**
- "**/CMakeLists.txt" - "**/CMakeLists.txt"
@@ -12,6 +15,9 @@ on:
- "!**/Makefile*" - "!**/Makefile*"
pull_request: pull_request:
branches:
- master
paths: paths:
- src/** - src/**
- "**/CMakeLists.txt" - "**/CMakeLists.txt"
@@ -25,7 +31,7 @@ jobs:
msys2: msys2:
name: MSYS2 ${{ matrix.build.name }} build (${{ matrix.environment.msystem }}) name: MSYS2 ${{ matrix.build.name }} build (${{ matrix.environment.msystem }})
runs-on: windows-latest runs-on: windows-2022
defaults: defaults:
run: run:
@@ -35,10 +41,10 @@ jobs:
fail-fast: true fail-fast: true
matrix: matrix:
build: build:
- name: Regular ODR # - name: Regular ODR
slug: -ODR # slug: -ODR
preset: regular # preset: regular
target: install/strip # target: install/strip
- name: Debug ODR - name: Debug ODR
slug: -ODR-Debug slug: -ODR-Debug
preset: debug preset: debug
@@ -47,10 +53,10 @@ jobs:
slug: -ODR-Dev slug: -ODR-Dev
preset: experimental preset: experimental
target: install target: install
- name: Regular NDR # - name: Regular NDR
slug: -NDR # slug: -NDR
preset: regularndr # preset: regularndr
target: install/strip # target: install/strip
- name: Debug NDR - name: Debug NDR
slug: -NDR-Debug slug: -NDR-Debug
preset: debugndr preset: debugndr
@@ -68,8 +74,8 @@ jobs:
prefix: mingw-w64-ucrt-x86_64 prefix: mingw-w64-ucrt-x86_64
# - msystem: CLANG32 # - msystem: CLANG32
# prefix: mingw-w64-clang-i686 # prefix: mingw-w64-clang-i686
- msystem: CLANG64 # - msystem: CLANG64
prefix: mingw-w64-clang-x86_64 # prefix: mingw-w64-clang-x86_64
steps: steps:
- uses: msys2/setup-msys2@v2 - uses: msys2/setup-msys2@v2
@@ -114,12 +120,12 @@ jobs:
fail-fast: true fail-fast: true
matrix: matrix:
build: build:
- name: Regular ODR # - name: Regular ODR
slug: -ODR # slug: -ODR
type: Release # type: Release
dev-build: off # dev-build: off
new-dynarec: off # new-dynarec: off
strip: --strip # strip: --strip
- name: Debug ODR - name: Debug ODR
slug: -ODR-Debug slug: -ODR-Debug
type: Debug type: Debug
@@ -130,12 +136,12 @@ jobs:
type: Debug type: Debug
dev-build: on dev-build: on
new-dynarec: off new-dynarec: off
- name: Regular NDR # - name: Regular NDR
slug: -NDR # slug: -NDR
type: Release # type: Release
strip: --strip # strip: --strip
dev-build: off # dev-build: off
new-dynarec: on # new-dynarec: on
- name: Debug NDR - name: Debug NDR
slug: -NDR-Debug slug: -NDR-Debug
type: Debug type: Debug
@@ -210,18 +216,18 @@ jobs:
linux: linux:
name: "Linux GCC 11 (${{ matrix.build.name }} x86_64)" name: "Linux GCC 11 (${{ matrix.build.name }} x86_64)"
runs-on: ubuntu-latest runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
build: build:
- name: Regular ODR # - name: Regular ODR
slug: -ODR # slug: -ODR
type: Release # type: Release
dev-build: off # dev-build: off
new-dynarec: off # new-dynarec: off
strip: --strip # strip: --strip
- name: Debug ODR - name: Debug ODR
slug: -ODR-Debug slug: -ODR-Debug
type: Debug type: Debug
@@ -232,12 +238,12 @@ jobs:
type: Debug type: Debug
dev-build: on dev-build: on
new-dynarec: off new-dynarec: off
- name: Regular NDR # - name: Regular NDR
slug: -NDR # slug: -NDR
type: Release # type: Release
strip: --strip # strip: --strip
dev-build: off # dev-build: off
new-dynarec: on # new-dynarec: on
- name: Debug NDR - name: Debug NDR
slug: -NDR-Debug slug: -NDR-Debug
type: Debug type: Debug
@@ -280,12 +286,12 @@ jobs:
fail-fast: true fail-fast: true
matrix: matrix:
build: build:
- name: Regular ODR # - name: Regular ODR
slug: -ODR # slug: -ODR
type: Release # type: Release
dev-build: off # dev-build: off
new-dynarec: off # new-dynarec: off
strip: --strip # strip: --strip
- name: Debug ODR - name: Debug ODR
slug: -ODR-Debug slug: -ODR-Debug
type: Debug type: Debug
@@ -296,12 +302,12 @@ jobs:
type: Debug type: Debug
dev-build: on dev-build: on
new-dynarec: off new-dynarec: off
- name: Regular NDR # - name: Regular NDR
slug: -NDR # slug: -NDR
type: Release # type: Release
strip: --strip # strip: --strip
dev-build: off # dev-build: off
new-dynarec: on # new-dynarec: on
- name: Debug NDR - name: Debug NDR
slug: -NDR-Debug slug: -NDR-Debug
type: Debug type: Debug

View File

@@ -31,7 +31,7 @@ if(MUNT_EXTERNAL)
endif() endif()
project(86Box project(86Box
VERSION 3.2.1 VERSION 3.3
DESCRIPTION "Emulator of x86-based systems" DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.net" HOMEPAGE_URL "https://86box.net"
LANGUAGES C CXX) LANGUAGES C CXX)

View File

@@ -414,7 +414,7 @@ isapnp_write_addr(uint16_t addr, uint8_t val, void *priv)
if (!dev->key_pos) { if (!dev->key_pos) {
isapnp_log("ISAPnP: Key unlocked, putting cards to SLEEP\n"); isapnp_log("ISAPnP: Key unlocked, putting cards to SLEEP\n");
while (card) { while (card) {
if (card->enable && (card->state == PNP_STATE_WAIT_FOR_KEY)) if (card->enable && (card->enable != ISAPNP_CARD_NO_KEY) && (card->state == PNP_STATE_WAIT_FOR_KEY))
card->state = PNP_STATE_SLEEP; card->state = PNP_STATE_SLEEP;
card = card->next; card = card->next;
} }
@@ -974,14 +974,12 @@ isapnp_enable_card(void *priv, uint8_t enable)
/* Look for a matching card. */ /* Look for a matching card. */
isapnp_card_t *card = dev->first_card; isapnp_card_t *card = dev->first_card;
uint8_t will_enable;
while (card) { while (card) {
if (card == priv) { if (card == priv) {
/* Enable or disable the card. */ /* Enable or disable the card. */
will_enable = (enable >= ISAPNP_CARD_ENABLE); if (!!enable ^ !!card->enable)
if (will_enable ^ card->enable)
card->state = (enable == ISAPNP_CARD_FORCE_CONFIG) ? PNP_STATE_CONFIG : PNP_STATE_WAIT_FOR_KEY; card->state = (enable == ISAPNP_CARD_FORCE_CONFIG) ? PNP_STATE_CONFIG : PNP_STATE_WAIT_FOR_KEY;
card->enable = will_enable; card->enable = enable;
/* Invalidate other references if we're disabling this card. */ /* Invalidate other references if we're disabling this card. */
if (!card->enable) { if (!card->enable) {

View File

@@ -28,7 +28,8 @@
enum { enum {
ISAPNP_CARD_DISABLE = 0, ISAPNP_CARD_DISABLE = 0,
ISAPNP_CARD_ENABLE = 1, ISAPNP_CARD_ENABLE = 1,
ISAPNP_CARD_FORCE_CONFIG /* cheat code for UMC UM8669F */ ISAPNP_CARD_FORCE_CONFIG, /* cheat code for UMC UM8669F */
ISAPNP_CARD_NO_KEY /* cheat code for Crystal CS423x */
}; };

View File

@@ -23,6 +23,7 @@ enum {
AD1848_TYPE_DEFAULT = 0, AD1848_TYPE_DEFAULT = 0,
AD1848_TYPE_CS4248, AD1848_TYPE_CS4248,
AD1848_TYPE_CS4231, AD1848_TYPE_CS4231,
AD1848_TYPE_CS4235,
AD1848_TYPE_CS4236 AD1848_TYPE_CS4236
}; };
@@ -46,6 +47,10 @@ typedef struct {
int16_t buffer[SOUNDBUFLEN * 2]; int16_t buffer[SOUNDBUFLEN * 2];
int pos; int pos;
void *cram_priv,
(*cram_write)(uint16_t addr, uint8_t val, void *priv);
uint8_t (*cram_read)(uint16_t addr, void *priv);
} ad1848_t; } ad1848_t;

View File

@@ -135,6 +135,8 @@ extern const device_t wss_device;
extern const device_t ncr_business_audio_device; extern const device_t ncr_business_audio_device;
/* Crystal CS423x */ /* Crystal CS423x */
extern const device_t cs4235_device;
extern const device_t cs4235_onboard_device;
extern const device_t cs4236b_device; extern const device_t cs4236b_device;
extern const device_t cs4237b_device; extern const device_t cs4237b_device;
extern const device_t cs4238b_device; extern const device_t cs4238b_device;

View File

@@ -20,12 +20,12 @@
#define EMU_NAME "86Box" #define EMU_NAME "86Box"
#define EMU_NAME_W LSTR(EMU_NAME) #define EMU_NAME_W LSTR(EMU_NAME)
#define EMU_VERSION "3.2.1" #define EMU_VERSION "3.3"
#define EMU_VERSION_W LSTR(EMU_VERSION) #define EMU_VERSION_W LSTR(EMU_VERSION)
#define EMU_VERSION_EX "3.21" #define EMU_VERSION_EX "3.30"
#define EMU_VERSION_MAJ 3 #define EMU_VERSION_MAJ 3
#define EMU_VERSION_MIN 2 #define EMU_VERSION_MIN 3
#define EMU_VERSION_PATCH 1 #define EMU_VERSION_PATCH 0
#define EMU_BUILD_NUM 0 #define EMU_BUILD_NUM 0

View File

@@ -26,4 +26,4 @@ if(SLIRP_EXTERNAL)
else() else()
add_subdirectory(slirp) add_subdirectory(slirp)
target_link_libraries(86Box slirp) target_link_libraries(86Box slirp)
endif() endif()

View File

@@ -127,3 +127,13 @@ void SettingsNetwork::on_pushButtonConfigure_clicked() {
DeviceConfig::ConfigureDevice(network_card_getdevice(ui->comboBoxAdapter->currentData().toInt()), 0, qobject_cast<Settings*>(Settings::settings)); DeviceConfig::ConfigureDevice(network_card_getdevice(ui->comboBoxAdapter->currentData().toInt()), 0, qobject_cast<Settings*>(Settings::settings));
} }
void SettingsNetwork::on_comboBoxPcap_currentIndexChanged(int index)
{
if (index < 0) {
return;
}
enableElements(ui);
}

View File

@@ -25,6 +25,8 @@ private slots:
void on_comboBoxAdapter_currentIndexChanged(int index); void on_comboBoxAdapter_currentIndexChanged(int index);
void on_comboBoxNetwork_currentIndexChanged(int index); void on_comboBoxNetwork_currentIndexChanged(int index);
void on_comboBoxPcap_currentIndexChanged(int index);
private: private:
Ui::SettingsNetwork *ui; Ui::SettingsNetwork *ui;
int machineId = 0; int machineId = 0;

View File

@@ -16,7 +16,7 @@
* *
* Copyright 2008-2020 Sarah Walker. * Copyright 2008-2020 Sarah Walker.
* Copyright 2018-2020 TheCollector1995. * Copyright 2018-2020 TheCollector1995.
* Copyright 2021 RichardG. * Copyright 2021-2022 RichardG.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -56,7 +56,7 @@ ad1848_setdma(ad1848_t *ad1848, int dma)
void void
ad1848_updatevolmask(ad1848_t *ad1848) ad1848_updatevolmask(ad1848_t *ad1848)
{ {
if ((ad1848->type == AD1848_TYPE_CS4236) && ((ad1848->xregs[4] & 0x10) || ad1848->wten)) if ((ad1848->type >= AD1848_TYPE_CS4235) && ((ad1848->xregs[4] & 0x10) || ad1848->wten))
ad1848->wave_vol_mask = 0x3f; ad1848->wave_vol_mask = 0x3f;
else else
ad1848->wave_vol_mask = 0x7f; ad1848->wave_vol_mask = 0x7f;
@@ -69,7 +69,7 @@ ad1848_updatefreq(ad1848_t *ad1848)
double freq; double freq;
uint8_t set = 0; uint8_t set = 0;
if (ad1848->type == AD1848_TYPE_CS4236) { if (ad1848->type >= AD1848_TYPE_CS4235) {
if (ad1848->xregs[11] & 0x20) { if (ad1848->xregs[11] & 0x20) {
freq = 16934400LL; freq = 16934400LL;
switch (ad1848->xregs[13]) { switch (ad1848->xregs[13]) {
@@ -134,7 +134,7 @@ ad1848_read(uint16_t addr, void *priv)
break; break;
case 18: case 19: case 18: case 19:
if (ad1848->type == AD1848_TYPE_CS4236) { if (ad1848->type >= AD1848_TYPE_CS4235) {
if ((ad1848->xregs[4] & 0x14) == 0x14) /* FM remapping */ if ((ad1848->xregs[4] & 0x14) == 0x14) /* FM remapping */
ret = ad1848->xregs[ad1848->index - 12]; /* real FM volume on registers 6 and 7 */ ret = ad1848->xregs[ad1848->index - 12]; /* real FM volume on registers 6 and 7 */
else if (ad1848->wten && !(ad1848->xregs[4] & 0x08)) /* wavetable remapping */ else if (ad1848->wten && !(ad1848->xregs[4] & 0x08)) /* wavetable remapping */
@@ -142,8 +142,14 @@ ad1848_read(uint16_t addr, void *priv)
} }
break; break;
case 20: case 21:
/* Backdoor to the Control/RAM registers on CS4235. */
if ((ad1848->type == AD1848_TYPE_CS4235) && (ad1848->xregs[18] & 0x80))
ret = ad1848->cram_read(ad1848->index - 15, ad1848->cram_priv);
break;
case 23: case 23:
if ((ad1848->type == AD1848_TYPE_CS4236) && (ad1848->regs[23] & 0x08)) { if ((ad1848->type >= AD1848_TYPE_CS4235) && (ad1848->regs[23] & 0x08)) {
if ((ad1848->xindex & 0xfe) == 0x00) /* remapped line volume */ if ((ad1848->xindex & 0xfe) == 0x00) /* remapped line volume */
ret = ad1848->regs[18 + ad1848->xindex]; ret = ad1848->regs[18 + ad1848->xindex];
else else
@@ -174,7 +180,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
ad1848->index = val & 0x1f; /* cs4231a extended mode enabled */ ad1848->index = val & 0x1f; /* cs4231a extended mode enabled */
else else
ad1848->index = val & 0x0f; /* ad1848/cs4248 mode TODO: some variants/clones DO NOT mirror, just ignore the writes? */ ad1848->index = val & 0x0f; /* ad1848/cs4248 mode TODO: some variants/clones DO NOT mirror, just ignore the writes? */
if (ad1848->type == AD1848_TYPE_CS4236) if (ad1848->type >= AD1848_TYPE_CS4235)
ad1848->regs[23] &= ~0x08; /* clear XRAE */ ad1848->regs[23] &= ~0x08; /* clear XRAE */
ad1848->trd = val & 0x20; ad1848->trd = val & 0x20;
ad1848->mce = val & 0x40; ad1848->mce = val & 0x40;
@@ -183,7 +189,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
case 1: case 1:
switch (ad1848->index) { switch (ad1848->index) {
case 10: case 10:
if (ad1848->type != AD1848_TYPE_CS4236) if (ad1848->type < AD1848_TYPE_CS4235)
break; break;
/* fall-through */ /* fall-through */
@@ -223,7 +229,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
break; break;
case 18: case 19: case 18: case 19:
if (ad1848->type == AD1848_TYPE_CS4236) { if (ad1848->type >= AD1848_TYPE_CS4235) {
if ((ad1848->xregs[4] & 0x14) == 0x14) { /* FM remapping */ if ((ad1848->xregs[4] & 0x14) == 0x14) { /* FM remapping */
ad1848->xregs[ad1848->index - 12] = val; /* real FM volume on extended registers 6 and 7 */ ad1848->xregs[ad1848->index - 12] = val; /* real FM volume on extended registers 6 and 7 */
temp = 1; temp = 1;
@@ -265,12 +271,20 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
} }
break; break;
case 20: case 21:
/* Backdoor to the Control/RAM registers on CS4235. */
if ((ad1848->type == AD1848_TYPE_CS4235) && (ad1848->xregs[18] & 0x80)) {
ad1848->cram_write(ad1848->index - 15, val, ad1848->cram_priv);
val = ad1848->regs[ad1848->index];
}
break;
case 22: case 22:
updatefreq = 1; updatefreq = 1;
break; break;
case 23: case 23:
if ((ad1848->type == AD1848_TYPE_CS4236) && ((ad1848->regs[12] & 0x60) == 0x60)) { if ((ad1848->type >= AD1848_TYPE_CS4235) && ((ad1848->regs[12] & 0x60) == 0x60)) {
if (!(ad1848->regs[23] & 0x08)) { /* existing (not new) XRAE is clear */ if (!(ad1848->regs[23] & 0x08)) { /* existing (not new) XRAE is clear */
ad1848->xindex = ((val & 0x04) << 2) | (val >> 4); ad1848->xindex = ((val & 0x04) << 2) | (val >> 4);
break; break;
@@ -327,7 +341,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
if (updatefreq) if (updatefreq)
ad1848_updatefreq(ad1848); ad1848_updatefreq(ad1848);
if ((ad1848->type == AD1848_TYPE_CS4231) || (ad1848->type == AD1848_TYPE_CS4236)) { /* TODO: configure CD volume for CS4248/AD1848 too */ if (ad1848->type >= AD1848_TYPE_CS4231) { /* TODO: configure CD volume for CS4248/AD1848 too */
temp = (ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4; temp = (ad1848->type == AD1848_TYPE_CS4231) ? 18 : 4;
if (ad1848->regs[temp] & 0x80) if (ad1848->regs[temp] & 0x80)
ad1848->cd_vol_l = 0; ad1848->cd_vol_l = 0;
@@ -474,7 +488,7 @@ ad1848_init(ad1848_t *ad1848, uint8_t type)
ad1848->regs[8] = 0; ad1848->regs[8] = 0;
ad1848->regs[9] = 0x08; ad1848->regs[9] = 0x08;
ad1848->regs[10] = ad1848->regs[11] = 0; ad1848->regs[10] = ad1848->regs[11] = 0;
if ((type == AD1848_TYPE_CS4248) || (type == AD1848_TYPE_CS4231) || (type == AD1848_TYPE_CS4236)) if ((type == AD1848_TYPE_CS4248) || (type == AD1848_TYPE_CS4231) || (type >= AD1848_TYPE_CS4235))
ad1848->regs[12] = 0x8a; ad1848->regs[12] = 0x8a;
else else
ad1848->regs[12] = 0xa; ad1848->regs[12] = 0xa;
@@ -489,7 +503,7 @@ ad1848_init(ad1848_t *ad1848, uint8_t type)
ad1848->regs[25] = CS4231; ad1848->regs[25] = CS4231;
ad1848->regs[26] = 0x80; ad1848->regs[26] = 0x80;
ad1848->regs[29] = 0x80; ad1848->regs[29] = 0x80;
} else if (type == AD1848_TYPE_CS4236) { } else if (type >= AD1848_TYPE_CS4235) {
ad1848->regs[16] = ad1848->regs[17] = 0; ad1848->regs[16] = ad1848->regs[17] = 0;
ad1848->regs[18] = ad1848->regs[19] = 0; ad1848->regs[18] = ad1848->regs[19] = 0;
ad1848->regs[20] = ad1848->regs[21] = 0; ad1848->regs[20] = ad1848->regs[21] = 0;

View File

@@ -12,7 +12,7 @@
* *
* Authors: RichardG, <richardg867@gmail.com> * Authors: RichardG, <richardg867@gmail.com>
* *
* Copyright 2021 RichardG. * Copyright 2021-2022 RichardG.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -37,7 +37,10 @@
#include <86box/nvr.h> #include <86box/nvr.h>
#define CRYSTAL_NOEEPROM 0x100
enum { enum {
CRYSTAL_CS4235 = 0xdd,
CRYSTAL_CS4236B = 0xcb, CRYSTAL_CS4236B = 0xcb,
CRYSTAL_CS4237B = 0xc8, CRYSTAL_CS4237B = 0xc8,
CRYSTAL_CS4238B = 0xc9 CRYSTAL_CS4238B = 0xc9
@@ -69,7 +72,7 @@ static const uint8_t cs4236b_eeprom[] = {
0x10, 0x03, /* DMA routing */ 0x10, 0x03, /* DMA routing */
/* PnP resources */ /* PnP resources */
0x0e, 0x63, 0x42, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, /* CSC4236, dummy checksum (filled in by isapnp_add_card) */ 0x0e, 0x63, 0x42, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, /* CSC4236, dummy checksum (filled in by isapnp_add_card) */
0x0a, 0x10, 0x01, /* PnP version 1.0, vendor version 0.1 */ 0x0a, 0x10, 0x01, /* PnP version 1.0, vendor version 0.1 */
0x82, 0x0e, 0x00, 'C', 'r', 'y', 's', 't', 'a', 'l', ' ', 'C', 'o', 'd', 'e' ,'c', 0x00, /* ANSI identifier */ 0x82, 0x0e, 0x00, 'C', 'r', 'y', 's', 't', 'a', 'l', ' ', 'C', 'o', 'd', 'e' ,'c', 0x00, /* ANSI identifier */
@@ -312,7 +315,8 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
break; break;
case 6: /* RAM Access End */ case 6: /* RAM Access End */
if (!val) { /* TriGem Delhi-III BIOS writes undocumented value 0x40 instead of 0x00. */
if ((val == 0x00) || (val == 0x40)) {
dev->ram_dl = 0; dev->ram_dl = 0;
/* Update PnP state and resource data. */ /* Update PnP state and resource data. */
@@ -356,6 +360,20 @@ cs423x_slam_write(uint16_t addr, uint8_t val, void *priv)
break; break;
case CRYSTAL_SLAM_INDEX: case CRYSTAL_SLAM_INDEX:
/* Intercept the Activate Audio Device command. */
if (val == 0x79) {
/* Apply the last logical device's configuration. */
if (dev->slam_config) {
cs423x_pnp_config_changed(dev->slam_ld, dev->slam_config, dev);
free(dev->slam_config);
dev->slam_config = NULL;
}
/* Exit out of SLAM. */
dev->slam_state = CRYSTAL_SLAM_NONE;
break;
}
/* Write register index. */ /* Write register index. */
dev->slam_reg = val; dev->slam_reg = val;
dev->slam_state = CRYSTAL_SLAM_BYTE1; dev->slam_state = CRYSTAL_SLAM_BYTE1;
@@ -429,18 +447,6 @@ cs423x_slam_write(uint16_t addr, uint8_t val, void *priv)
/* Activate or deactivate the device. */ /* Activate or deactivate the device. */
dev->slam_config->activate = val & 0x01; dev->slam_config->activate = val & 0x01;
break; break;
case 0x79: /* activate chip */
/* Apply the last logical device's configuration. */
if (dev->slam_config) {
cs423x_pnp_config_changed(dev->slam_ld, dev->slam_config, dev);
free(dev->slam_config);
dev->slam_config = NULL;
}
/* Exit out of SLAM. */
dev->slam_state = CRYSTAL_SLAM_NONE;
break;
} }
/* Prepare for the next register, unless a two-byte read returns above. */ /* Prepare for the next register, unless a two-byte read returns above. */
@@ -541,11 +547,13 @@ cs423x_pnp_enable(cs423x_t *dev, uint8_t update_rom, uint8_t update_hwconfig)
if (update_rom) if (update_rom)
isapnp_update_card_rom(dev->pnp_card, &dev->ram_data[dev->pnp_offset], 384); isapnp_update_card_rom(dev->pnp_card, &dev->ram_data[dev->pnp_offset], 384);
/* Hide PnP card if the PKD bit is set, or if PnP was disabled by command 0x55. */ /* Disable PnP key if the PKD bit is set, or if it was disabled by command 0x55. */
/* But wait! The TriGem Delhi-III BIOS sends command 0x55, and its behavior doesn't
line up with real hardware (still listed in the POST summary and seen by software).
Disable the PnP key disabling mechanism until someone figures something out. */
//isapnp_enable_card(dev->pnp_card, ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) ? ISAPNP_CARD_NO_KEY : ISAPNP_CARD_ENABLE);
if ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) if ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable)
isapnp_enable_card(dev->pnp_card, ISAPNP_CARD_DISABLE); pclog("CS423x: Attempted to disable PnP key\n");
else
isapnp_enable_card(dev->pnp_card, ISAPNP_CARD_ENABLE);
} }
/* Update some register bits based on the config data in RAM if requested. */ /* Update some register bits based on the config data in RAM if requested. */
@@ -560,10 +568,12 @@ cs423x_pnp_enable(cs423x_t *dev, uint8_t update_rom, uint8_t update_hwconfig)
} }
/* Update SPS. */ /* Update SPS. */
if (dev->ram_data[0x4003] & 0x04) if (dev->type != CRYSTAL_CS4235) {
dev->indirect_regs[8] |= 0x04; if (dev->ram_data[0x4003] & 0x04)
else dev->indirect_regs[8] |= 0x04;
dev->indirect_regs[8] &= ~0x04; else
dev->indirect_regs[8] &= ~0x04;
}
/* Update IFM. */ /* Update IFM. */
if (dev->ram_data[0x4003] & 0x80) if (dev->ram_data[0x4003] & 0x80)
@@ -723,8 +733,9 @@ cs423x_init(const device_t *info)
memset(dev, 0, sizeof(cs423x_t)); memset(dev, 0, sizeof(cs423x_t));
/* Initialize model-specific data. */ /* Initialize model-specific data. */
dev->type = info->local; dev->type = info->local & 0xff;
switch (dev->type) { switch (dev->type) {
case CRYSTAL_CS4235:
case CRYSTAL_CS4236B: case CRYSTAL_CS4236B:
case CRYSTAL_CS4237B: case CRYSTAL_CS4237B:
case CRYSTAL_CS4238B: case CRYSTAL_CS4238B:
@@ -735,36 +746,45 @@ cs423x_init(const device_t *info)
/* Different Chip Version and ID registers, which shouldn't be reset by ad1848_init */ /* Different Chip Version and ID registers, which shouldn't be reset by ad1848_init */
dev->ad1848.xregs[25] = dev->type; dev->ad1848.xregs[25] = dev->type;
/* Load EEPROM contents from template. */ if (!(info->local & CRYSTAL_NOEEPROM)) {
memcpy(dev->eeprom_data, cs4236b_eeprom, sizeof(cs4236b_eeprom)); /* Load EEPROM contents from template. */
memcpy(dev->eeprom_data, cs4236b_eeprom, sizeof(cs4236b_eeprom));
/* Set content size. */ /* Set content size. */
dev->eeprom_data[2] = sizeof(cs4236b_eeprom) >> 8; dev->eeprom_data[2] = sizeof(cs4236b_eeprom) >> 8;
dev->eeprom_data[3] = sizeof(cs4236b_eeprom) & 0xff; dev->eeprom_data[3] = sizeof(cs4236b_eeprom) & 0xff;
/* Set PnP card ID and EEPROM file name. */ /* Set PnP card ID and EEPROM file name. */
switch (dev->type) { switch (dev->type) {
case CRYSTAL_CS4236B: case CRYSTAL_CS4235:
dev->nvr_path = "cs4236b.nvr"; dev->eeprom_data[8] = 0x05;
break; dev->eeprom_data[16] = 0x08;
dev->eeprom_data[26] = 0x25;
dev->nvr_path = "cs4235.nvr";
break;
case CRYSTAL_CS4237B: case CRYSTAL_CS4236B:
dev->eeprom_data[26] = 0x37; dev->nvr_path = "cs4236b.nvr";
dev->nvr_path = "cs4237b.nvr"; break;
break;
case CRYSTAL_CS4238B: case CRYSTAL_CS4237B:
dev->eeprom_data[26] = 0x38; dev->eeprom_data[26] = 0x37;
dev->nvr_path = "cs4238b.nvr"; dev->nvr_path = "cs4237b.nvr";
break; break;
case CRYSTAL_CS4238B:
dev->eeprom_data[26] = 0x38;
dev->nvr_path = "cs4238b.nvr";
break;
}
/* Load EEPROM contents from file if present. */
cs423x_nvram(dev, 0);
} }
/* Load EEPROM contents from file if present. */
cs423x_nvram(dev, 0);
/* Initialize game port. The '7B and '8B game port only responds to 6 I/O ports; the remaining /* Initialize game port. The '7B and '8B game port only responds to 6 I/O ports; the remaining
2 ports are reserved on those chips, and probably connected to the Digital Assist feature. */ 2 ports are reserved on those chips, and probably connected to the Digital Assist feature. */
dev->gameport = gameport_add((dev->type == CRYSTAL_CS4236B) ? &gameport_pnp_device : &gameport_pnp_6io_device); dev->gameport = gameport_add(((dev->type == CRYSTAL_CS4235) || (dev->type == CRYSTAL_CS4236B)) ? &gameport_pnp_device : &gameport_pnp_6io_device);
break; break;
} }
@@ -787,6 +807,11 @@ cs423x_init(const device_t *info)
cs423x_reset(dev); cs423x_reset(dev);
sound_add_handler(cs423x_get_buffer, dev); sound_add_handler(cs423x_get_buffer, dev);
/* Add Control/RAM backdoor handlers for CS4235. */
dev->ad1848.cram_priv = dev;
dev->ad1848.cram_read = cs423x_read;
dev->ad1848.cram_write = cs423x_write;
return dev; return dev;
} }
@@ -817,6 +842,32 @@ cs423x_speed_changed(void *priv)
} }
const device_t cs4235_device =
{
"Crystal CS4235",
"cs4235",
DEVICE_ISA | DEVICE_AT,
CRYSTAL_CS4235,
cs423x_init, cs423x_close, cs423x_reset,
{ NULL },
cs423x_speed_changed,
NULL,
NULL
};
const device_t cs4235_onboard_device =
{
"Crystal CS4235 (On-Board)",
"cs4235_onboard",
DEVICE_ISA | DEVICE_AT,
CRYSTAL_CS4235 | CRYSTAL_NOEEPROM,
cs423x_init, cs423x_close, cs423x_reset,
{ NULL },
cs423x_speed_changed,
NULL,
NULL
};
const device_t cs4236b_device = const device_t cs4236b_device =
{ {
"Crystal CS4236B", "Crystal CS4236B",

View File

@@ -106,6 +106,7 @@ static const SOUND_CARD sound_cards[] =
{ &adgold_device }, { &adgold_device },
{ &azt2316a_device }, { &azt2316a_device },
{ &azt1605_device }, { &azt1605_device },
{ &cs4235_device },
{ &cs4236b_device }, { &cs4236b_device },
{ &sb_1_device }, { &sb_1_device },
{ &sb_15_device }, { &sb_15_device },

View File

@@ -1272,4 +1272,4 @@ void endblit()
void void
ui_sb_mt32lcd(char* str) ui_sb_mt32lcd(char* str)
{ {
} }