Major commit, cleaning a lot of old stuff.

IBM.H is gone, video stuff re-organized. Keyboard stuff reorganized.
Machines that have their own video, mouse and/or keyboard now have all this in their machine file.
Fixed and other cleanups here and there.
This commit is contained in:
waltje
2017-11-05 01:57:04 -05:00
parent f5d4436672
commit 7c67e867c8
238 changed files with 5139 additions and 7832 deletions

349
src/machine/m_amstrad.c Normal file
View File

@@ -0,0 +1,349 @@
/*
* 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.
*
* Emulation of the Amstrad series PC's.
*
* Version: @(#)m_amstrad.c 1.0.2 2017/11/03
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../io.h"
#include "../nmi.h"
#include "../pic.h"
#include "../pit.h"
#include "../ppi.h"
#include "../mem.h"
#include "../rom.h"
#include "../timer.h"
#include "../device.h"
#include "../nvr.h"
#include "../keyboard.h"
#include "../mouse.h"
#include "../game/gameport.h"
#include "../lpt.h"
#include "../sound/sound.h"
#include "../sound/snd_speaker.h"
#include "../floppy/floppy.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
#include "machine.h"
#define STAT_PARITY 0x80
#define STAT_RTIMEOUT 0x40
#define STAT_TTIMEOUT 0x20
#define STAT_LOCK 0x10
#define STAT_CD 0x08
#define STAT_SYSFLAG 0x04
#define STAT_IFULL 0x02
#define STAT_OFULL 0x01
typedef struct {
/* Machine stuff. */
uint8_t dead;
uint8_t systemstat_1,
systemstat_2;
/* Keyboard stuff. */
int8_t wantirq;
uint8_t key_waiting;
uint8_t pa;
uint8_t pb;
/* Mouse stuff. */
uint8_t mousex,
mousey;
int oldb;
} amstrad_t;
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static void
ms_write(uint16_t addr, uint8_t val, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
if (addr == 0x78)
ams->mousex = 0;
else
ams->mousey = 0;
}
static uint8_t
ms_read(uint16_t addr, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
if (addr == 0x78)
return(ams->mousex);
return(ams->mousey);
}
static uint8_t
ms_poll(int x, int y, int z, int b, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
ams->mousex += x;
ams->mousey -= y;
if ((b & 1) && !(ams->oldb & 1))
keyboard_send(0x7e);
if ((b & 2) && !(ams->oldb & 2))
keyboard_send(0x7d);
if (!(b & 1) && (ams->oldb & 1))
keyboard_send(0xfe);
if (!(b & 2) && (ams->oldb & 2))
keyboard_send(0xfd);
ams->oldb = b;
return(0);
}
static void
kbd_adddata(uint8_t val)
{
key_queue[key_queue_end] = val;
#if ENABLE_KEYBOARD_LOG
pclog("keyboard_amstrad : %02X added to key queue at %i\n",
val, key_queue_end);
#endif
key_queue_end = (key_queue_end + 1) & 0xf;
}
static void
kbd_write(uint16_t port, uint8_t val, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
#if ENABLE_KEYBOARD_LOG
pclog("keyboard_amstrad : write %04X %02X %02X\n", port, val, ams->pb);
#endif
switch (port) {
case 0x61:
#if ENABLE_KEYBOARD_LOG
pclog("keyboard_amstrad : pb write %02X %02X %i %02X %i\n",
val, ams->pb, !(ams->pb&0x40), ams->pb&0x40, (val&0x40));
#endif
if (!(ams->pb & 0x40) && (val & 0x40)) { /*Reset keyboard*/
#if ENABLE_KEYBOARD_LOG
pclog("keyboard_amstrad : reset keyboard\n");
#endif
kbd_adddata(0xaa);
}
ams->pb = val;
ppi.pb = val;
timer_process();
timer_update_outstanding();
speaker_update();
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
if (val & 0x80)
ams->pa = 0;
break;
case 0x63:
break;
case 0x64:
ams->systemstat_1 = val;
break;
case 0x65:
ams->systemstat_2 = val;
break;
default:
pclog("\nBad Amstrad keyboard write %04X %02X\n", port, val);
}
}
static uint8_t
kbd_read(uint16_t port, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
uint8_t ret = 0xff;
switch (port) {
case 0x60:
if (ams->pb & 0x80) {
ret = (ams->systemstat_1 | 0xd) & 0x7f;
} else {
ret = ams->pa;
if (key_queue_start == key_queue_end) {
ams->wantirq = 0;
} else {
ams->key_waiting = key_queue[key_queue_start];
key_queue_start = (key_queue_start + 1) & 0xf;
ams->wantirq = 1;
}
}
break;
case 0x61:
ret = ams->pb;
break;
case 0x62:
if (ams->pb & 0x04)
ret = ams->systemstat_2 & 0xf;
else
ret = ams->systemstat_2 >> 4;
ret |= (ppispeakon ? 0x20 : 0);
if (nmi)
ret |= 0x40;
break;
default:
pclog("\nBad Amstrad keyboard read %04X\n", port);
}
return(ret);
}
static void
kbd_poll(void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
keyboard_delay += (1000 * TIMER_USEC);
if (ams->wantirq)
{
ams->wantirq = 0;
ams->pa = ams->key_waiting;
picint(2);
#if ENABLE_KEYBOARD_LOG
pclog("keyboard_amstrad : take IRQ\n");
#endif
}
if (key_queue_start != key_queue_end && !ams->pa) {
ams->key_waiting = key_queue[key_queue_start];
#if ENABLE_KEYBOARD_LOG
pclog("Reading %02X from the key queue at %i\n",
ams->key_waiting, key_queue_start);
#endif
key_queue_start = (key_queue_start + 1) & 0xf;
ams->wantirq = 1;
}
}
static uint8_t
amstrad_read(uint16_t port, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
pclog("amstrad_read: %04X\n", port);
switch (port) {
case 0x379:
return(7);
case 0x37a:
if (romset == ROM_PC1512) return(0x20);
if (romset == ROM_PC200) return(0x80);
return(0);
case 0xdead:
return(ams->dead);
}
return(0xff);
}
static void
amstrad_write(uint16_t port, uint8_t val, void *priv)
{
amstrad_t *ams = (amstrad_t *)priv;
switch (port) {
case 0xdead:
ams->dead = val;
break;
}
}
void
machine_amstrad_init(machine_t *model)
{
amstrad_t *ams;
ams = (amstrad_t *)malloc(sizeof(amstrad_t));
memset(ams, 0x00, sizeof(amstrad_t));
machine_common_init(model);
lpt2_remove_ams();
io_sethandler(0x0379, 2,
amstrad_read, NULL, NULL, NULL, NULL, NULL, ams);
io_sethandler(0xdead, 1,
amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, ams);
io_sethandler(0x0078, 1,
ms_read, NULL, NULL, ms_write, NULL, NULL, ams);
io_sethandler(0x007a, 1,
ms_read, NULL, NULL, ms_write, NULL, NULL, ams);
ams->wantirq = 0;
io_sethandler(0x0060, 6,
kbd_read, NULL, NULL, kbd_write, NULL, NULL, ams);
timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, ams);
keyboard_send = kbd_adddata;
keyboard_scan = 1;
/* Tell mouse driver about our internal mouse. */
mouse_setpoll(ms_poll, ams);
if (joystick_type != 7)
device_add(&gameport_device);
/* FIXME: make sure this is correct? */
nvr_at_init(1);
nmi_init();
fdc_set_dskchg_activelow();

View File

