Merge branch 'master' into pc98x1

This commit is contained in:
TC1995
2024-07-20 12:26:51 +02:00
21 changed files with 266 additions and 326 deletions

View File

@@ -179,7 +179,7 @@ int postcard_enabled = 0; /* (C) enable
int unittester_enabled = 0; /* (C) enable unit tester device */
int isamem_type[ISAMEM_MAX] = { 0, 0, 0, 0 }; /* (C) enable ISA mem cards */
int isartc_type = 0; /* (C) enable ISA RTC card */
int gfxcard[2] = { 0, 0 }; /* (C) graphics/video card */
int gfxcard[GFXCARD_MAX] = { 0, 0 }; /* (C) graphics/video card */
int show_second_monitors = 1; /* (C) show non-primary monitors */
int sound_is_float = 1; /* (C) sound uses FP values */
int voodoo_enabled = 0; /* (C) video option */
@@ -1004,12 +1004,15 @@ pc_init_modules(void)
}
}
if (!video_card_available(gfxcard[1])) {
char tempc[512] = { 0 };
device_get_name(video_card_getdevice(gfxcard[1]), 0, tempc);
swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_VIDEO2), tempc);
ui_msgbox_header(MBX_INFO, plat_get_string(STRING_HW_NOT_AVAILABLE_TITLE), temp);
gfxcard[1] = 0;
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
if (!video_card_available(gfxcard[i])) {
char tempc[512] = { 0 };
device_get_name(video_card_getdevice(gfxcard[i]), 0, tempc);
swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_VIDEO2), tempc);
ui_msgbox_header(MBX_INFO, plat_get_string(STRING_HW_NOT_AVAILABLE_TITLE), temp);
gfxcard[i] = 0;
}
}
atfullspeed = 0;

View File

@@ -459,10 +459,13 @@ load_video(void)
show_second_monitors = !!ini_section_get_int(cat, "show_second_monitors", 1);
video_fullscreen_scale_maximized = !!ini_section_get_int(cat, "video_fullscreen_scale_maximized", 0);
p = ini_section_get_string(cat, "gfxcard_2", NULL);
if (!p)
p = "none";
gfxcard[1] = video_get_video_from_internal_name(p);
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
p = ini_section_get_string(cat, "gfxcard_2", NULL);
if (!p)
p = "none";
gfxcard[i] = video_get_video_from_internal_name(p);
}
}
/* Load "Input Devices" section. */
@@ -2010,10 +2013,13 @@ save_video(void)
else
ini_section_set_int(cat, "xga", xga_standalone_enabled);
if (gfxcard[1] == 0)
ini_section_delete_var(cat, "gfxcard_2");
else
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[1]));
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
if (gfxcard[i] == 0)
ini_section_delete_var(cat, "gfxcard_2");
else
ini_section_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard[i]));
}
if (show_second_monitors == 1)
ini_section_delete_var(cat, "show_second_monitors");

View File

@@ -843,3 +843,31 @@ device_context_get_device(void)
{
return device_current.dev;
}
const device_t device_none = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t device_internal = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};

View File

