Re-integration of the Tandy-1000 based machines.

This commit is contained in:
waltje
2017-11-10 23:47:04 -05:00
parent dfcc0c0a81
commit 006639fe5a
9 changed files with 1600 additions and 418 deletions

View File

@@ -8,7 +8,7 @@
*
* Implementation of the XT-style keyboard.
*
* Version: @(#)keyboard_xt.c 1.0.3 2017/11/06
* Version: @(#)keyboard_xt.c 1.0.4 2017/11/10
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -33,7 +33,6 @@
#include "rom.h"
#include "timer.h"
#include "device.h"
#include "tandy_eeprom.h"
#include "sound/sound.h"
#include "sound/snd_speaker.h"
#include "video/video.h"
@@ -217,10 +216,10 @@ kbd_poll(void *priv)
kbd->pa = key_queue[key_queue_start];
picint(2);
#if ENABLE_KEYBOARD_LOG
pclog("Reading %02X from the key queue at %i\n",
pclog("XTkbd: reading %02X from the key queue at %i\n",
kbd->pa, key_queue_start);
#endif
key_queue_start = (key_queue_start + 1) & 0xf;
key_queue_start = (key_queue_start + 1) & 0x0f;
kbd->blocked = 1;
}
}
@@ -234,7 +233,7 @@ kbd_adddata(uint8_t val)
pclog("XTkbd: %02X added to key queue at %i\n",
val, key_queue_end);
#endif
key_queue_end = (key_queue_end + 1) & 0xf;
key_queue_end = (key_queue_end + 1) & 0x0f;
}
@@ -283,11 +282,11 @@ kbd_read(uint16_t port, void *priv)
case 0x60:
if ((romset == ROM_IBMPC) && (kbd->pb & 0x80)) {
if (VGA || gfxcard == GFX_EGA)
ret = 0x4D;
ret = 0x4d;
else if (MDA)
ret = 0x7D;
ret = 0x7d;
else
ret = 0x6D;
ret = 0x6d;
} else
ret = kbd->pa;
break;
@@ -299,7 +298,7 @@ kbd_read(uint16_t port, void *priv)
case 0x62:
if (romset == ROM_IBMPC) {
if (kbd->pb & 0x04)
ret = ((mem_size-64) / 32) & 0xf;
ret = ((mem_size-64) / 32) & 0x0f;
else
ret = ((mem_size-64) / 32) >> 4;
} else {
@@ -311,16 +310,16 @@ kbd_read(uint16_t port, void *priv)
else
ret = 6;
} else
ret = 0x0D;
ret = 0x0d;
}
ret |= (ppispeakon ? 0x20 : 0);
if (kbd->tandy)
ret |= (tandy_eeprom_read() ? 0x10 : 0);
ret |= (tandy1k_eeprom_read() ? 0x10 : 0);
break;
default:
pclog("\nXTkbd: bad read %04X\n", port);
pclog("XTkbd: bad read %04X\n", port);
ret = 0xff;
}

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine.h 1.0.10 2017/11/08
* Version: @(#)machine.h 1.0.11 2017/11/10
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -133,11 +133,13 @@ extern void machine_at_r418_init(machine_t *);
extern void machine_at_wd76c10_init(machine_t *);
extern void machine_pcjr_init(machine_t *);
extern void machine_ps1_m2011_init(machine_t *);
extern void machine_ps1_m2121_init(machine_t *);
extern void machine_ps1_m2133_init(machine_t *);
extern void machine_ps2_m30_286_init(machine_t *);
extern void machine_ps2_m30_286_init(machine_t *);
extern void machine_ps2_model_50_init(machine_t *);
extern void machine_ps2_model_55sx_init(machine_t *);
extern void machine_ps2_model_80_init(machine_t *);
@@ -149,10 +151,8 @@ extern void machine_europc_init(machine_t *);
extern void machine_olim24_init(machine_t *);
extern void machine_pcjr_init(machine_t *);
extern void machine_tandy1k_init(machine_t *);
extern void machine_tandy1ksl2_init(machine_t *);
extern int tandy1k_eeprom_read(void);
extern void machine_xt_init(machine_t *);
extern void machine_xt_laserxt_init(machine_t *);

View File

@@ -8,7 +8,7 @@
*
* Handling of the emulated machines.
*
* Version: @(#)machine_table.c 1.0.1 2017/11/08
* Version: @(#)machine_table.c 1.0.2 2017/11/10
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -42,7 +42,7 @@ machine_t machines[] = {
{ "[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_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] Tandy 1000HX", 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 },
@@ -52,7 +52,7 @@ machine_t machines[] = {
{ "[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] Amstrad PC20(0)", 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] 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] Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 512, 768, 128, 0, machine_tandy1ksl2_init, NULL },
{ "[8086] Tandy 1000SL/2", ROM_TANDY1000SL2, "tandy1000sl2", {{"", cpus_8086}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 1, MACHINE_ISA, 512, 768, 128, 0, machine_tandy1k_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 },
{ "[286 ISA] Award 286 clone", ROM_AWARD286, "award286", {{"", cpus_286}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_AT, 512,16384, 128, 127, machine_at_scat_init, NULL },

View File

@@ -1,188 +0,0 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "machine/machine.h"
#include "device.h"
#include "mem.h"
#include "rom.h"
#include "io.h"
#include "nvr.h"
#include "tandy_eeprom.h"
typedef struct
{
int state;
int count;
int addr;
int clock;
uint16_t data;
uint16_t store[64];
int romset;
} tandy_eeprom_t;
enum
{
EEPROM_IDLE,
EEPROM_GET_OPERATION,
EEPROM_READ,
EEPROM_WRITE
};
static int eeprom_data_out;
void tandy_eeprom_write(uint16_t addr, uint8_t val, void *p)
{
tandy_eeprom_t *eeprom = (tandy_eeprom_t *)p;
if ((val & 4) && !eeprom->clock)
{
switch (eeprom->state)
{
case EEPROM_IDLE:
switch (eeprom->count)
{
case 0:
if (!(val & 3))
eeprom->count = 1;
else
eeprom->count = 0;
break;
case 1:
if ((val & 3) == 2)
eeprom->count = 2;
else
eeprom->count = 0;
break;
case 2:
if ((val & 3) == 3)
eeprom->state = EEPROM_GET_OPERATION;
eeprom->count = 0;
break;
}
break;
case EEPROM_GET_OPERATION:
eeprom->data = (eeprom->data << 1) | (val & 1);
eeprom->count++;
if (eeprom->count == 8)
{
eeprom->count = 0;
eeprom->addr = eeprom->data & 0x3f;
switch (eeprom->data & 0xc0)
{
case 0x40:
eeprom->state = EEPROM_WRITE;
break;
case 0x80:
eeprom->state = EEPROM_READ;
eeprom->data = eeprom->store[eeprom->addr];
break;
default:
eeprom->state = EEPROM_IDLE;
break;
}
}
break;
case EEPROM_READ:
eeprom_data_out = eeprom->data & 0x8000;
eeprom->data <<= 1;
eeprom->count++;
if (eeprom->count == 16)
{
eeprom->count = 0;
eeprom->state = EEPROM_IDLE;
}
break;
case EEPROM_WRITE:
eeprom->data = (eeprom->data << 1) | (val & 1);
eeprom->count++;
if (eeprom->count == 16)
{
eeprom->count = 0;
eeprom->state = EEPROM_IDLE;
eeprom->store[eeprom->addr] = eeprom->data;
}
break;
}
}
eeprom->clock = val & 4;
}
int tandy_eeprom_read(void)
{
return eeprom_data_out;
}
static void *tandy_eeprom_init(device_t *info)
{
tandy_eeprom_t *eeprom = malloc(sizeof(tandy_eeprom_t));
FILE *f = NULL;
memset(eeprom, 0, sizeof(tandy_eeprom_t));
eeprom->romset = romset;
switch (romset)
{
case ROM_TANDY1000HX:
f = nvr_fopen(L"tandy1000hx.bin", L"rb");
break;
case ROM_TANDY1000SL2:
f = nvr_fopen(L"tandy1000sl2.bin", L"rb");
break;
}
if (f)
{
fread(eeprom->store, 128, 1, f);
fclose(f);
}
else
memset(eeprom->store, 0, 128);
io_sethandler(0x037c, 0x0001, NULL, NULL, NULL, tandy_eeprom_write, NULL, NULL, eeprom);
return eeprom;
}
void tandy_eeprom_close(void *p)
{
tandy_eeprom_t *eeprom = (tandy_eeprom_t *)p;
FILE *f = NULL;
switch (eeprom->romset)
{
case ROM_TANDY1000HX:
f = nvr_fopen(L"tandy1000hx.bin", L"wb");
break;
case ROM_TANDY1000SL2:
f = nvr_fopen(L"tandy1000sl2.bin", L"wb");
break;
}
fwrite(eeprom->store, 128, 1, f);
fclose(f);
free(eeprom);
}
device_t tandy_eeprom_device =
{
"Tandy EEPROM",
0, 0,
tandy_eeprom_init,
tandy_eeprom_close,
NULL, NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -1,7 +0,0 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
device_t tandy_eeprom_device;
extern int tandy_eeprom_read(void);

View File

@@ -1,103 +0,0 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#include "device.h"
#include "io.h"
#include "mem.h"
#include "rom.h"
#include "tandy_rom.h"
static uint8_t *tandy_rom;
static uint8_t tandy_rom_bank;
static int tandy_rom_offset;
static mem_mapping_t tandy_rom_mapping;
uint8_t tandy_read_rom(uint32_t addr, void *p)
{
uint32_t addr2 = (addr & 0xffff) + tandy_rom_offset;
return tandy_rom[addr2];
}
uint16_t tandy_read_romw(uint32_t addr, void *p)
{
uint32_t addr2 = (addr & 0xffff) + tandy_rom_offset;
return *(uint16_t *)&tandy_rom[addr2];
}
uint32_t tandy_read_roml(uint32_t addr, void *p)
{
return *(uint32_t *)&tandy_rom[addr];
}
uint8_t tandy_rom_bank_read(uint16_t port, void *p)
{
if (port == 0xffea)
return tandy_rom_bank ^ 0x10;
else
return 0xff;
}
void tandy_rom_bank_write(uint16_t port, uint8_t val, void *p)
{
if (port == 0xffea)
{
tandy_rom_bank = val;
tandy_rom_offset = ((val ^ 4) & 7) * 0x10000;
mem_mapping_set_exec(&tandy_rom_mapping, &tandy_rom[tandy_rom_offset]);
}
}
void *tandy_rom_init(device_t *info)
{
FILE *f, *ff;
int c;
tandy_rom = malloc(0x80000);
f = rom_fopen(L"roms/machines/tandy1000sl2/8079047.hu1", L"rb");
ff = rom_fopen(L"roms/machines/tandy1000sl2/8079048.hu2", L"rb");
for (c = 0x0000; c < 0x80000; c += 2)
{
tandy_rom[c] = getc(f);
tandy_rom[c + 1] = getc(ff);
}
fclose(ff);
fclose(f);
mem_mapping_add(&tandy_rom_mapping, 0xe0000, 0x10000,
tandy_read_rom, tandy_read_romw, tandy_read_roml,
NULL, NULL, NULL,
tandy_rom, MEM_MAPPING_EXTERNAL, NULL);
io_sethandler(0xffe8, 0x0008, tandy_rom_bank_read, NULL, NULL, tandy_rom_bank_write, NULL, NULL, NULL);
return tandy_rom;
}
void tandy_rom_close(void *p)
{
free(p);
}
device_t tandy_rom_device =
{
"Tandy 1000SL/2 ROM",
0, 0,
tandy_rom_init, tandy_rom_close, NULL,
NULL, NULL, NULL, NULL,
NULL
};

View File

@@ -1,4 +0,0 @@
/* Copyright holders: Sarah Walker
see COPYING for more details
*/
extern device_t tandy_rom_device;

View File

@@ -8,7 +8,7 @@
#
# Makefile for Win32 (MinGW32) environment.
#
# Version: @(#)Makefile.mingw 1.0.73 2017/11/08
# Version: @(#)Makefile.mingw 1.0.74 2017/11/10
#
# Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com>
@@ -294,7 +294,6 @@ MCHOBJ := machine.o machine_table.o \
m_ps2_isa.o m_ps2_mca.o
DEVOBJ := bugger.o lpt.o $(SERIAL) \
tandy_eeprom.o tandy_rom.o \
sio_detect.o \
sio_fdc37c66x.o sio_fdc37c669.o \
sio_fdc37c93x.o \