@@ -3,7 +3,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../pic.h"
#include "../pit.h"
#include "../dma.h"
@@ -11,7 +10,7 @@
#include "../device.h"
#include "../nvr.h"
#include "../game/gameport.h"
#include "../keyboard_at.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../disk/hdc.h"
#include "../disk/hdc_ide.h"
@@ -32,7 +31,7 @@ machine_at_init(machine_t *model)
nvr_at_init(8);
keyboard_at_init();
device_add(&keyboard_at_device);
if (joystick_type != 7)
device_add(&gameport_device);

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 430FX PCISet chip.
*
* Version: @(#)machine_at_430fx.c 1.0.7 2017/10/16
* Version: @(#)m_at_430fx.c 1.0.8 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -21,7 +21,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../mem.h"
#include "../memregs.h"
#include "../rom.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 430HX PCISet chip.
*
* Version: @(#)machine_at_430hx.c 1.0.7 2017/10/16
* Version: @(#)m_at_430hx.c 1.0.8 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -21,7 +21,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../mem.h"
#include "../memregs.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 430LX and 430NX PCISet chips.
*
* Version: @(#)machine_at_430lx_nx.c 1.0.7 2017/10/16
* Version: @(#)m_at_430lx_nx.c 1.0.8 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -21,7 +21,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../mem.h"
#include "../memregs.h"
#include "../rom.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 430VX PCISet chip.
*
* Version: @(#)machine_at_430vx.c 1.0.8 2017/10/16
* Version: @(#)m_at_430vx.c 1.0.9 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -21,7 +21,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../pci.h"
#include "../mem.h"

View File

@@ -8,7 +8,7 @@
*
* Implementation of the Intel 440FX PCISet chip.
*
* Version: @(#)machine_at_440fx.c 1.0.7 2017/10/16
* Version: @(#)m_at_440fx.c 1.0.8 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -21,7 +21,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../pci.h"
#include "../mem.h"

View File

@@ -6,7 +6,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../mem.h"

View File

@@ -3,7 +3,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../lpt.h"
#include "../serial.h"

View File

@@ -6,7 +6,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../mem.h"
#include "machine.h"

View File

@@ -6,7 +6,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../mem.h"

View File

@@ -7,7 +7,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "machine.h"

View File

@@ -256,7 +256,6 @@ SeeAlso: #P0178,#P0187
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../mem.h"

View File

@@ -10,7 +10,7 @@
*
* Re-worked version based on the 82C235 datasheet and errata.
*
* Version: @(#)at_scat.c 1.0.4 2017/10/18
* Version: @(#)m_at_scat.c 1.0.5 2017/11/04
*
* Authors: Original by GreatPsycho for PCem.
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -22,7 +22,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../cpu/x86.h"
#include "../io.h"

View File

@@ -9,7 +9,7 @@
* SiS sis85c471 Super I/O Chip
* Used by DTK PKM-0038S E-2
*
* Version: @(#)sis85c471.c 1.0.7 2017/10/16
* Version: @(#)m_at_sis85c471.c 1.0.8 2017/11/04
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -20,7 +20,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../memregs.h"
#include "../device.h"

View File

@@ -7,7 +7,6 @@
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../pci.h"

View File

@@ -6,7 +6,7 @@
*
* Emulation of the SiS 50x PCI chips.
*
* Version: @(#)machine_at_sis_85c50x.c 1.0.4 2017/10/16
* Version: @(#)m_at_sis_85c50x.c 1.0.5 2017/11/04
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
@@ -18,7 +18,6 @@
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../pci.h"
#include "../mem.h"

View File

@@ -6,7 +6,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../mem.h"
#include "../serial.h"

View File

@@ -3,7 +3,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../dma.h"
#include "../pic.h"
#include "../pit.h"

View File

@@ -6,16 +6,16 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../nmi.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../nvr.h"
#include "../game/gameport.h"
#include "../keyboard_xt.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../game/gameport.h"
#include "../video/video.h"
#include "machine.h"
@@ -138,7 +138,7 @@ machine_europc_init(machine_t *model)
lpt3_init(0x3bc);
jim_init();
keyboard_xt_init();
device_add(&keyboard_xt_device);
nmi_init();
if (joystick_type != 7)
device_add(&gameport_device);

View File

@@ -0,0 +1,793 @@
/*
* 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.
*
* Emulation of the Olivetti M24.
*
* Version: @(#)m_olivetti_m24.c 1.0.2 2017/11/03
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../io.h"
#include "../pic.h"
#include "../pit.h"
#include "../ppi.h"
#include "../nmi.h"
#include "../mem.h"
#include "../timer.h"
#include "../device.h"
#include "../nvr.h"
#include "../keyboard.h"
#include "../mouse.h"
#include "../game/gameport.h"
#include "../sound/sound.h"
#include "../sound/snd_speaker.h"
#include "../video/video.h"
#include "machine.h"
#define STAT_PARITY 0x80
#define STAT_RTIMEOUT 0x40
#define STAT_TTIMEOUT 0x20
#define STAT_LOCK 0x10
#define STAT_CD 0x08
#define STAT_SYSFLAG 0x04
#define STAT_IFULL 0x02
#define STAT_OFULL 0x01
typedef struct {
/* Video stuff. */
mem_mapping_t mapping;
uint8_t crtc[32];
int crtcreg;
uint8_t *vram;
uint8_t charbuffer[256];
uint8_t ctrl;
uint32_t base;
uint8_t cgamode, cgacol;
uint8_t stat;
int linepos, displine;
int sc, vc;
int con, coff, cursoron, blink;
int64_t vsynctime;
int vadj;
int lineff;
uint16_t ma, maback;
int dispon;
int64_t dispontime, dispofftime;
int64_t vidtime;
int firstline, lastline;
/* Keyboard stuff. */
int wantirq;
uint8_t command;
uint8_t status;
uint8_t out;
uint8_t output_port;
int param,
param_total;
uint8_t params[16];
uint8_t scan[7];
/* Mouse stuff. */
int mouse_mode;
int x, y, b;
} olim24_t;
static uint8_t crtcmask[32] = {
0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f,
0xf3, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static void
recalc_timings(olim24_t *m24)
{
double _dispontime, _dispofftime, disptime;
if (m24->cgamode & 1) {
disptime = m24->crtc[0] + 1;
_dispontime = m24->crtc[1];
} else {
disptime = (m24->crtc[0] + 1) << 1;
_dispontime = m24->crtc[1] << 1;
}
_dispofftime = disptime - _dispontime;
_dispontime *= CGACONST / 2;
_dispofftime *= CGACONST / 2;
m24->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT));
m24->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT));
}
static void
vid_out(uint16_t addr, uint8_t val, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
uint8_t old;
switch (addr) {
case 0x3d4:
m24->crtcreg = val & 31;
break;
case 0x3d5:
old = m24->crtc[m24->crtcreg];
m24->crtc[m24->crtcreg] = val & crtcmask[m24->crtcreg];
if (old != val) {
if (m24->crtcreg < 0xe || m24->crtcreg > 0x10) {
fullchange = changeframecount;
recalc_timings(m24);
}
}
break;
case 0x3d8:
m24->cgamode = val;
break;
case 0x3d9:
m24->cgacol = val;
break;
case 0x3de:
m24->ctrl = val;
m24->base = (val & 0x08) ? 0x4000 : 0;
break;
}
}
static uint8_t
vid_in(uint16_t addr, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
uint8_t ret = 0xff;
switch (addr) {
case 0x3d4:
ret = m24->crtcreg;
break;
case 0x3d5:
ret = m24->crtc[m24->crtcreg];
break;
case 0x3da:
ret = m24->stat;
break;
}
return(ret);
}
static void
vid_write(uint32_t addr, uint8_t val, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
m24->vram[addr & 0x7FFF]=val;
m24->charbuffer[ ((int)(((m24->dispontime - m24->vidtime) * 2) / (CGACONST / 2))) & 0xfc] = val;
m24->charbuffer[(((int)(((m24->dispontime - m24->vidtime) * 2) / (CGACONST / 2))) & 0xfc) | 1] = val;
}
static uint8_t
vid_read(uint32_t addr, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
return(m24->vram[addr & 0x7FFF]);
}
static void
vid_poll(void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
uint16_t ca = (m24->crtc[15] | (m24->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c;
int oldvc;
uint8_t chr, attr;
uint16_t dat, dat2;
int cols[4];
int col;
int oldsc;
if (!m24->linepos) {
m24->vidtime += m24->dispofftime;
m24->stat |= 1;
m24->linepos = 1;
oldsc = m24->sc;
if ((m24->crtc[8] & 3) == 3)
m24->sc = (m24->sc << 1) & 7;
if (m24->dispon) {
if (m24->displine < m24->firstline) {
m24->firstline = m24->displine;
}
m24->lastline = m24->displine;
for (c = 0; c < 8; c++) {
if ((m24->cgamode & 0x12) == 0x12) {
buffer->line[m24->displine][c] = 0;
if (m24->cgamode & 1)
buffer->line[m24->displine][c + (m24->crtc[1] << 3) + 8] = 0;
else
buffer->line[m24->displine][c + (m24->crtc[1] << 4) + 8] = 0;
} else {
buffer->line[m24->displine][c] = (m24->cgacol & 15) + 16;
if (m24->cgamode & 1)
buffer->line[m24->displine][c + (m24->crtc[1] << 3) + 8] = (m24->cgacol & 15) + 16;
else
buffer->line[m24->displine][c + (m24->crtc[1] << 4) + 8] = (m24->cgacol & 15) + 16;
}
}
if (m24->cgamode & 1) {
for (x = 0; x < m24->crtc[1]; x++) {
chr = m24->charbuffer[ x << 1];
attr = m24->charbuffer[(x << 1) + 1];
drawcursor = ((m24->ma == ca) && m24->con && m24->cursoron);
if (m24->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
cols[0] = ((attr >> 4) & 7) + 16;
if ((m24->blink & 16) && (attr & 0x80) && !drawcursor)
cols[1] = cols[0];
} else {
cols[1] = (attr & 15) + 16;
cols[0] = (attr >> 4) + 16;
}
if (drawcursor) {
for (c = 0; c < 8; c++)
buffer->line[m24->displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
} else {
for (c = 0; c < 8; c++)
buffer->line[m24->displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
}
m24->ma++;
}
} else if (!(m24->cgamode & 2)) {
for (x = 0; x < m24->crtc[1]; x++) {
chr = m24->vram[((m24->ma << 1) & 0x3fff) + m24->base];
attr = m24->vram[(((m24->ma << 1) + 1) & 0x3fff) + m24->base];
drawcursor = ((m24->ma == ca) && m24->con && m24->cursoron);
if (m24->cgamode & 0x20) {
cols[1] = (attr & 15) + 16;
cols[0] = ((attr >> 4) & 7) + 16;
if ((m24->blink & 16) && (attr & 0x80))
cols[1] = cols[0];
} else {
cols[1] = (attr & 15) + 16;
cols[0] = (attr >> 4) + 16;
}
m24->ma++;
if (drawcursor) {
for (c = 0; c < 8; c++)
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
} else {
for (c = 0; c < 8; c++)
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
}
}
} else if (!(m24->cgamode & 16)) {
cols[0] = (m24->cgacol & 15) | 16;
col = (m24->cgacol & 16) ? 24 : 16;
if (m24->cgamode & 4) {
cols[1] = col | 3;
cols[2] = col | 4;
cols[3] = col | 7;
} else if (m24->cgacol & 32) {
cols[1] = col | 3;
cols[2] = col | 5;
cols[3] = col | 7;
} else {
cols[1] = col | 2;
cols[2] = col | 4;
cols[3] = col | 6;
}
for (x = 0; x < m24->crtc[1]; x++) {
dat = (m24->vram[((m24->ma << 1) & 0x1fff) + ((m24->sc & 1) * 0x2000) + m24->base] << 8) |
m24->vram[((m24->ma << 1) & 0x1fff) + ((m24->sc & 1) * 0x2000) + 1 + m24->base];
m24->ma++;
for (c = 0; c < 8; c++) {
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
} else {
if (m24->ctrl & 1) {
dat2 = ((m24->sc & 1) * 0x4000) | (m24->lineff * 0x2000);
cols[0] = 0; cols[1] = /*(m24->cgacol & 15)*/15 + 16;
} else {
dat2 = (m24->sc & 1) * 0x2000;
cols[0] = 0; cols[1] = (m24->cgacol & 15) + 16;
}
for (x = 0; x < m24->crtc[1]; x++) {
dat = (m24->vram[((m24->ma << 1) & 0x1fff) + dat2] << 8) | m24->vram[((m24->ma << 1) & 0x1fff) + dat2 + 1];
m24->ma++;
for (c = 0; c < 16; c++) {
buffer->line[m24->displine][(x << 4) + c + 8] = cols[dat >> 15];
dat <<= 1;
}
}
}
} else {
cols[0] = ((m24->cgamode & 0x12) == 0x12) ? 0 : (m24->cgacol & 15) + 16;
if (m24->cgamode & 1) hline(buffer, 0, m24->displine, (m24->crtc[1] << 3) + 16, cols[0]);
else hline(buffer, 0, m24->displine, (m24->crtc[1] << 4) + 16, cols[0]);
}
if (m24->cgamode & 1)
x = (m24->crtc[1] << 3) + 16;
else
x = (m24->crtc[1] << 4) + 16;
m24->sc = oldsc;
if (m24->vc == m24->crtc[7] && !m24->sc)
m24->stat |= 8;
m24->displine++;
if (m24->displine >= 720) m24->displine = 0;
} else {
m24->vidtime += m24->dispontime;
if (m24->dispon) m24->stat &= ~1;
m24->linepos = 0;
m24->lineff ^= 1;
if (m24->lineff) {
m24->ma = m24->maback;
} else {
if (m24->vsynctime) {
m24->vsynctime--;
if (!m24->vsynctime)
m24->stat &= ~8;
}
if (m24->sc == (m24->crtc[11] & 31) || ((m24->crtc[8] & 3) == 3 && m24->sc == ((m24->crtc[11] & 31) >> 1))) {
m24->con = 0;
m24->coff = 1;
}
if (m24->vadj) {
m24->sc++;
m24->sc &= 31;
m24->ma = m24->maback;
m24->vadj--;
if (!m24->vadj) {
m24->dispon = 1;
m24->ma = m24->maback = (m24->crtc[13] | (m24->crtc[12] << 8)) & 0x3fff;
m24->sc = 0;
}
} else if (m24->sc == m24->crtc[9] || ((m24->crtc[8] & 3) == 3 && m24->sc == (m24->crtc[9] >> 1))) {
m24->maback = m24->ma;
m24->sc = 0;
oldvc = m24->vc;
m24->vc++;
m24->vc &= 127;
if (m24->vc == m24->crtc[6])
m24->dispon=0;
if (oldvc == m24->crtc[4]) {
m24->vc = 0;
m24->vadj = m24->crtc[5];
if (!m24->vadj) m24->dispon = 1;
if (!m24->vadj) m24->ma = m24->maback = (m24->crtc[13] | (m24->crtc[12] << 8)) & 0x3fff;
if ((m24->crtc[10] & 0x60) == 0x20)
m24->cursoron = 0;
else
m24->cursoron = m24->blink & 16;
}
if (m24->vc == m24->crtc[7]) {
m24->dispon = 0;
m24->displine = 0;
m24->vsynctime = (m24->crtc[3] >> 4) + 1;
if (m24->crtc[7]) {
if (m24->cgamode & 1)
x = (m24->crtc[1] << 3) + 16;
else
x = (m24->crtc[1] << 4) + 16;
m24->lastline++;
if ((x != xsize) || ((m24->lastline - m24->firstline) != ysize) || video_force_resize_get()) {
xsize = x;
ysize = m24->lastline - m24->firstline;
if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200;
set_screen_size(xsize, ysize + 16);
if (video_force_resize_get())
video_force_resize_set(0);
}
video_blit_memtoscreen_8(0, m24->firstline - 8, 0, (m24->lastline - m24->firstline) + 16, xsize, (m24->lastline - m24->firstline) + 16);
frames++;
video_res_x = xsize - 16;
video_res_y = ysize;
if (m24->cgamode & 1) {
video_res_x /= 8;
video_res_y /= (m24->crtc[9] + 1) * 2;
video_bpp = 0;
} else if (!(m24->cgamode & 2)) {
video_res_x /= 16;
video_res_y /= (m24->crtc[9] + 1) * 2;
video_bpp = 0;
} else if (!(m24->cgamode & 16)) {
video_res_x /= 2;
video_res_y /= 2;
video_bpp = 2;
} else if (!(m24->ctrl & 1)) {
video_res_y /= 2;
video_bpp = 1;
}
}
m24->firstline = 1000;
m24->lastline = 0;
m24->blink++;
}
} else {
m24->sc++;
m24->sc &= 31;
m24->ma = m24->maback;
}
if ((m24->sc == (m24->crtc[10] & 31) || ((m24->crtc[8] & 3) == 3 && m24->sc == ((m24->crtc[10] & 31) >> 1))))
m24->con = 1;
}
if (m24->dispon && (m24->cgamode & 1)) {
for (x = 0; x < (m24->crtc[1] << 1); x++)
m24->charbuffer[x] = m24->vram[(((m24->ma << 1) + x) & 0x3fff) + m24->base];
}
}
}
static void
speed_changed(void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
recalc_timings(m24);
}
static void
kbd_poll(void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
keyboard_delay += (1000LL * TIMER_USEC);
if (m24->wantirq) {
m24->wantirq = 0;
picint(2);
#if ENABLE_KEYBOARD_LOG
pclog("M24: take IRQ\n");
#endif
}
if (!(m24->status & STAT_OFULL) && key_queue_start != key_queue_end) {
#if ENABLE_KEYBOARD_LOG
pclog("Reading %02X from the key queue at %i\n",
m24->out, key_queue_start);
#endif
m24->out = key_queue[key_queue_start];
key_queue_start = (key_queue_start + 1) & 0xf;
m24->status |= STAT_OFULL;
m24->status &= ~STAT_IFULL;
m24->wantirq = 1;
}
}
static void
kbd_adddata(uint8_t val)
{
key_queue[key_queue_end] = val;
key_queue_end = (key_queue_end + 1) & 0xf;
}
static void
kbd_write(uint16_t port, uint8_t val, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
#if ENABLE_KEYBOARD_LOG
pclog("M24: write %04X %02X\n", port, val);
#endif
#if 0
if (ram[8] == 0xc3) {
output = 3;
}
#endif
switch (port) {
case 0x60:
if (m24->param != m24->param_total) {
m24->params[m24->param++] = val;
if (m24->param == m24->param_total) {
switch (m24->command) {
case 0x11:
m24->mouse_mode = 0;
m24->scan[0] = m24->params[0];
m24->scan[1] = m24->params[1];
m24->scan[2] = m24->params[2];
m24->scan[3] = m24->params[3];
m24->scan[4] = m24->params[4];
m24->scan[5] = m24->params[5];
m24->scan[6] = m24->params[6];
break;
case 0x12:
m24->mouse_mode = 1;
m24->scan[0] = m24->params[0];
m24->scan[1] = m24->params[1];
m24->scan[2] = m24->params[2];
break;
default:
pclog("M24: bad keyboard command complete %02X\n", m24->command);
}
}
} else {
m24->command = val;
switch (val) {
case 0x01: /*Self-test*/
break;
case 0x05: /*Read ID*/
kbd_adddata(0x00);
break;
case 0x11:
m24->param = 0;
m24->param_total = 9;
break;
case 0x12:
m24->param = 0;
m24->param_total = 4;
break;
default:
pclog("M24: bad keyboard command %02X\n", val);
}
}
break;
case 0x61:
ppi.pb = val;
timer_process();
timer_update_outstanding();
speaker_update();
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
break;
}
}
static uint8_t
kbd_read(uint16_t port, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
uint8_t ret = 0xff;
switch (port) {
case 0x60:
ret = m24->out;
if (key_queue_start == key_queue_end) {
m24->status &= ~STAT_OFULL;
m24->wantirq = 0;
} else {
m24->out = key_queue[key_queue_start];
key_queue_start = (key_queue_start + 1) & 0xf;
m24->status |= STAT_OFULL;
m24->status &= ~STAT_IFULL;
m24->wantirq = 1;
}
break;
case 0x61:
ret = ppi.pb;
break;
case 0x64:
ret = m24->status;
m24->status &= ~(STAT_RTIMEOUT | STAT_TTIMEOUT);
break;
default:
pclog("\nBad M24 keyboard read %04X\n", port);
}
return(ret);
}
static uint8_t
ms_poll(int x, int y, int z, int b, void *priv)
{
olim24_t *m24 = (olim24_t *)priv;
m24->x += x;
m24->y += y;
if (((key_queue_end - key_queue_start) & 0xf) > 14) return(0xff);
if ((b & 1) && !(m24->b & 1))
kbd_adddata(m24->scan[0]);
if (!(b & 1) && (m24->b & 1))
kbd_adddata(m24->scan[0] | 0x80);
m24->b = (m24->b & ~1) | (b & 1);
if (((key_queue_end - key_queue_start) & 0xf) > 14) return(0xff);
if ((b & 2) && !(m24->b & 2))
kbd_adddata(m24->scan[2]);
if (!(b & 2) && (m24->b & 2))
kbd_adddata(m24->scan[2] | 0x80);
m24->b = (m24->b & ~2) | (b & 2);
if (((key_queue_end - key_queue_start) & 0xf) > 14) return(0xff);
if ((b & 4) && !(m24->b & 4))
kbd_adddata(m24->scan[1]);
if (!(b & 4) && (m24->b & 4))
kbd_adddata(m24->scan[1] | 0x80);
m24->b = (m24->b & ~4) | (b & 4);
if (m24->mouse_mode) {
if (((key_queue_end - key_queue_start) & 0xf) > 12) return(0xff);
if (!m24->x && !m24->y) return(0xff);
m24->y = -m24->y;
if (m24->x < -127) m24->x = -127;
if (m24->x > 127) m24->x = 127;
if (m24->x < -127) m24->x = 0x80 | ((-m24->x) & 0x7f);
if (m24->y < -127) m24->y = -127;
if (m24->y > 127) m24->y = 127;
if (m24->y < -127) m24->y = 0x80 | ((-m24->y) & 0x7f);
kbd_adddata(0xfe);
kbd_adddata(m24->x);
kbd_adddata(m24->y);
m24->x = m24->y = 0;
} else {
while (m24->x < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return(0xff);
m24->x += 4;
kbd_adddata(m24->scan[3]);
}
while (m24->x > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return(0xff);
m24->x -= 4;
kbd_adddata(m24->scan[4]);
}
while (m24->y < -4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return(0xff);
m24->y += 4;
kbd_adddata(m24->scan[5]);
}
while (m24->y > 4) {
if (((key_queue_end - key_queue_start) & 0xf) > 14)
return(0xff);
m24->y -= 4;
kbd_adddata(m24->scan[6]);
}
}
return(0);
}
static uint8_t
m24_read(uint16_t port, void *priv)
{
switch (port) {
case 0x66:
return 0x00;
case 0x67:
return 0x20 | 0x40 | 0x0C;
}
return(0xff);
}
device_t m24_device = {
"Olivetti M24",
0, 0,
NULL, NULL, NULL,
NULL,
speed_changed,
NULL, NULL,
NULL
};
void
machine_olim24_init(machine_t *model)
{
olim24_t *m24;
m24 = (olim24_t *)malloc(sizeof(olim24_t));
memset(m24, 0x00, sizeof(olim24_t));
machine_common_init(model);
io_sethandler(0x0066, 2, m24_read, NULL, NULL, NULL, NULL, NULL, m24);
/* Initialize the video adapter. */
m24->vram = malloc(0x8000);
overscan_x = overscan_y = 16;
mem_mapping_add(&m24->mapping, 0xb8000, 0x08000,
vid_read, NULL, NULL,
vid_write, NULL, NULL, NULL, 0, m24);
io_sethandler(0x03d0, 16, vid_in, NULL, NULL, vid_out, NULL, NULL, m24);
timer_add(vid_poll, &m24->vidtime, TIMER_ALWAYS_ENABLED, m24);
device_add(&m24_device);
/* Initialize the keyboard. */
m24->status = STAT_LOCK | STAT_CD;
m24->scan[0] = 0x1c;
m24->scan[1] = 0x53;
m24->scan[2] = 0x01;
m24->scan[3] = 0x4b;
m24->scan[4] = 0x4d;
m24->scan[5] = 0x48;
m24->scan[6] = 0x50;
io_sethandler(0x0060, 2,
kbd_read, NULL, NULL, kbd_write, NULL, NULL, m24);
io_sethandler(0x0064, 1,
kbd_read, NULL, NULL, kbd_write, NULL, NULL, m24);
keyboard_send = kbd_adddata;
keyboard_scan = 1;
timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, m24);
/* Tell mouse driver about our internal mouse. */
mouse_setpoll(ms_poll, m24);
if (joystick_type != 7)
device_add(&gameport_device);
/* FIXME: make sure this is correct?? */
nvr_at_init(8);
nmi_init();
}

763
src/machine/m_pcjr.c Normal file
View File

@@ -0,0 +1,763 @@
/*
* 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.
*
* Emulation of the IBM PCjr.
*
* Version: @(#)m_pcjr.c 1.0.2 2017/11/03
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
*
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016,2017 Miran Grca.
* Copyright 2017 Fred N. van Kempen.
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <wchar.h>
#include "../86box.h"
#include "../io.h"
#include "../nmi.h"
#include "../pic.h"
#include "../pit.h"
#include "../mem.h"
#include "../timer.h"
#include "../device.h"
#include "../serial.h"
#include "../keyboard.h"
#include "../floppy/floppy.h"
#include "../floppy/fdc.h"
#include "../floppy/fdd.h"
#include "../sound/sound.h"
#include "../sound/snd_speaker.h"
#include "../sound/snd_sn76489.h"
#include "../video/video.h"
#include "../video/vid_cga_comp.h"
#include "machine.h"
#define PCJR_RGB 0
#define PCJR_COMPOSITE 1
#define STAT_PARITY 0x80
#define STAT_RTIMEOUT 0x40
#define STAT_TTIMEOUT 0x20
#define STAT_LOCK 0x10
#define STAT_CD 0x08
#define STAT_SYSFLAG 0x04
#define STAT_IFULL 0x02
#define STAT_OFULL 0x01
typedef struct {
/* Video Controller stuff. */
mem_mapping_t mapping;
uint8_t crtc[32];
int crtcreg;
int array_index;
uint8_t array[32];
int array_ff;
int memctrl;
uint8_t stat;
int addr_mode;
uint8_t *vram,
*b8000;
int linepos, displine;
int sc, vc;
int dispon;
int con, coff, cursoron, blink;
int64_t vsynctime;
int vadj;
uint16_t ma, maback;
int64_t dispontime, dispofftime, vidtime;
int firstline, lastline;
int composite;
/* Keyboard Controller stuff. */
int latched;
int data;
int serial_data[44];
int serial_pos;
uint8_t pa;
uint8_t pb;
} pcjr_t;
static uint8_t crtcmask[32] = {
0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f,
0xf3, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static uint8_t key_queue[16];
static int key_queue_start = 0,
key_queue_end = 0;
static void
recalc_address(pcjr_t *pcjr)
{
if ((pcjr->memctrl & 0xc0) == 0xc0) {
pcjr->vram = &ram[(pcjr->memctrl & 0x06) << 14];
pcjr->b8000 = &ram[(pcjr->memctrl & 0x30) << 11];
} else {
pcjr->vram = &ram[(pcjr->memctrl & 0x07) << 14];
pcjr->b8000 = &ram[(pcjr->memctrl & 0x38) << 11];
}
}
static void
recalc_timings(pcjr_t *pcjr)
{
double _dispontime, _dispofftime, disptime;
if (pcjr->array[0] & 1) {
disptime = pcjr->crtc[0] + 1;
_dispontime = pcjr->crtc[1];
} else {
disptime = (pcjr->crtc[0] + 1) << 1;
_dispontime = pcjr->crtc[1] << 1;
}
_dispofftime = disptime - _dispontime;
_dispontime *= CGACONST;
_dispofftime *= CGACONST;
pcjr->dispontime = (int64_t)(_dispontime * (1 << TIMER_SHIFT));
pcjr->dispofftime = (int64_t)(_dispofftime * (1 << TIMER_SHIFT));
}
static void
vid_out(uint16_t addr, uint8_t val, void *p)
{
pcjr_t *pcjr = (pcjr_t *)p;
uint8_t old;
switch (addr) {
case 0x3d4:
pcjr->crtcreg = val & 0x1f;
return;
case 0x3d5:
old = pcjr->crtc[pcjr->crtcreg];
pcjr->crtc[pcjr->crtcreg] = val & crtcmask[pcjr->crtcreg];
if (old != val) {
if (pcjr->crtcreg < 0xe || pcjr->crtcreg > 0x10) {
fullchange = changeframecount;
recalc_timings(pcjr);
}
}
return;
case 0x3da:
if (!pcjr->array_ff)
pcjr->array_index = val & 0x1f;
else {
if (pcjr->array_index & 0x10)
val &= 0x0f;
pcjr->array[pcjr->array_index & 0x1f] = val;
if (!(pcjr->array_index & 0x1f))
update_cga16_color(val);
}
pcjr->array_ff = !pcjr->array_ff;
break;
case 0x3df:
pcjr->memctrl = val;
pcjr->addr_mode = val >> 6;
recalc_address(pcjr);
break;
}
}
static uint8_t
vid_in(uint16_t addr, void *p)
{
pcjr_t *pcjr = (pcjr_t *)p;
uint8_t ret = 0xff;
switch (addr) {
case 0x3d4:
ret = pcjr->crtcreg;
break;
case 0x3d5:
ret = pcjr->crtc[pcjr->crtcreg];
break;
case 0x3da:
pcjr->array_ff = 0;
pcjr->stat ^= 0x10;
ret = pcjr->stat;
break;
}
return(ret);
}
static void
vid_write(uint32_t addr, uint8_t val, void *p)
{
pcjr_t *pcjr = (pcjr_t *)p;
if (pcjr->memctrl == -1) return;
egawrites++;
pcjr->b8000[addr & 0x3fff] = val;
}
static uint8_t
vid_read(uint32_t addr, void *p)
{
pcjr_t *pcjr = (pcjr_t *)p;
if (pcjr->memctrl == -1) return(0xff);
egareads++;
return(pcjr->b8000[addr & 0x3fff]);
}
static void
vid_poll(void *p)
{
pcjr_t *pcjr = (pcjr_t *)p;
uint16_t ca = (pcjr->crtc[15] | (pcjr->crtc[14] << 8)) & 0x3fff;
int drawcursor;
int x, c;
int oldvc;
uint8_t chr, attr;
uint16_t dat;
int cols[4];
int oldsc;
if (! pcjr->linepos) {
pcjr->vidtime += pcjr->dispofftime;
pcjr->stat &= ~1;
pcjr->linepos = 1;
oldsc = pcjr->sc;
if ((pcjr->crtc[8] & 3) == 3)
pcjr->sc = (pcjr->sc << 1) & 7;
if (pcjr->dispon) {
uint16_t offset = 0;
uint16_t mask = 0x1fff;
if (pcjr->displine < pcjr->firstline) {
pcjr->firstline = pcjr->displine;
video_wait_for_buffer();
}
pcjr->lastline = pcjr->displine;
cols[0] = (pcjr->array[2] & 0xf) + 16;
for (c = 0; c < 8; c++) {
buffer->line[pcjr->displine][c] = cols[0];
if (pcjr->array[0] & 1)
buffer->line[pcjr->displine][c + (pcjr->crtc[1] << 3) + 8] = cols[0];
else
buffer->line[pcjr->displine][c + (pcjr->crtc[1] << 4) + 8] = cols[0];
}
switch (pcjr->addr_mode) {
case 0: /*Alpha*/
offset = 0;
mask = 0x3fff;
break;
case 1: /*Low resolution graphics*/
offset = (pcjr->sc & 1) * 0x2000;
break;
case 3: /*High resolution graphics*/
offset = (pcjr->sc & 3) * 0x2000;
break;
}
switch ((pcjr->array[0] & 0x13) | ((pcjr->array[3] & 0x08) << 5)) {
case 0x13: /*320x200x16*/
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
buffer->line[pcjr->displine][(x << 3) + 8] =
buffer->line[pcjr->displine][(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 3) + 10] =
buffer->line[pcjr->displine][(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 3) + 12] =
buffer->line[pcjr->displine][(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 3) + 14] =
buffer->line[pcjr->displine][(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
}
break;
case 0x12: /*160x200x16*/
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
buffer->line[pcjr->displine][(x << 4) + 8] =
buffer->line[pcjr->displine][(x << 4) + 9] =
buffer->line[pcjr->displine][(x << 4) + 10] =
buffer->line[pcjr->displine][(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 4) + 12] =
buffer->line[pcjr->displine][(x << 4) + 13] =
buffer->line[pcjr->displine][(x << 4) + 14] =
buffer->line[pcjr->displine][(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 4) + 16] =
buffer->line[pcjr->displine][(x << 4) + 17] =
buffer->line[pcjr->displine][(x << 4) + 18] =
buffer->line[pcjr->displine][(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
buffer->line[pcjr->displine][(x << 4) + 20] =
buffer->line[pcjr->displine][(x << 4) + 21] =
buffer->line[pcjr->displine][(x << 4) + 22] =
buffer->line[pcjr->displine][(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
}
break;
case 0x03: /*640x200x4*/
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 8; c++) {
chr = (dat >> 7) & 1;
chr |= ((dat >> 14) & 2);
buffer->line[pcjr->displine][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16;
dat <<= 1;
}
}
break;
case 0x01: /*80 column text*/
for (x = 0; x < pcjr->crtc[1]; x++) {
chr = pcjr->vram[((pcjr->ma << 1) & mask) + offset];
attr = pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron);
if (pcjr->array[3] & 4) {
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16] + 16;
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16] + 16;
if ((pcjr->blink & 16) && (attr & 0x80) && !drawcursor)
cols[1] = cols[0];
} else {
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16] + 16;
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16;
}
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++)
buffer->line[pcjr->displine][(x << 3) + c + 8] = cols[0];
} else {
for (c = 0; c < 8; c++)
buffer->line[pcjr->displine][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
if (drawcursor) {
for (c = 0; c < 8; c++)
buffer->line[pcjr->displine][(x << 3) + c + 8] ^= 15;
}
pcjr->ma++;
}
break;
case 0x00: /*40 column text*/
for (x = 0; x < pcjr->crtc[1]; x++) {
chr = pcjr->vram[((pcjr->ma << 1) & mask) + offset];
attr = pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron);
if (pcjr->array[3] & 4) {
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16] + 16;
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16] + 16;
if ((pcjr->blink & 16) && (attr & 0x80) && !drawcursor)
cols[1] = cols[0];
} else {
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16] + 16;
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16;
}
pcjr->ma++;
if (pcjr->sc & 8) {
for (c = 0; c < 8; c++)
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[0];
} else {
for (c = 0; c < 8; c++)
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
}
if (drawcursor) {
for (c = 0; c < 16; c++)
buffer->line[pcjr->displine][(x << 4) + c + 8] ^= 15;
}
}
break;
case 0x02: /*320x200x4*/
cols[0] = pcjr->array[0 + 16] + 16;
cols[1] = pcjr->array[1 + 16] + 16;
cols[2] = pcjr->array[2 + 16] + 16;
cols[3] = pcjr->array[3 + 16] + 16;
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 8; c++) {
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
dat <<= 2;
}
}
break;
case 0x102: /*640x200x2*/
cols[0] = pcjr->array[0 + 16] + 16;
cols[1] = pcjr->array[1 + 16] + 16;
for (x = 0; x < pcjr->crtc[1]; x++) {
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
pcjr->ma++;
for (c = 0; c < 16; c++) {
buffer->line[pcjr->displine][(x << 4) + c + 8] = cols[dat >> 15];
dat <<= 1;
}
}
break;
}
} else {
if (pcjr->array[3] & 4) {
if (pcjr->array[0] & 1) hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, (pcjr->array[2] & 0xf) + 16);
else hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, (pcjr->array[2] & 0xf) + 16);
} else {
cols[0] = pcjr->array[0 + 16] + 16;
if (pcjr->array[0] & 1) hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, cols[0]);
else hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, cols[0]);
}
}
if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16;
else x = (pcjr->crtc[1] << 4) + 16;
if (pcjr->composite) {
for (c = 0; c < x; c++)
buffer32->line[pcjr->displine][c] = buffer->line[pcjr->displine][c] & 0xf;
Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[pcjr->displine]);
}
pcjr->sc = oldsc;
if (pcjr->vc == pcjr->crtc[7] && !pcjr->sc) {
pcjr->stat |= 8;
}
pcjr->displine++;
if (pcjr->displine >= 360)
pcjr->displine = 0;
} else {
pcjr->vidtime += pcjr->dispontime;
if (pcjr->dispon)
pcjr->stat |= 1;
pcjr->linepos = 0;
if (pcjr->vsynctime) {
pcjr->vsynctime--;
if (!pcjr->vsynctime) {
pcjr->stat &= ~8;
}
}
if (pcjr->sc == (pcjr->crtc[11] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[11] & 31) >> 1))) {
pcjr->con = 0;
pcjr->coff = 1;
}
if (pcjr->vadj) {
pcjr->sc++;
pcjr->sc &= 31;
pcjr->ma = pcjr->maback;
pcjr->vadj--;
if (!pcjr->vadj) {
pcjr->dispon = 1;
pcjr->ma = pcjr->maback = (pcjr->crtc[13] | (pcjr->crtc[12] << 8)) & 0x3fff;
pcjr->sc = 0;
}
} else if (pcjr->sc == pcjr->crtc[9] || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == (pcjr->crtc[9] >> 1))) {
pcjr->maback = pcjr->ma;
pcjr->sc = 0;
oldvc = pcjr->vc;
pcjr->vc++;
pcjr->vc &= 127;
if (pcjr->vc == pcjr->crtc[6])
pcjr->dispon = 0;
if (oldvc == pcjr->crtc[4]) {
pcjr->vc = 0;
pcjr->vadj = pcjr->crtc[5];
if (!pcjr->vadj)
pcjr->dispon = 1;
if (!pcjr->vadj)
pcjr->ma = pcjr->maback = (pcjr->crtc[13] | (pcjr->crtc[12] << 8)) & 0x3fff;
if ((pcjr->crtc[10] & 0x60) == 0x20) pcjr->cursoron = 0;
else pcjr->cursoron = pcjr->blink & 16;
}
if (pcjr->vc == pcjr->crtc[7]) {
pcjr->dispon = 0;
pcjr->displine = 0;
pcjr->vsynctime = 16;
picint(1 << 5);
if (pcjr->crtc[7]) {
if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16;
else x = (pcjr->crtc[1] << 4) + 16;
pcjr->lastline++;
if ((x != xsize) || ((pcjr->lastline - pcjr->firstline) != ysize) || video_force_resize_get()) {
xsize = x;
ysize = pcjr->lastline - pcjr->firstline;
if (xsize < 64) xsize = 656;
if (ysize < 32) ysize = 200;
set_screen_size(xsize, (ysize << 1) + 16);
if (video_force_resize_get())
video_force_resize_set(0);
}
if (pcjr->composite)
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
else
video_blit_memtoscreen_8(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
frames++;
video_res_x = xsize - 16;
video_res_y = ysize;
}
pcjr->firstline = 1000;
pcjr->lastline = 0;
pcjr->blink++;
}
} else {
pcjr->sc++;
pcjr->sc &= 31;
pcjr->ma = pcjr->maback;
}
if ((pcjr->sc == (pcjr->crtc[10] & 31) || ((pcjr->crtc[8] & 3) == 3 && pcjr->sc == ((pcjr->crtc[10] & 31) >> 1))))
pcjr->con = 1;
}
}
static void
kbd_write(uint16_t port, uint8_t val, void *priv)
{
pcjr_t *pcjr = (pcjr_t *)priv;
switch (port) {
case 0x60:
pcjr->pa = val;
break;
case 0x61:
pcjr->pb = val;
timer_process();
timer_update_outstanding();
speaker_update();
speaker_gated = val & 1;
speaker_enable = val & 2;
if (speaker_enable)
was_speaker_enable = 1;
pit_set_gate(&pit, 2, val & 1);
sn76489_mute = speaker_mute = 1;
switch (val & 0x60) {
case 0x00:
speaker_mute = 0;
break;
case 0x60:
sn76489_mute = 0;
break;
}
break;
case 0xa0:
nmi_mask = val & 0x80;
pit_set_using_timer(&pit, 1, !(val & 0x20));
break;
}
}
static uint8_t
kbd_read(uint16_t port, void *priv)
{
pcjr_t *pcjr = (pcjr_t *)priv;
uint8_t ret = 0xff;
switch (port) {
case 0x60:
ret = pcjr->pa;
break;
case 0x61:
ret = pcjr->pb;
break;
case 0x62:
ret = (pcjr->latched ? 1 : 0);
ret |= 0x02; /*Modem card not installed*/
ret |= (ppispeakon ? 0x10 : 0);
ret |= (ppispeakon ? 0x20 : 0);
ret |= (pcjr->data ? 0x40: 0);
if (pcjr->data)
ret |= 0x40;
break;
case 0xa0:
pcjr->latched = 0;
ret = 0;
break;
default:
pclog("\nBad PCjr keyboard read %04X\n", port);
}
return(ret);
}
static void
kbd_poll(void *priv)
{
pcjr_t *pcjr = (pcjr_t *)priv;
int c, p = 0, key;
keyboard_delay += (220LL * TIMER_USEC);
if (key_queue_start != key_queue_end &&
!pcjr->serial_pos && !pcjr->latched) {
key = key_queue[key_queue_start];
key_queue_start = (key_queue_start + 1) & 0xf;
pcjr->latched = 1;
pcjr->serial_data[0] = 1; /*Start bit*/
pcjr->serial_data[1] = 0;
for (c = 0; c < 8; c++) {
if (key & (1 << c)) {
pcjr->serial_data[(c + 1) * 2] = 1;
pcjr->serial_data[(c + 1) * 2 + 1] = 0;
p++;
} else {
pcjr->serial_data[(c + 1) * 2] = 0;
pcjr->serial_data[(c + 1) * 2 + 1] = 1;
}
}
if (p & 1) { /*Parity*/
pcjr->serial_data[9 * 2] = 1;
pcjr->serial_data[9 * 2 + 1] = 0;
} else {
pcjr->serial_data[9 * 2] = 0;
pcjr->serial_data[9 * 2 + 1] = 1;
}
for (c = 0; c < 11; c++) { /*11 stop bits*/
pcjr->serial_data[(c + 10) * 2] = 0;
pcjr->serial_data[(c + 10) * 2 + 1] = 0;
}
pcjr->serial_pos++;
}
if (pcjr->serial_pos) {
pcjr->data = pcjr->serial_data[pcjr->serial_pos - 1];
nmi = pcjr->data;
pcjr->serial_pos++;
if (pcjr->serial_pos == 42+1)
pcjr->serial_pos = 0;
}
}
static void
kbd_adddata(uint8_t val)
{
key_queue[key_queue_end] = val;
key_queue_end = (key_queue_end + 1) & 0xf;
}
static void
speed_changed(void *priv)
{
pcjr_t *pcjr = (pcjr_t *)priv;
recalc_timings(pcjr);
}
static device_config_t pcjr_config[] = {
{
"display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB,
{
{
"RGB", PCJR_RGB
},
{
"Composite", PCJR_COMPOSITE
},
{
""
}
}
},
{
"", "", -1
}
};
static device_t pcjr_device = {
"IBM PCjr",
0, 0,
NULL, NULL, NULL,
NULL,
speed_changed,
NULL,
NULL,
pcjr_config
};
void
machine_pcjr_init(machine_t *model)
{
int display_type;
pcjr_t *pcjr;
pcjr = malloc(sizeof(pcjr_t));
memset(pcjr, 0x00, sizeof(pcjr_t));
pcjr->memctrl = -1;
display_type = machine_get_config_int("display_type");
pcjr->composite = (display_type != PCJR_RGB);
pic_init();
pit_init();
pit_set_out_func(&pit, 0, pit_irq0_timer_pcjr);
if (serial_enabled[0])
serial_setup(1, 0x2f8, 3);
/* Initialize the video controller. */
mem_mapping_add(&pcjr->mapping, 0xb8000, 0x08000,
vid_read, NULL, NULL,
vid_write, NULL, NULL, NULL, 0, pcjr);
io_sethandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, pcjr);
timer_add(vid_poll, &pcjr->vidtime, TIMER_ALWAYS_ENABLED, pcjr);
device_add_ex(&pcjr_device, pcjr);
/* Initialize the keyboard. */
key_queue_start = key_queue_end = 0;
io_sethandler(0x0060, 4,
kbd_read, NULL, NULL, kbd_write, NULL, NULL, pcjr);
io_sethandler(0x00a0, 8,
kbd_read, NULL, NULL, kbd_write, NULL, NULL, pcjr);
timer_add(kbd_poll, &keyboard_delay, TIMER_ALWAYS_ENABLED, pcjr);
keyboard_send = kbd_adddata;
fdc_add_pcjr();
device_add(&sn76489_device);
nmi_mask = 0x80;
}

View File

@@ -6,7 +6,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../dma.h"
@@ -19,7 +18,7 @@
#include "../game/gameport.h"
#include "../lpt.h"
#include "../serial.h"
#include "../keyboard_at.h"
#include "../keyboard.h"
#include "../disk/hdc.h"
#include "../disk/hdc_ide.h"
#include "../floppy/floppy.h"
@@ -347,7 +346,7 @@ machine_ps1_common_init(machine_t *model)
{
ide_init();
}
keyboard_at_init();
device_add(&keyboard_at_device);
nvr_at_init(8);
pic2_init();
if (romset != ROM_IBMPS1_2133)

View File

@@ -3,7 +3,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../dma.h"
@@ -14,7 +13,6 @@
#include "../device.h"
#include "../nvr.h"
#include "../keyboard.h"
#include "../keyboard_at.h"
#include "../lpt.h"
#include "../serial.h"
#include "../floppy/floppy.h"
@@ -161,7 +159,7 @@ machine_ps2_m30_286_init(machine_t *model)
pit_set_out_func(&pit, 1, pit_refresh_timer_at);
dma16_init();
keyboard_at_init();
device_add(&keyboard_at_device);
nvr_at_init(8);
pic2_init();
ps2board_init();

View File

@@ -3,7 +3,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../cpu/x86.h"
#include "../io.h"
@@ -16,7 +15,7 @@
#include "../device.h"
#include "../nvr.h"
#include "../nvr_ps2.h"
#include "../keyboard_at.h"
#include "../keyboard.h"
#include "../lpt.h"
#include "../mouse.h"
#include "../serial.h"
@@ -810,8 +809,7 @@ machine_ps2_common_init(machine_t *model)
dma16_init();
ps2_dma_init();
keyboard_at_init();
keyboard_at_init_ps2();
device_add(&keyboard_ps2_device);
mouse_ps2_init(NULL);
nvr_at_init(8);
pic2_init();

125
src/machine/m_tandy.c Normal file
View File

@@ -0,0 +1,125 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../nmi.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../game/gameport.h"
#include "../keyboard.h"
#include "../tandy_eeprom.h"
#include "../tandy_rom.h"
#include "../sound/sound.h"
#include "../sound/snd_pssj.h"
#include "../sound/snd_sn76489.h"
#include "machine.h"
static scancode scancode_tandy[272] = {
{ {-1}, {-1} }, { {0x01, -1}, {0x81, -1} }, { {0x02, -1}, {0x82, -1} }, { {0x03, -1}, {0x83, -1} },
{ {0x04, -1}, {0x84, -1} }, { {0x05, -1}, {0x85, -1} }, { {0x06, -1}, {0x86, -1} }, { {0x07, -1}, {0x87, -1} },
{ {0x08, -1}, {0x88, -1} }, { {0x09, -1}, {0x89, -1} }, { {0x0a, -1}, {0x8a, -1} }, { {0x0b, -1}, {0x8b, -1} },
{ {0x0c, -1}, {0x8c, -1} }, { {0x0d, -1}, {0x8d, -1} }, { {0x0e, -1}, {0x8e, -1} }, { {0x0f, -1}, {0x8f, -1} },
{ {0x10, -1}, {0x90, -1} }, { {0x11, -1}, {0x91, -1} }, { {0x12, -1}, {0x92, -1} }, { {0x13, -1}, {0x93, -1} },
{ {0x14, -1}, {0x94, -1} }, { {0x15, -1}, {0x95, -1} }, { {0x16, -1}, {0x96, -1} }, { {0x17, -1}, {0x97, -1} },
{ {0x18, -1}, {0x98, -1} }, { {0x19, -1}, {0x99, -1} }, { {0x1a, -1}, {0x9a, -1} }, { {0x1b, -1}, {0x9b, -1} },
{ {0x1c, -1}, {0x9c, -1} }, { {0x1d, -1}, {0x9d, -1} }, { {0x1e, -1}, {0x9e, -1} }, { {0x1f, -1}, {0x9f, -1} },
{ {0x20, -1}, {0xa0, -1} }, { {0x21, -1}, {0xa1, -1} }, { {0x22, -1}, {0xa2, -1} }, { {0x23, -1}, {0xa3, -1} },
{ {0x24, -1}, {0xa4, -1} }, { {0x25, -1}, {0xa5, -1} }, { {0x26, -1}, {0xa6, -1} }, { {0x27, -1}, {0xa7, -1} },
{ {0x28, -1}, {0xa8, -1} }, { {0x29, -1}, {0xa9, -1} }, { {0x2a, -1}, {0xaa, -1} }, { {0x47, -1}, {0xc7, -1} },
{ {0x2c, -1}, {0xac, -1} }, { {0x2d, -1}, {0xad, -1} }, { {0x2e, -1}, {0xae, -1} }, { {0x2f, -1}, {0xaf, -1} },
{ {0x30, -1}, {0xb0, -1} }, { {0x31, -1}, {0xb1, -1} }, { {0x32, -1}, {0xb2, -1} }, { {0x33, -1}, {0xb3, -1} },
{ {0x34, -1}, {0xb4, -1} }, { {0x35, -1}, {0xb5, -1} }, { {0x36, -1}, {0xb6, -1} }, { {0x37, -1}, {0xb7, -1} },
{ {0x38, -1}, {0xb8, -1} }, { {0x39, -1}, {0xb9, -1} }, { {0x3a, -1}, {0xba, -1} }, { {0x3b, -1}, {0xbb, -1} },
{ {0x3c, -1}, {0xbc, -1} }, { {0x3d, -1}, {0xbd, -1} }, { {0x3e, -1}, {0xbe, -1} }, { {0x3f, -1}, {0xbf, -1} },
{ {0x40, -1}, {0xc0, -1} }, { {0x41, -1}, {0xc1, -1} }, { {0x42, -1}, {0xc2, -1} }, { {0x43, -1}, {0xc3, -1} },
{ {0x44, -1}, {0xc4, -1} }, { {0x45, -1}, {0xc5, -1} }, { {0x46, -1}, {0xc6, -1} }, { {0x47, -1}, {0xc7, -1} },
{ {0x48, -1}, {0xc8, -1} }, { {0x49, -1}, {0xc9, -1} }, { {0x4a, -1}, {0xca, -1} }, { {0x4b, -1}, {0xcb, -1} },
{ {0x4c, -1}, {0xcc, -1} }, { {0x4d, -1}, {0xcd, -1} }, { {0x4e, -1}, {0xce, -1} }, { {0x4f, -1}, {0xcf, -1} },
{ {0x50, -1}, {0xd0, -1} }, { {0x51, -1}, {0xd1, -1} }, { {0x52, -1}, {0xd2, -1} }, { {0x56, -1}, {0xd6, -1} },
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*54*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*58*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*5c*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*60*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*64*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*68*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*6c*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*70*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*74*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*78*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*7c*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*80*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*84*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*88*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*8c*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*90*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*94*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*98*/
{ {0x57, -1}, {0xd7, -1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*9c*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*a0*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*a4*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {0xaa, -1}, {0x2a, -1} }, { {-1}, {-1} }, /*a8*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*ac*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*b0*/
{ {-1}, {-1} }, { {0x35, -1}, {0xb5, -1} }, { {0xb6, -1}, {0x36, -1} }, { {0x37, -1}, {0xb7, -1} }, /*b4*/
{ {0x38, -1}, {0xb8, -1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*b8*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*bc*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*c0*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {0x46, -1}, {0xc6, -1} }, { {0x47, -1}, {0xc7, -1} }, /*c4*/
{ {0x29, -1}, {0xa9, -1} }, { {0x49, -1}, {0xc9, -1} }, { {-1}, {-1} }, { {0x2b, -1}, {0xab, -1} }, /*c8*/
{ {-1}, {-1} }, { {0x4e, -1}, {0xce, -1} }, { {-1}, {-1} }, { {0x4f, -1}, {0xcf, -1} }, /*cc*/
{ {0x4a, -1}, {0xca, -1} }, { {0x51, -1}, {0xd1, -1} }, { {0x52, -1}, {0xd2, -1} }, { {0x53, -1}, {0xd3, -1} }, /*d0*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*d4*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*d8*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*dc*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*e0*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*e4*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*e8*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*ec*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*f0*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*f4*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*f8*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*fc*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*100*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*104*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*108*/
{ {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, { {-1}, {-1} }, /*10c*/
};
void
machine_tandy1k_init(machine_t *model)
{
machine_common_init(model);
device_add(&keyboard_tandy_device);
keyboard_set_table(scancode_tandy);
if (romset == ROM_TANDY)
device_add(&sn76489_device);
else
device_add(&ncr8496_device);
nmi_init();
if (romset != ROM_TANDY)
device_add(&tandy_eeprom_device);
if (joystick_type != 7)
device_add(&gameport_device);
}
void
machine_tandy1ksl2_init(machine_t *model)
{
machine_common_init(model);
device_add(&keyboard_tandy_device);
keyboard_set_table(scancode_tandy);
device_add(&pssj_device);
nmi_init();
device_add(&tandy_rom_device);
device_add(&tandy_eeprom_device);
if (joystick_type != 7) device_add(&gameport_device);
}

View File

@@ -3,13 +3,12 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../nmi.h"
#include "../pit.h"
#include "../mem.h"
#include "../device.h"
#include "../game/gameport.h"
#include "../keyboard_xt.h"
#include "../keyboard.h"
#include "machine.h"
@@ -20,7 +19,7 @@ machine_xt_init(machine_t *model)
pit_set_out_func(&pit, 1, pit_refresh_timer_xt);
keyboard_xt_init();
device_add(&keyboard_xt_device);
nmi_init();
if (joystick_type != 7)
device_add(&gameport_device);

View File

@@ -4,7 +4,6 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../io.h"
#include "../mem.h"

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine.c 1.0.23 2017/11/01
* Version: @(#)machine.c 1.0.25 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -23,23 +23,19 @@
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../cpu/cpu.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../video/video.h"
#include "../floppy/floppy.h"
#include "../floppy/fdc.h"
#include "../floppy/fdd.h"
#include "machine.h"
#include "../video/vid_pcjr.h"
#include "../video/vid_tandy.h"
#include "../video/vid_tandysl.h"
int machine;
int AMSTRAD, AT, PCI, TANDY;
int AT, PCI;
int romset;
@@ -49,23 +45,23 @@ machine_t machines[] =
{"[8088] Compaq Portable", ROM_PORTABLE, "portable", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 128, 640, 128, 0, machine_xt_init, NULL },
{"[8088] DTK XT clone", ROM_DTKXT, "dtk", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL },
{"[8088] IBM PC", ROM_IBMPC, "ibmpc", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 32, 0, machine_xt_init, NULL },
{"[8088] IBM PCjr", ROM_IBMPCJR, "ibmpcjr", {{"", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 128, 640, 128, 0, machine_pcjr_init, pcjr_get_device },
{"[8088] IBM PCjr", ROM_IBMPCJR, "ibmpcjr", {{"", cpus_pcjr}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO, 128, 640, 128, 0, machine_pcjr_init, NULL },
{"[8088] IBM XT", ROM_IBMXT, "ibmxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL },
{"[8088] Generic XT clone", ROM_GENXT, "genxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL },
{"[8088] Juko XT clone", ROM_JUKOPC, "jukopc", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL },
{"[8088] Phoenix XT clone", ROM_PXXT, "pxxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL },
{"[8088] Schneider EuroPC", ROM_EUROPC, "europc", {{"Siemens",cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_HAS_HDC, 512, 640, 128, 0, machine_europc_init, NULL },
{"[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 128, 640, 128, 0, machine_tandy1k_init, tandy1000_get_device },
{"[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 256, 640, 128, 0, machine_tandy1k_init, tandy1000hx_get_device },
{"[8088] Schneider EuroPC", ROM_EUROPC, "europc", {{"Siemens",cpus_europc}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_HDC | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 0, machine_europc_init, NULL },
{"[8088] Tandy 1000", ROM_TANDY, "tandy", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 128, 640, 128, 0, machine_tandy1k_init, NULL },
{"[8088] Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 256, 640, 128, 0, machine_tandy1k_init, NULL },
{"[8088] VTech Laser Turbo XT", ROM_LTXT, "ltxt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
{"[8088] VTech Laser XT3", ROM_LXT3, "lxt3", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 1152, 64, 0, machine_xt_laserxt_init, NULL },
{"[8086] Amstrad PC1512", ROM_PC1512, "pc1512", {{"", cpus_pc1512}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AMSTRAD, 512, 640, 128, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC1640", ROM_PC1640, "pc1640", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AMSTRAD, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC2086", ROM_PC2086, "pc2086", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AMSTRAD, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC3086", ROM_PC3086, "pc3086", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AMSTRAD, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Olivetti M24", ROM_OLIM24, "olivetti_m24", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_OLIM24, 128, 640, 128, 0, machine_olim24_init, NULL },
{"[8086] Sinclair PC200", ROM_PC200, "pc200", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AMSTRAD, 512, 640, 128, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC1512", ROM_PC1512, "pc1512", {{"", cpus_pc1512}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC1640", ROM_PC1640, "pc1640", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC2086", ROM_PC2086, "pc2086", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Amstrad PC3086", ROM_PC3086, "pc3086", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 640, 640, 0, 63, machine_amstrad_init, NULL },
{"[8086] Olivetti M24", ROM_OLIM24, "olivetti_m24", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 128, 640, 128, 0, machine_olim24_init, NULL },
{"[8086] Sinclair PC200", ROM_PC200, "pc200", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_VIDEO | MACHINE_MOUSE, 512, 640, 128, 63, machine_amstrad_init, NULL },
{"[8086] Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 512, 768, 128, 0, machine_tandy1ksl2_init, NULL },
{"[286 ISA] AMI 286 clone", ROM_AMI286, "ami286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_neat_init, NULL },
@@ -73,67 +69,67 @@ machine_t machines[] =
{"[286 ISA] Commodore PC 30 III", ROM_CMDPC30, "cmdpc30", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 640,16384, 128, 127, machine_at_cmdpc_init, NULL },
{"[286 ISA] Hyundai Super-286TR", ROM_SUPER286TR, "super286tr", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_scat_init, NULL },
{"[286 ISA] IBM AT", ROM_IBMAT, "ibmat", {{"", cpus_ibmat}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 256,15872, 128, 63, machine_at_top_remap_init, NULL },
{"[286 ISA] IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", {{"", cpus_ps1_m2011}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 512,16384, 512, 127, machine_ps1_m2011_init, NULL },
{"[286 ISA] IBM PS/2 model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", {{"", cpus_ps2_m30_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 1, 16, 1, 127, machine_ps2_m30_286_init, NULL },
{"[286 ISA] IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", {{"", cpus_ps1_m2011}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 512,16384, 512, 127, machine_ps1_m2011_init, NULL },
{"[286 ISA] IBM PS/2 model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", {{"", cpus_ps2_m30_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 1, 16, 1, 127, machine_ps2_m30_286_init, NULL },
{"[286 ISA] IBM XT Model 286", ROM_IBMXT286, "ibmxt286", {{"", cpus_ibmxt286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 256,15872, 128, 0, machine_at_top_remap_init, NULL },
{"[286 ISA] Samsung SPC-4200P", ROM_SPC4200P, "spc4200p", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_PS2, 512, 2048, 128, 127, machine_at_scat_init, NULL },
#ifdef WALTJE
{"[286 ISA] OpenAT 286", ROM_OPENAT, "open_at", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512, 4096, 128, 127, machine_at_init, NULL },
#endif
{"[286 MCA] IBM PS/2 model 50", ROM_IBMPS2_M50, "ibmps2_m50", {{"", cpus_ps2_m30_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 1, 16, 1, 63, machine_ps2_model_50_init, NULL },
{"[286 MCA] IBM PS/2 model 50", ROM_IBMPS2_M50, "ibmps2_m50", {{"", cpus_ps2_m30_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 1, 16, 1, 63, machine_ps2_model_50_init, NULL },
{"[386SX ISA] AMI 386SX clone", ROM_AMI386SX, "ami386", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 512,16384, 128, 127, machine_at_headland_init, NULL },
{"[386SX ISA] Amstrad MegaPC", ROM_MEGAPC, "megapc", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 1, 16, 1, 127, machine_at_wd76c10_init, NULL },
{"[386SX ISA] Award 386SX clone", ROM_AWARD386SX_OPTI495, "award386sx", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386SX ISA] DTK 386SX clone", ROM_DTK386, "dtk386", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 512,16384, 128, 127, machine_at_neat_init, NULL },
{"[386SX ISA] IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 1, 16, 1, 127, machine_ps1_m2121_init, NULL },
{"[386SX ISA] IBM PS/1 m.2121+ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 1, 16, 1, 127, machine_ps1_m2121_init, NULL },
{"[386SX ISA] AMI 386SX clone", ROM_AMI386SX, "ami386", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512,16384, 128, 127, machine_at_headland_init, NULL },
{"[386SX ISA] Amstrad MegaPC", ROM_MEGAPC, "megapc", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 16, 1, 127, machine_at_wd76c10_init, NULL },
{"[386SX ISA] Award 386SX clone", ROM_AWARD386SX_OPTI495, "award386sx", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386SX ISA] DTK 386SX clone", ROM_DTK386, "dtk386", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 512,16384, 128, 127, machine_at_neat_init, NULL },
{"[386SX ISA] IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 16, 1, 127, machine_ps1_m2121_init, NULL },
{"[386SX ISA] IBM PS/1 m.2121+ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 16, 1, 127, machine_ps1_m2121_init, NULL },
{"[386SX MCA] IBM PS/2 model 55SX", ROM_IBMPS2_M55SX, "ibmps2_m55sx", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL },
{"[386SX MCA] IBM PS/2 model 55SX", ROM_IBMPS2_M55SX, "ibmps2_m55sx", {{"Intel", cpus_i386SX}, {"AMD", cpus_Am386SX}, {"Cyrix", cpus_486SLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 1, 8, 1, 63, machine_ps2_model_55sx_init, NULL },
{"[386DX ISA] AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX ISA] Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 1, 16, 1, 127, machine_at_wd76c10_init, NULL },
{"[386DX ISA] Award 386DX clone", ROM_AWARD386DX_OPTI495, "award386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX ISA] MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX ISA] AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX ISA] Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 16, 1, 127, machine_at_wd76c10_init, NULL },
{"[386DX ISA] Award 386DX clone", ROM_AWARD386DX_OPTI495, "award386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX ISA] MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[386DX MCA] IBM PS/2 model 80", ROM_IBMPS2_M80, "ibmps2_m80", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 1, 12, 1, 63, machine_ps2_model_80_init, NULL },
{"[386DX MCA] IBM PS/2 model 80", ROM_IBMPS2_M80, "ibmps2_m80", {{"Intel", cpus_i386DX}, {"AMD", cpus_Am386DX}, {"Cyrix", cpus_486DLC}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 1, 12, 1, 63, machine_ps2_model_80_init, NULL },
{"[486 ISA] AMI 486 clone", ROM_AMI486, "ami486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_ali1429_init, NULL },
{"[486 ISA] AMI WinBIOS 486", ROM_WIN486, "win486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_ali1429_init, NULL },
{"[486 ISA] Award 486 clone", ROM_AWARD486_OPTI495, "award486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[486 ISA] DTK PKM-0038S E-2", ROM_DTK486, "dtk486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 1, 128, 1, 127, machine_at_dtk486_init, NULL },
{"[486 ISA] IBM PS/1 machine 2133", ROM_IBMPS1_2133, "ibmps1_2133", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 1, 64, 1, 127, machine_ps1_m2133_init, NULL },
{"[486 ISA] AMI 486 clone", ROM_AMI486, "ami486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_ali1429_init, NULL },
{"[486 ISA] AMI WinBIOS 486", ROM_WIN486, "win486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_ali1429_init, NULL },
{"[486 ISA] Award 486 clone", ROM_AWARD486_OPTI495, "award486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 64, 1, 127, machine_at_opti495_init, NULL },
{"[486 ISA] DTK PKM-0038S E-2", ROM_DTK486, "dtk486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 128, 1, 127, machine_at_dtk486_init, NULL },
{"[486 ISA] IBM PS/1 machine 2133", ROM_IBMPS1_2133, "ibmps1_2133", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 1, 64, 1, 127, machine_ps1_m2133_init, NULL },
{"[486 MCA] IBM PS/2 model 80-486", ROM_IBMPS2_M80_486, "ibmps2_m80-486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_PS2_HDD, 1, 32, 1, 63, machine_ps2_model_80_486_init, NULL },
{"[486 MCA] IBM PS/2 model 80-486", ROM_IBMPS2_M80_486, "ibmps2_m80-486", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 1, MACHINE_MCA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC_PS2, 1, 32, 1, 63, machine_ps2_model_80_486_init, NULL },
{"[486 PCI] Rise Computer R418", ROM_R418, "r418", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 1, 255, 1, 127, machine_at_r418_init, NULL },
{"[486 PCI] Rise Computer R418", ROM_R418, "r418", {{"Intel", cpus_i486}, {"AMD", cpus_Am486}, {"Cyrix", cpus_Cx486}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 1, 255, 1, 127, machine_at_r418_init, NULL },
{"[Socket 4 LX] Intel Premiere/PCI", ROM_REVENGE, "revenge", {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 2, 128, 2, 127, machine_at_batman_init, NULL },
{"[Socket 4 LX] Intel Premiere/PCI", ROM_REVENGE, "revenge", {{"Intel", cpus_Pentium5V}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_batman_init, NULL },
{"[Socket 5 NX] Intel Premiere/PCI II", ROM_PLATO, "plato", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 2, 128, 2, 127, machine_at_plato_init, NULL },
{"[Socket 5 NX] Intel Premiere/PCI II", ROM_PLATO, "plato", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 2, 128, 2, 127, machine_at_plato_init, NULL },
{"[Socket 5 FX] ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_p54tp4xe_init, NULL },
{"[Socket 5 FX] Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_endeavor_init, NULL },
{"[Socket 5 FX] Intel Advanced/ZP", ROM_ZAPPA, "zappa", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_zappa_init, NULL },
{"[Socket 5 FX] PC Partner MB500N", ROM_MB500N, "mb500n", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_mb500n_init, NULL },
{"[Socket 5 FX] President Award 430FX PCI",ROM_PRESIDENT, "president", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_president_init, NULL },
{"[Socket 5 FX] ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 8, 128, 8, 127, machine_at_p54tp4xe_init, NULL },
{"[Socket 5 FX] Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_endeavor_init, NULL },
{"[Socket 5 FX] Intel Advanced/ZP", ROM_ZAPPA, "zappa", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_zappa_init, NULL },
{"[Socket 5 FX] PC Partner MB500N", ROM_MB500N, "mb500n", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 8, 128, 8, 127, machine_at_mb500n_init, NULL },
{"[Socket 5 FX] President Award 430FX PCI",ROM_PRESIDENT, "president", {{ "Intel", cpus_PentiumS5}, {"IDT", cpus_WinChip}, {"AMD", cpus_K5}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_HDC, 8, 128, 8, 127, machine_at_president_init, NULL },
{"[Socket 7 FX] Intel Advanced/ATX", ROM_THOR, "thor", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{"[Socket 7 FX] MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{"[Socket 7 FX] Intel Advanced/ATX", ROM_THOR, "thor", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{"[Socket 7 FX] MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_thor_init, NULL },
{"[Socket 7 HX] Acer M3a", ROM_ACERM3A, "acerm3a", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 192, 8, 127, machine_at_acerm3a_init, NULL },
{"[Socket 7 HX] Acer V35n", ROM_ACERV35N, "acerv35n", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 192, 8, 127, machine_at_acerv35n_init, NULL },
{"[Socket 7 HX] AOpen AP53", ROM_AP53, "ap53", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 512, 8, 127, machine_at_ap53_init, NULL },
{"[Socket 7 HX] ASUS P/I-P55T2P4", ROM_P55T2P4, "p55t2p4", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 512, 8, 127, machine_at_p55t2p4_init, NULL },
{"[Socket 7 HX] SuperMicro Super P55T2S",ROM_P55T2S, "p55t2s", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 768, 8, 127, machine_at_p55t2s_init, NULL },
{"[Socket 7 HX] Acer M3a", ROM_ACERM3A, "acerm3a", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_acerm3a_init, NULL },
{"[Socket 7 HX] Acer V35n", ROM_ACERV35N, "acerv35n", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 192, 8, 127, machine_at_acerv35n_init, NULL },
{"[Socket 7 HX] AOpen AP53", ROM_AP53, "ap53", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_ap53_init, NULL },
{"[Socket 7 HX] ASUS P/I-P55T2P4", ROM_P55T2P4, "p55t2p4", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 512, 8, 127, machine_at_p55t2p4_init, NULL },
{"[Socket 7 HX] SuperMicro Super P55T2S",ROM_P55T2S, "p55t2s", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 768, 8, 127, machine_at_p55t2s_init, NULL },
{"[Socket 7 VX] ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_p55tvp4_init, NULL },
{"[Socket 7 VX] Award 430VX PCI", ROM_430VX, "430vx", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL },
{"[Socket 7 VX] Epox P55-VA", ROM_P55VA, "p55va", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL },
{"[Socket 7 VX] ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55tvp4_init, NULL },
{"[Socket 7 VX] Award 430VX PCI", ROM_430VX, "430vx", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_i430vx_init, NULL },
{"[Socket 7 VX] Epox P55-VA", ROM_P55VA, "p55va", {{"Intel", cpus_Pentium}, {"IDT", cpus_WinChip}, {"AMD", cpus_K56}, {"Cyrix", cpus_6x86},{"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_VLB | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 128, 8, 127, machine_at_p55va_init, NULL },
{"[Socket 8 FX] Tyan Titan-Pro AT", ROM_440FX, "440fx", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 1024, 8, 127, machine_at_i440fx_init, NULL },
{"[Socket 8 FX] Tyan Titan-Pro ATX", ROM_S1668, "tpatx", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HAS_HDC, 8, 1024, 8, 127, machine_at_s1668_init, NULL },
{"[Socket 8 FX] Tyan Titan-Pro AT", ROM_440FX, "440fx", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 127, machine_at_i440fx_init, NULL },
{"[Socket 8 FX] Tyan Titan-Pro ATX", ROM_S1668, "tpatx", {{"Intel", cpus_PentiumPro}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_PCI | MACHINE_ISA | MACHINE_AT | MACHINE_PS2 | MACHINE_HDC, 8, 1024, 8, 127, machine_at_s1668_init, NULL },
{"", -1, "", {{"", 0}, {"", 0}, {"", 0}}, 0,0,0,0, 0 }
};
@@ -146,16 +142,16 @@ machine_init(void)
/* Set up the architecture flags. */
AT = IS_ARCH(machine, MACHINE_AT);
PCI = IS_ARCH(machine, MACHINE_PCI);
AMSTRAD = IS_ARCH(machine, MACHINE_AMSTRAD);
TANDY = 0;
/* Load the machine's ROM BIOS. */
rom_load_bios(romset);
mem_add_bios();
if (machines[machine].get_device)
device_add(machines[machine].get_device());
/* Add video card unless its their internal one. */
if (! machines[machine].fixed_gfxcard)
video_reset_card(gfxcard);
/* All good, boot the machine! */
machines[machine].init(&machines[machine]);
}

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine.h 1.0.8 2017/11/01
* Version: @(#)machine.h 1.0.9 2017/11/04
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -26,20 +26,17 @@
#define MACHINE_PC 0x000000 /* PC architecture */
#define MACHINE_AT 0x000001 /* PC/AT architecture */
#define MACHINE_PS2 0x000002 /* PS/2 architecture */
#define MACHINE_ISA 0x000010 /* machine has ISA bus */
#define MACHINE_CBUS 0x000020 /* machine has C-BUS bus */
#define MACHINE_EISA 0x000040 /* machine has EISA bus */
#define MACHINE_VLB 0x000080 /* machine has VL bus */
#define MACHINE_MCA 0x000100 /* machine has MCA bus */
#define MACHINE_PCI 0x000200 /* machine has PCI */
#define MACHINE_AGP 0x000400 /* machine has AGP */
#define MACHINE_HAS_HDC 0x001000 /* machine has internal HDC */
#define MACHINE_PS2_HDD 0x002000 // can now remove? --FvK
#define MACHINE_NEC 0x010000
#define MACHINE_FUJITSU 0x020000
#define MACHINE_AMSTRAD 0x040000
#define MACHINE_OLIM24 0x080000
#define MACHINE_RM 0x100000
#define MACHINE_ISA 0x000010 /* sys has ISA bus */
#define MACHINE_CBUS 0x000020 /* sys has C-BUS bus */
#define MACHINE_EISA 0x000040 /* sys has EISA bus */
#define MACHINE_VLB 0x000080 /* sys has VL bus */
#define MACHINE_MCA 0x000100 /* sys has MCA bus */
#define MACHINE_PCI 0x000200 /* sys has PCI bus */
#define MACHINE_AGP 0x000400 /* sys has AGP bus */
#define MACHINE_HDC 0x001000 /* sys has int HDC */
#define MACHINE_HDC_PS2 0x002000 /* sys has int PS/2 HDC */
#define MACHINE_MOUSE 0x004000 /* sys has int mouse */
#define MACHINE_VIDEO 0x008000 /* sys has int video */
#define IS_ARCH(m, a) (machines[(m)].flags & (a)) ? 1 : 0;
@@ -74,7 +71,7 @@ typedef struct _machine_ {
extern machine_t machines[];
extern int machine;
extern int romset;
extern int AMSTRAD, TANDY, AT, PCI;
extern int AT, PCI;
/* Core functions. */
@@ -93,13 +90,6 @@ extern char *machine_get_internal_name_ex(int m);
extern int machine_get_nvrmask(int m);
/* Global variables for boards and systems. */
#ifdef EMU_MOUSE_H
extern mouse_t mouse_amstrad;
extern mouse_t mouse_olim24;
#endif
/* Initialization functions for boards and systems. */
extern void machine_common_init(machine_t *);

View File

@@ -1,178 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../nmi.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../nvr.h"
#include "../game/gameport.h"
#include "../keyboard.h"
#include "../keyboard_amstrad.h"
#include "../mouse.h"
#include "../lpt.h"
#include "../floppy/floppy.h"
#include "../floppy/fdd.h"
#include "../floppy/fdc.h"
#include "machine.h"
typedef struct {
int oldb;
} mouse_amstrad_t;
static uint8_t amstrad_dead;
static uint8_t mousex, mousey;
static uint8_t
amstrad_read(uint16_t port, void *priv)
{
pclog("amstrad_read: %04X\n", port);
switch (port) {
case 0x379:
return(7);
case 0x37a:
if (romset == ROM_PC1512) return(0x20);
if (romset == ROM_PC200) return(0x80);
return(0);
case 0xdead:
return(amstrad_dead);
}
return(0xff);
}
static void
amstrad_write(uint16_t port, uint8_t val, void *priv)
{
switch (port) {
case 0xdead:
amstrad_dead = val;
break;
}
}
static void
amstrad_mouse_write(uint16_t addr, uint8_t val, void *priv)
{
if (addr == 0x78)
mousex = 0;
else
mousey = 0;
}
static uint8_t
amstrad_mouse_read(uint16_t addr, void *priv)
{
if (addr == 0x78)
return(mousex);
return(mousey);
}
static uint8_t
amstrad_mouse_poll(int x, int y, int z, int b, void *priv)
{
mouse_amstrad_t *ms = (mouse_amstrad_t *)priv;
mousex += x;
mousey -= y;
if ((b & 1) && !(ms->oldb & 1))
keyboard_send(0x7e);
if ((b & 2) && !(ms->oldb & 2))
keyboard_send(0x7d);
if (!(b & 1) && (ms->oldb & 1))
keyboard_send(0xfe);
if (!(b & 2) && (ms->oldb & 2))
keyboard_send(0xfd);
ms->oldb = b;
return(0);
}
static void *
amstrad_mouse_init(mouse_t *info)
{
mouse_amstrad_t *ms = (mouse_amstrad_t *)malloc(sizeof(mouse_amstrad_t));
memset(ms, 0x00, sizeof(mouse_amstrad_t));
return(ms);
}
static void
amstrad_mouse_close(void *priv)
{
mouse_amstrad_t *ms = (mouse_amstrad_t *)priv;
free(ms);
}
mouse_t mouse_amstrad = {
"Amstrad mouse",
"amstrad",
MOUSE_TYPE_AMSTRAD,
amstrad_mouse_init,
amstrad_mouse_close,
amstrad_mouse_poll
};
static void
amstrad_init(void)
{
lpt2_remove_ams();
io_sethandler(0x0078, 1,
amstrad_mouse_read, NULL, NULL,
amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x007a, 1,
amstrad_mouse_read, NULL, NULL,
amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x0379, 2,
amstrad_read, NULL, NULL,
NULL, NULL, NULL, NULL);
io_sethandler(0xdead, 1,
amstrad_read, NULL, NULL,
amstrad_write, NULL, NULL, NULL);
}
void
machine_amstrad_init(machine_t *model)
{
machine_common_init(model);
amstrad_init();
keyboard_amstrad_init();
/* FIXME: make sure this is correct? */
nvr_at_init(1);
nmi_init();
fdc_set_dskchg_activelow();
if (joystick_type != 7)
device_add(&gameport_device);
}

View File

@@ -1,52 +0,0 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../io.h"
#include "../nmi.h"
#include "../mem.h"
#include "../device.h"
#include "../nvr.h"
#include "../game/gameport.h"
#include "../keyboard_olim24.h"
#include "machine.h"
static uint8_t olivetti_m24_read(uint16_t port, void *priv)
{
switch (port)
{
case 0x66:
return 0x00;
case 0x67:
return 0x20 | 0x40 | 0x0C;
}
return 0xff;
}
static void olivetti_m24_init(void)
{
io_sethandler(0x0066, 0x0002, olivetti_m24_read, NULL, NULL, NULL, NULL, NULL, NULL);
}
void
machine_olim24_init(machine_t *model)
{
machine_common_init(model);
keyboard_olim24_init();
/* FIXME: make sure this is correct?? */
nvr_at_init(8);
olivetti_m24_init();
nmi_init();
if (joystick_type != 7) device_add(&gameport_device);
}

View File

@@ -1,33 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../nmi.h"
#include "../pic.h"
#include "../pit.h"
#include "../mem.h"
#include "../device.h"
#include "../serial.h"
#include "../keyboard_pcjr.h"
#include "../floppy/floppy.h"
#include "../floppy/fdc.h"
#include "../floppy/fdd.h"
#include "../sound/snd_sn76489.h"
#include "machine.h"
void
machine_pcjr_init(machine_t *model)
{
fdc_add_pcjr();
pic_init();
pit_init();
pit_set_out_func(&pit, 0, pit_irq0_timer_pcjr);
if (serial_enabled[0])
serial_setup(1, 0x2f8, 3);
keyboard_pcjr_init();
device_add(&sn76489_device);
nmi_mask = 0x80;
}

View File

@@ -1,51 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include "../86box.h"
#include "../ibm.h"
#include "../nmi.h"
#include "../mem.h"
#include "../rom.h"
#include "../device.h"
#include "../game/gameport.h"
#include "../keyboard_xt.h"
#include "../tandy_eeprom.h"
#include "../tandy_rom.h"
#include "../sound/snd_pssj.h"
#include "../sound/snd_sn76489.h"
#include "machine.h"
void
machine_tandy1k_init(machine_t *model)
{
TANDY = 1;
machine_common_init(model);
keyboard_tandy_init();
if (romset == ROM_TANDY)
device_add(&sn76489_device);
else
device_add(&ncr8496_device);
nmi_init();
if (romset != ROM_TANDY)
device_add(&tandy_eeprom_device);
if (joystick_type != 7)
device_add(&gameport_device);
}
void
machine_tandy1ksl2_init(machine_t *model)
{
machine_common_init(model);
keyboard_tandy_init();
device_add(&pssj_device);
nmi_init();
device_add(&tandy_rom_device);
device_add(&tandy_eeprom_device);
if (joystick_type != 7) device_add(&gameport_device);
}