@@ -2040,25 +2040,11 @@ static const device_t iab_device = {
};
#endif
static const device_t isa_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const struct {
const device_t *dev;
} boards[] = {
// clang-format off
{ &isa_none_device },
{ &device_none },
// XT Ram Expansion Cards
{ &ibmxt_32k_device },
{ &ibmxt_64k_device },

View File

@@ -752,30 +752,16 @@ const device_t vendex_xt_rtc_onboard_device = {
.config = NULL
};
static const device_t isartc_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const struct {
const device_t *dev;
} boards[] = {
// clang-format off
{ &isartc_none_device },
{ &ev170_device },
{ &pii147_device },
{ &p5pak_device },
{ &a6pak_device },
{ NULL },
{ &device_none },
{ &ev170_device },
{ &pii147_device },
{ &p5pak_device },
{ &a6pak_device },
{ NULL },
// clang-format on
};

View File

@@ -50,40 +50,12 @@ hdc_log(const char *fmt, ...)
# define hdc_log(fmt, ...)
#endif
static const device_t hdc_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t hdc_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const struct {
const device_t *device;
} controllers[] = {
// clang-format off
{ &hdc_none_device },
{ &hdc_internal_device },
{ &device_none },
{ &device_internal },
{ &st506_xt_xebec_device },
{ &st506_xt_wdxt_gen_device },
{ &st506_xt_dtc5150x_device },

View File

@@ -97,49 +97,21 @@ fdc_log(const char *fmt, ...)
# define fdc_log(fmt, ...)
#endif
const device_t fdc_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t fdc_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
typedef const struct {
const device_t *device;
} fdc_cards_t;
static fdc_cards_t fdc_cards[] = {
// clang-format off
{ &fdc_none_device },
{ &fdc_internal_device },
{ &fdc_xt_device },
{ &fdc_at_device },
{ &fdc_b215_device },
{ &fdc_pii151b_device },
{ &fdc_pii158b_device },
{ &fdc_monster_device },
{ NULL }
{ &device_none },
{ &device_internal },
{ &fdc_xt_device },
{ &fdc_at_device },
{ &fdc_b215_device },
{ &fdc_pii151b_device },
{ &fdc_pii158b_device },
{ &fdc_monster_device },
{ NULL }
// clang-format on
};

View File

@@ -21,6 +21,7 @@
#define EMU_86BOX_H
/* Configuration values. */
#define GFXCARD_MAX 2
#define SERIAL_MAX 7
#define PARALLEL_MAX 4
#define SCREEN_RES_X 640
@@ -124,7 +125,7 @@ extern int force_43; /* (C) video */
extern int video_filter_method; /* (C) video */
extern int video_vsync; /* (C) video */
extern int video_framerate; /* (C) video */
extern int gfxcard[2]; /* (C) graphics/video card */
extern int gfxcard[GFXCARD_MAX]; /* (C) graphics/video card */
extern char video_shader[512]; /* (C) video */
extern int bugger_enabled; /* (C) enable ISAbugger */
extern int novell_keycard_enabled; /* (C) enable Novell NetWare 2.x key card emulation. */

View File

@@ -244,6 +244,9 @@ extern const char *device_get_internal_name(const device_t *dev);
extern int machine_get_config_int(char *s);
extern char *machine_get_config_string(char *s);
extern const device_t device_none;
extern const device_t device_internal;
#ifdef __cplusplus
}
#endif

View File

@@ -77,37 +77,9 @@
# include <winsock2.h>
#endif
static const device_t net_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = NET_TYPE_NONE,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t net_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = NET_TYPE_NONE,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t *net_cards[] = {
&net_none_device,
&net_internal_device,
&device_none,
&device_internal,
&threec501_device,
&threec503_device,
&pcnet_am79c960_device,

View File

@@ -145,9 +145,11 @@ main_thread_fn()
}
is_quit = 1;
if (gfxcard[1]) {
ui_deinit_monitor(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
if (gfxcard[i]) {
ui_deinit_monitor(i);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}
QTimer::singleShot(0, QApplication::instance(), []() { QApplication::processEvents(); QApplication::instance()->quit(); });
}

View File

@@ -36,8 +36,8 @@ SettingsDisplay::SettingsDisplay(QWidget *parent)
{
ui->setupUi(this);
videoCard[0] = gfxcard[0];
videoCard[1] = gfxcard[1];
for (uint8_t i = 0; i < GFXCARD_MAX; i ++)
videoCard[i] = gfxcard[i];
onCurrentMachineChanged(machine);
}
@@ -50,7 +50,9 @@ void
SettingsDisplay::save()
{
gfxcard[0] = ui->comboBoxVideo->currentData().toInt();
gfxcard[1] = ui->comboBoxVideoSecondary->currentData().toInt();
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
gfxcard[i] = ui->comboBoxVideoSecondary->currentData().toInt();
voodoo_enabled = ui->checkBoxVoodoo->isChecked() ? 1 : 0;
ibm8514_standalone_enabled = ui->checkBox8514->isChecked() ? 1 : 0;
xga_standalone_enabled = ui->checkBoxXga->isChecked() ? 1 : 0;
@@ -103,8 +105,10 @@ SettingsDisplay::onCurrentMachineChanged(int machineId)
ui->pushButtonConfigureSecondary->setEnabled(true);
}
ui->comboBoxVideo->setCurrentIndex(selectedRow);
if (gfxcard[1] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
// TODO
for (uint8_t i = 1; i < GFXCARD_MAX; i ++)
if (gfxcard[i] == 0)
ui->pushButtonConfigureSecondary->setEnabled(false);
}
void

View File

@@ -3,6 +3,8 @@
#include <QWidget>
#define VIDEOCARD_MAX 2
namespace Ui {
class SettingsDisplay;
}
@@ -36,7 +38,7 @@ private slots:
private:
Ui::SettingsDisplay *ui;
int machineId = 0;
int videoCard[2] = { 0, 0 };
int videoCard[VIDEOCARD_MAX] = { 0, 0 };
};
#endif // QT_SETTINGSDISPLAY_HPP

View File

@@ -66,19 +66,23 @@ SettingsPorts::SettingsPorts(QWidget *parent)
}
for (int i = 0; i < SERIAL_MAX; i++) {
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
if (checkBox != NULL)
checkBox->setChecked(com_ports[i].enabled > 0);
if (checkBoxPass != NULL)
checkBoxPass->setChecked(serial_passthrough_enabled[i]);
}
ui->checkBoxSerialPassThru1->setChecked(serial_passthrough_enabled[0]);
ui->pushButtonSerialPassThru1->setEnabled(serial_passthrough_enabled[0]);
ui->checkBoxSerialPassThru2->setChecked(serial_passthrough_enabled[1]);
ui->pushButtonSerialPassThru2->setEnabled(serial_passthrough_enabled[1]);
ui->checkBoxSerialPassThru3->setChecked(serial_passthrough_enabled[2]);
ui->pushButtonSerialPassThru3->setEnabled(serial_passthrough_enabled[2]);
ui->checkBoxSerialPassThru4->setChecked(serial_passthrough_enabled[3]);
ui->pushButtonSerialPassThru4->setEnabled(serial_passthrough_enabled[3]);
#if 0
ui->pushButtonSerialPassThru5->setEnabled(serial_passthrough_enabled[4]);
ui->pushButtonSerialPassThru6->setEnabled(serial_passthrough_enabled[5]);
ui->pushButtonSerialPassThru7->setEnabled(serial_passthrough_enabled[6]);
#endif
}
SettingsPorts::~SettingsPorts()
@@ -90,7 +94,7 @@ void
SettingsPorts::save()
{
for (int i = 0; i < PARALLEL_MAX; i++) {
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
auto *cbox = findChild<QComboBox *>(QString("comboBoxLpt%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxParallel%1").arg(i + 1));
if (cbox != NULL)
lpt_ports[i].device = cbox->currentData().toInt();
@@ -99,15 +103,13 @@ SettingsPorts::save()
}
for (int i = 0; i < SERIAL_MAX; i++) {
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBox = findChild<QCheckBox *>(QString("checkBoxSerial%1").arg(i + 1));
auto *checkBoxPass = findChild<QCheckBox *>(QString("checkBoxSerialPassThru%1").arg(i + 1));
if (checkBox != NULL)
com_ports[i].enabled = checkBox->isChecked() ? 1 : 0;
if (checkBoxPass != NULL)
serial_passthrough_enabled[i] = checkBoxPass->isChecked();
}
serial_passthrough_enabled[0] = ui->checkBoxSerialPassThru1->isChecked();
serial_passthrough_enabled[1] = ui->checkBoxSerialPassThru2->isChecked();
serial_passthrough_enabled[2] = ui->checkBoxSerialPassThru3->isChecked();
serial_passthrough_enabled[3] = ui->checkBoxSerialPassThru4->isChecked();
}
void
@@ -158,6 +160,24 @@ SettingsPorts::on_pushButtonSerialPassThru4_clicked()
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 4, qobject_cast<Settings *>(Settings::settings));
}
void
SettingsPorts::on_pushButtonSerialPassThru5_clicked()
{
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 5, qobject_cast<Settings *>(Settings::settings));
}
void
SettingsPorts::on_pushButtonSerialPassThru6_clicked()
{
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 6, qobject_cast<Settings *>(Settings::settings));
}
void
SettingsPorts::on_pushButtonSerialPassThru7_clicked()
{
DeviceConfig::ConfigureDevice(&serial_passthrough_device, 7, qobject_cast<Settings *>(Settings::settings));
}
void
SettingsPorts::on_checkBoxSerialPassThru1_clicked(bool checked)
{
@@ -181,3 +201,23 @@ SettingsPorts::on_checkBoxSerialPassThru4_clicked(bool checked)
{
ui->pushButtonSerialPassThru4->setEnabled(checked);
}
#if 0
void
SettingsPorts::on_checkBoxSerialPassThru5_clicked(bool checked)
{
ui->pushButtonSerialPassThru5->setEnabled(checked);
}
void
SettingsPorts::on_checkBoxSerialPassThru6_clicked(bool checked)
{
ui->pushButtonSerialPassThru6->setEnabled(checked);
}
void
SettingsPorts::on_checkBoxSerialPassThru7_clicked(bool checked)
{
ui->pushButtonSerialPassThru7->setEnabled(checked);
}
#endif

View File

@@ -15,6 +15,18 @@ public:
~SettingsPorts();
void save();
#if 0
private slots:
void on_checkBoxSerialPassThru7_clicked(bool checked);
private slots:
void on_checkBoxSerialPassThru6_clicked(bool checked);
private slots:
void on_checkBoxSerialPassThru5_clicked(bool checked);
#endif
private slots:
void on_checkBoxSerialPassThru4_clicked(bool checked);
@@ -24,6 +36,18 @@ private slots:
private slots:
void on_checkBoxSerialPassThru2_clicked(bool checked);
private slots:
void on_checkBoxSerialPassThru1_clicked(bool checked);
private slots:
void on_pushButtonSerialPassThru7_clicked();
private slots:
void on_pushButtonSerialPassThru6_clicked();
private slots:
void on_pushButtonSerialPassThru5_clicked();
private slots:
void on_pushButtonSerialPassThru4_clicked();
@@ -37,15 +61,11 @@ private slots:
void on_pushButtonSerialPassThru1_clicked();
private slots:
void on_checkBoxSerialPassThru1_clicked(bool checked);
private slots:
void on_checkBoxParallel4_stateChanged(int arg1);
void on_checkBoxParallel3_stateChanged(int arg1);
void on_checkBoxParallel2_stateChanged(int arg1);
void on_checkBoxParallel1_stateChanged(int arg1);
void on_checkBoxParallel4_stateChanged(int arg1);
private:
Ui::SettingsPorts *ui;
};

