Fixed most bugs in Olivetti machines.

This commit is contained in:
EngiNerd89
2021-01-07 23:30:19 +01:00
parent 3d516c223f
commit 0ba8dd4d0d
8 changed files with 126 additions and 25 deletions

View File

@@ -2136,7 +2136,6 @@ kbd_read(uint16_t port, void *priv)
ret |= 0x2; /* 0x10 would be 40x25 */
else
ret |= 0x0;
ret = 0xff;
} else {
/* bit 2 always on */
ret |= 0x4;

View File

@@ -24,6 +24,8 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#define HAVE_STDARG_H
#include <wchar.h>
#include <86box/86box.h>
#include <86box/device.h>
@@ -598,7 +600,7 @@ kbd_read(uint16_t port, void *priv)
ret = ((mem_size-64) / 32) >> 4;
}
else if (kbd->type == 8 || kbd->type == 9) {
/* Olivetti M19 or Zenith Data Systems Z-151*/
/* Olivetti M19 or Zenith Data Systems Z-151 */
if (kbd->pb & 0x04)
ret = kbd->pd & 0xbf;
else

View File

@@ -0,0 +1,117 @@
/*
* 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.
*
* Implementation of the Olivetti M290 registers Readout
*
* Authors: EngiNerd <webmaster.crrc@yahoo.it>
*
* Copyright 2020-2021 EngiNerd
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include "cpu.h"
#include <86box/timer.h>
#include <86box/io.h>
#include <86box/device.h>
#include <86box/chipset.h>
#include <86box/video.h>
typedef struct
{
uint8_t reg_067;
uint8_t reg_069;
} olivetti_m290_registers_t;
#ifdef ENABLE_OLIVETTI_M290_REGISTERS_LOG
int olivetti_m290_registers_do_log = ENABLE_OLIVETTI_M290_REGISTERS_LOG;
static void
olivetti_m290_registers_log(const char *fmt, ...)
{
va_list ap;
if (olivetti_m290_registers_do_log) {
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
#define olivetti_m290_registers_log(fmt, ...)
#endif
static void
olivetti_m290_registers_write(uint16_t addr, uint8_t val, void *priv)
{
olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv;
olivetti_m290_registers_log("Olivetti M290 registers: Write %02x at %02x\n", val, addr);
switch (addr) {
case 0x067:
dev->reg_067 = val;
break;
case 0x069:
dev->reg_069 = val;
break;
}
}
static uint8_t
olivetti_m290_registers_read(uint16_t addr, void *priv)
{
olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv;
uint8_t ret = 0xff;
switch (addr) {
case 0x067:
ret = dev->reg_067;
break;
case 0x069:
ret = dev->reg_069;
break;
}
olivetti_m290_registers_log("Olivetti M290 registers: Read %02x at %02x\n", ret, addr);
return ret;
}
static void
olivetti_m290_registers_close(void *priv)
{
olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv;
free(dev);
}
static void *
olivetti_m290_registers_init(const device_t *info)
{
olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) malloc(sizeof(olivetti_m290_registers_t));
memset(dev, 0, sizeof(olivetti_m290_registers_t));
dev->reg_067 = 0x0;
dev->reg_069 = 0x0;
io_sethandler(0x0067, 0x0003, olivetti_m290_registers_read, NULL, NULL, olivetti_m290_registers_write, NULL, NULL, dev);
return dev;
}
const device_t olivetti_m290_registers_device = {
"Olivetti M290 registers Readout",
0,
0,
olivetti_m290_registers_init, olivetti_m290_registers_close, NULL,
{ NULL }, NULL, NULL,
NULL
};

View File

@@ -137,5 +137,6 @@ extern const device_t wd76c10_device;
/* Miscellaneous Hardware */
extern const device_t phoenix_486_jumper_device;
extern const device_t vpc2007_device;
extern const device_t olivetti_m290_registers_device;
#endif /*EMU_CHIPSET_H*/

View File

@@ -557,25 +557,6 @@ machine_at_pja511m_init(const machine_t *model)
#endif
static uint8_t
m290_read(uint16_t port, void *priv)
{
uint8_t ret = 0x0;
switch (port) {
/*
* port 69:
* dip-switch bank on mainboard (off=1)
* bit 3 - use OCG/CGA display adapter (off) / other display adapter (on)
*/
case 0x69:
if(video_is_cga())
ret |= 0x8|0x4;
ret |= 0x1|0x2;
}
return (ret);
}
int
machine_at_olim290_init(const machine_t *model)
{
@@ -588,10 +569,10 @@ machine_at_olim290_init(const machine_t *model)
return ret;
machine_at_common_init(model);
device_add(&keyboard_at_device);
device_add(&keyboard_at_olivetti_device);
device_add(&fdc_at_device);
io_sethandler(0x069, 1, m290_read, NULL, NULL, NULL, NULL, NULL, NULL);
device_add(&olivetti_m290_registers_device);
return ret;
}

View File

@@ -790,6 +790,7 @@ machine_xt_olim240_init(const machine_t *model)
* Current bugs:
* - 640x400x2 graphics mode not supported (bit 0 of register 0x3de cannot be set)
* - optional mouse emulation missing
* - setting CPU speed at 4.77MHz sometimes throws a timer error. If the machine is hard-resetted, the error disappears.
*/
int
machine_xt_olim19_init(const machine_t *model)

View File

@@ -71,7 +71,7 @@ const machine_t machines[] = {
{ "[8088] Juko XT clone", "jukopc", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_jukopc_init, NULL },
{ "[8088] Multitech PC-700", "multitech_pc700", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 64, 0, machine_xt_multitechpc700_init, NULL },
{ "[8088] NCR PC4i", "ncr_pc4i", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_ncrpc4i_init, NULL },
{ "[8088] Olivetti M19", "olivetti_m19", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 256, 0, machine_xt_olim19_init, NULL },
{ "[8088] Olivetti M19", "olivetti_m19", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 7159092, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 256, 0, machine_xt_olim19_init, NULL },
{ "[8088] OpenXT", "open_xt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_open_xt_init, NULL },
{ "[8088] Philips P3105/NMS9100", "philips_p3105", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 768, 256, 0, machine_xt_p3105_init, NULL },
{ "[8088] Philips P3120", "philips_p3120", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 768, 256, 0, machine_xt_p3120_init, NULL },

View File

@@ -624,7 +624,7 @@ DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o hwm_gl518sm.o hwm_vt82c686.o ibm
mouse.o \
mouse_bus.o \
mouse_serial.o mouse_ps2.o \
phoenix_486_jumper.o
phoenix_486_jumper.o olivetti_m290_registers.o
SIOOBJ := sio_acc3221.o \
sio_f82c710.o sio_82091aa.o \