View File

@@ -47,27 +47,13 @@ double scsi_bus_speed[SCSI_BUS_MAX] = { 0.0, 0.0, 0.0, 0.0 };
static uint8_t next_scsi_bus = 0;
static const device_t scsi_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
typedef const struct {
const device_t *device;
} SCSI_CARD;
static SCSI_CARD scsi_cards[] = {
// clang-format off
{ &scsi_none_device, },
{ &device_none, },
{ &aha154xa_device, },
{ &aha154xb_device, },
{ &aha154xc_device, },

View File

@@ -71,59 +71,31 @@ typedef struct
const device_t *device;
} MIDI_OUT_DEVICE, MIDI_IN_DEVICE;
static const device_t midi_out_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const MIDI_OUT_DEVICE devices[] = {
// clang-format off
{ &midi_out_none_device },
{ &device_none },
#ifdef USE_FLUIDSYNTH
{ &fluidsynth_device },
{ &fluidsynth_device },
#endif
#ifdef USE_MUNT
{ &mt32_old_device },
{ &mt32_new_device },
{ &cm32l_device },
{ &cm32ln_device },
{ &mt32_old_device },
{ &mt32_new_device },
{ &cm32l_device },
{ &cm32ln_device },
#endif
#ifdef USE_RTMIDI
{ &rtmidi_output_device },
{ &rtmidi_output_device },
#endif
#if defined(DEV_BRANCH) && defined(USE_OPL4ML)
{ &opl4_midi_device },
{ &opl4_midi_device },
#endif
{ NULL }
{ NULL }
// clang-format on
};
static const device_t midi_in_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const MIDI_IN_DEVICE midi_in_devices[] = {
// clang-format off
{ &midi_in_none_device },
{ &device_none },
#ifdef USE_RTMIDI
{ &rtmidi_input_device },
#endif

View File

@@ -96,38 +96,10 @@ static void *filter_cd_audio_p = NULL;
void (*filter_pc_speaker)(int channel, double *buffer, void *priv) = NULL;
void *filter_pc_speaker_p = NULL;
static const device_t sound_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t sound_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const SOUND_CARD sound_cards[] = {
// clang-format off
{ &sound_none_device },
{ &sound_internal_device },
{ &device_none },
{ &device_internal },
{ &acermagic_s20_device },
{ &mirosound_pcm10_device },
{ &adlib_device },

View File

@@ -1168,7 +1168,7 @@ monitor_thread(void *param)
#endif
}
extern int gfxcard[2];
extern int gfxcard[GFXCARD_MAX];
int
main(int argc, char **argv)
{
@@ -1186,7 +1186,8 @@ main(int argc, char **argv)
return 6;
}
gfxcard[1] = 0;
for (uint8_t i = 1; i < GFXCARD_MAX; i++)
gfxcard[i] = 0;
eventthread = SDL_ThreadID();
blitmtx = SDL_CreateMutex();
if (!blitmtx) {

View File

@@ -161,6 +161,8 @@ typedef struct chips_69000_t {
uint8_t st01;
} chips_69000_t;
static chips_69000_t *reset_state = NULL;
/* TODO: Probe timings on real hardware. */
static video_timings_t timing_chips = { .type = VIDEO_PCI, .write_b = 2, .write_w = 2, .write_l = 1, .read_b = 10, .read_w = 10, .read_l = 10 };
@@ -777,7 +779,7 @@ chips_69000_recalctimings(svga_t *svga)
if (!(chips->ext_regs[0x81] & 0x10))
svga->htotal += 5;
svga->hblank_end_val = ((svga->crtc[3] & 0x1f) | ((svga->crtc[5] & 0x80) ? 0x20 : 0x00)) | (svga->crtc[0x3c] & 0b11000000);
svga->hblank_end_mask = 0xff;
@@ -980,7 +982,7 @@ chips_69000_process_pixel(chips_69000_t* chips, uint32_t pixel)
if (!!(color_key == dest_pixel) == !!(chips->bitblt_running.bitblt.bitblt_control & (1 << 16))) {
return;
}
break;
}
}
@@ -1018,7 +1020,7 @@ chips_69000_process_pixel(chips_69000_t* chips, uint32_t pixel)
if (!!(color_key == dest_pixel) == !!(chips->bitblt_running.bitblt.bitblt_control & (1 << 16))) {
return;
}
break;
}
}
@@ -1191,7 +1193,7 @@ chips_69000_setup_bitblt(chips_69000_t* chips)
chips->bitblt_running.mono_bytes_pitch = ((chips->bitblt_running.actual_destination_width + chips->bitblt_running.bitblt.monochrome_source_left_clip + 63) & ~63) / 8;
}
}
return;
}
@@ -1273,7 +1275,7 @@ chips_69000_setup_bitblt(chips_69000_t* chips)
do {
uint32_t pixel = 0;
uint32_t source_addr = chips->bitblt_running.bitblt.source_addr + (chips->bitblt_running.y * chips->bitblt.source_span) + (chips->bitblt_running.x * chips->bitblt_running.bytes_per_pixel);
switch (chips->bitblt_running.bytes_per_pixel) {
case 1: /* 8 bits-per-pixel. */
{
@@ -1423,7 +1425,7 @@ chips_69000_bitblt_write(chips_69000_t* chips, uint8_t data) {
source_pixel |= (chips->bitblt_running.bytes_port[1] << 8);
if (chips->bitblt_running.bytes_per_pixel >= 3)
source_pixel |= (chips->bitblt_running.bytes_port[2] << 16);
chips->bitblt_running.bytes_in_line_written += chips->bitblt_running.bytes_per_pixel;
chips_69000_process_pixel(chips, source_pixel);
@@ -1446,7 +1448,7 @@ chips_69000_bitblt_write(chips_69000_t* chips, uint8_t data) {
chips->bitblt_running.count_x = 0;
chips->bitblt_running.x = 0;
if (chips->bitblt_running.count_y >= chips->bitblt_running.actual_destination_height) {
chips_69000_bitblt_interrupt(chips);
return;
@@ -1498,7 +1500,7 @@ chips_69000_read_ext_reg(chips_69000_t* chips)
val = chips->ext_regs[index];
if (!(chips->ext_regs[0x62] & 0x8))
val = (val & ~8) | (i2c_gpio_get_scl(chips->i2c) << 3);
if (!(chips->ext_regs[0x62] & 0x4))
val = (val & ~4) | (i2c_gpio_get_sda(chips->i2c) << 2);
@@ -1561,12 +1563,12 @@ chips_69000_write_ext_reg(chips_69000_t* chips, uint8_t val)
scl = !!(val & 8);
else
scl = i2c_gpio_get_scl(chips->i2c);
if (chips->ext_regs[0x62] & 0x4)
sda = !!(val & 4);
else
scl = i2c_gpio_get_sda(chips->i2c);
i2c_gpio_set(chips->i2c, scl, sda);
chips->ext_regs[chips->ext_index] = val & 0x9F;
@@ -1742,7 +1744,7 @@ chips_69000_out(uint16_t addr, uint8_t val, void *p)
case 0x3B7:
case 0x3D7:
return chips_69000_write_ext_reg(chips, val);
}
svga_out(addr, val, svga);
}
@@ -1901,17 +1903,15 @@ chips_69000_pci_write(int func, int addr, uint8_t val, void *p)
if (chips->pci_conf_status & PCI_COMMAND_MEM) {
mem_mapping_enable(&chips->svga.mapping);
if (chips->linear_mapping.base)
mem_mapping_enable(&chips->linear_mapping);
mem_mapping_set_addr(&chips->linear_mapping, chips->linear_mapping.base, (1 << 24));
}
break;
}
case 0x13:
{
if (!chips->linear_mapping.enable) {
chips->linear_mapping.base = val << 24;
break;
}
mem_mapping_set_addr(&chips->linear_mapping, val << 24, (1 << 24));
chips->linear_mapping.base = val << 24;
if (chips->linear_mapping.base)
mem_mapping_set_addr(&chips->linear_mapping, chips->linear_mapping.base, (1 << 24));
break;
}
case 0x3c:
@@ -2093,7 +2093,7 @@ chips_69000_writeb_mmio(uint32_t addr, uint8_t val, chips_69000_t* chips)
chips->mem_regs_b[addr & 0xF] = val;
break;
}
}
chips->mem_regs_b[addr & 0xF] = val;
break;
@@ -2213,7 +2213,7 @@ chips_69000_readw_linear(uint32_t addr, void *p)
if (addr & 0x800000) {
if (addr & 0x400000)
return bswap16(chips_69000_readw_mmio(addr, chips));
return bswap16(svga_readw_linear(addr & 0x1FFFFF, p));
}
@@ -2232,7 +2232,7 @@ chips_69000_readl_linear(uint32_t addr, void *p)
if (addr & 0x800000) {
if (addr & 0x400000)
return bswap32(chips_69000_readl_mmio(addr, chips));
return bswap32(svga_readl_linear(addr & 0x1FFFFF, p));
}
@@ -2290,7 +2290,7 @@ chips_69000_vblank_start(svga_t *svga)
chips_69000_t *chips = (chips_69000_t *) svga->priv;
chips->mem_regs[1] |= 1 << 14;
chips->svga.crtc[0x40] &= ~0x80;
chips_69000_interrupt(chips);
}
@@ -2307,13 +2307,13 @@ chips_69000_hwcursor_draw_64x64(svga_t *svga, int displine)
dat[1] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr]));
dat[0] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr + 8]));
svga->hwcursor_latch.addr += 16;
for (uint8_t x = 0; x < 64; x++) {
if (!(dat[1] & (1ULL << 63)))
svga->monitor->target_buffer->line[displine][(offset + svga->x_add) & 2047] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, chips->cursor_pallook[5]) : svga_lookup_lut_ram(svga, chips->cursor_pallook[4]);
else if (dat[0] & (1ULL << 63))
svga->monitor->target_buffer->line[displine][(offset + svga->x_add) & 2047] ^= 0xffffff;
offset++;
dat[0] <<= 1;
dat[1] <<= 1;
@@ -2430,14 +2430,48 @@ chips_69000_line_compare(svga_t* svga)
if (chips->ext_regs[0x81] & 0xF) {
return 0;
}
return 1;
}
static void
chips_69000_disable_handlers(chips_69000_t *chips)
{
io_removehandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);
mem_mapping_disable(&chips->linear_mapping);
mem_mapping_disable(&chips->svga.mapping);
if (!chips->on_board)
mem_mapping_disable(&chips->bios_rom.mapping);
/* Save all the mappings and the timers because they are part of linked lists. */
reset_state->linear_mapping = chips->linear_mapping;
reset_state->svga.mapping = chips->svga.mapping;
reset_state->bios_rom.mapping = chips->bios_rom.mapping;
reset_state->decrement_timer = chips->decrement_timer;
reset_state->svga.timer = chips->svga.timer;
reset_state->svga.timer8514 = chips->svga.timer8514;
}
static void
chips_69000_reset(void *priv)
{
chips_69000_t *chips = (chips_69000_t *) priv;
if (reset_state != NULL) {
chips_69000_disable_handlers(chips);
reset_state->slot = chips->slot;
*chips = *reset_state;
}
}
static void *
chips_69000_init(const device_t *info)
{
chips_69000_t *chips = calloc(1, sizeof(chips_69000_t));
reset_state = calloc(1, sizeof(chips_69000_t));
/* Appears to have an odd VBIOS size. */
if (!info->local) {
@@ -2450,7 +2484,7 @@ chips_69000_init(const device_t *info)
svga_init(info, &chips->svga, chips, 1 << 21, /*2048kb*/
chips_69000_recalctimings,
chips_69000_in, chips_69000_out,
NULL,
chips_69000_hwcursor_draw,
NULL);
io_sethandler(0x03c0, 0x0020, chips_69000_in, NULL, NULL, chips_69000_out, NULL, NULL, chips);
@@ -2459,9 +2493,7 @@ chips_69000_init(const device_t *info)
chips->svga.bpp = 8;
chips->svga.miscout = 1;
chips->svga.recalctimings_ex = chips_69000_recalctimings;
chips->svga.vblank_start = chips_69000_vblank_start;
chips->svga.hwcursor_draw = chips_69000_hwcursor_draw;
chips->svga.getclock = chips_69000_getclock;
chips->svga.conv_16to32 = chips_69000_conv_16to32;
chips->svga.line_compare = chips_69000_line_compare;
@@ -2471,7 +2503,7 @@ chips_69000_init(const device_t *info)
chips->quit = 0;
chips->engine_active = 0;
chips->on_board = !!(info->local);
chips->svga.packed_chain4 = 1;
timer_add(&chips->decrement_timer, chips_69000_decrement_timer, chips, 0);
@@ -2479,9 +2511,11 @@ chips_69000_init(const device_t *info)
chips->i2c = i2c_gpio_init("ddc_chips_69000");
chips->ddc = ddc_init(i2c_gpio_get_bus(chips->i2c));
chips->flat_panel_regs[0x01] = 1;
*reset_state = *chips;
return chips;
}
@@ -2503,6 +2537,9 @@ chips_69000_close(void *p)
i2c_gpio_close(chips->i2c);
svga_close(&chips->svga);
free(reset_state);
reset_state = NULL;
free(chips);
}
@@ -2519,7 +2556,7 @@ chips_69000_force_redraw(void *p)
{
chips_69000_t *chips = (chips_69000_t *) p;
chips->svga.fullchange = changeframecount;
chips->svga.fullchange = chips->svga.monitor->mon_changeframecount;
}
const device_t chips_69000_device = {
@@ -2529,7 +2566,7 @@ const device_t chips_69000_device = {
.local = 0,
.init = chips_69000_init,
.close = chips_69000_close,
.reset = NULL,
.reset = chips_69000_reset,
{ .available = chips_69000_available },
.speed_changed = chips_69000_speed_changed,
.force_redraw = chips_69000_force_redraw,
@@ -2543,7 +2580,7 @@ const device_t chips_69000_onboard_device = {
.local = 1,
.init = chips_69000_init,
.close = chips_69000_close,
.reset = NULL,
.reset = chips_69000_reset,
{ .available = chips_69000_available },
.speed_changed = chips_69000_speed_changed,
.force_redraw = chips_69000_force_redraw,

View File

@@ -47,38 +47,11 @@ static video_timings_t timing_default = { .type = VIDEO_ISA, .write_b = 8, .writ
static int was_reset = 0;
static const device_t vid_none_device = {
.name = "None",
.internal_name = "none",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const device_t vid_internal_device = {
.name = "Internal",
.internal_name = "internal",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
static const VIDEO_CARD
video_cards[] = {
// clang-format off
{ &vid_none_device },
{ &vid_internal_device },
{ &device_none },
{ &device_internal },
{ &atiega800p_device },
{ &mach8_vga_isa_device, VIDEO_FLAG_TYPE_8514 },
{ &mach32_isa_device, VIDEO_FLAG_TYPE_8514 },
@@ -349,12 +322,14 @@ video_reset(int card)
monitor_index_global = 0;
loadfont("roms/video/mda/mda.rom", 0);
if ((card != VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) &&
(gfxcard[1] > VID_INTERNAL) && device_is_valid(video_card_getdevice(gfxcard[1]), machine)) {
video_monitor_init(1);
monitor_index_global = 1;
device_add(video_cards[gfxcard[1]].device);
monitor_index_global = 0;
for (uint8_t i = 1; i < GFXCARD_MAX; i ++) {
if ((card != VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) &&
(gfxcard[i] > VID_INTERNAL) && device_is_valid(video_card_getdevice(gfxcard[i]), machine)) {
video_monitor_init(i);
monitor_index_global = 1;
device_add(video_cards[gfxcard[i]].device);
monitor_index_global = 0;
}
}
/* Do not initialize internal cards here. */