mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 02:18:20 -07:00
Applied a whole slew of patches, getting RAM usage down by a further 10 MB.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Main include file for the application.
|
||||
*
|
||||
* Version: @(#)86box.h 1.0.19 2018/03/17
|
||||
* Version: @(#)86box.h 1.0.20 2018/03/18
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -90,11 +90,11 @@ extern int vid_cga_contrast, /* (C) video */
|
||||
video_fullscreen_scale, /* (C) video */
|
||||
enable_overscan, /* (C) video */
|
||||
force_43, /* (C) video */
|
||||
gfxcard, /* (C) graphics/video card */
|
||||
video_speed; /* (C) video */
|
||||
extern int serial_enabled[], /* (C) enable serial ports */
|
||||
lpt_enabled, /* (C) enable LPT ports */
|
||||
bugger_enabled; /* (C) enable ISAbugger */
|
||||
extern int gfxcard; /* (C) graphics/video card */
|
||||
extern int sound_is_float, /* (C) sound uses FP values */
|
||||
GAMEBLASTER, /* (C) sound option */
|
||||
GUS, /* (C) sound option */
|
||||
@@ -106,6 +106,9 @@ extern int cpu_manufacturer, /* (C) cpu manufacturer */
|
||||
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
|
||||
enable_external_fpu; /* (C) enable external FPU */
|
||||
extern int enable_sync; /* (C) enable time sync */
|
||||
extern int network_type; /* (C) net provider type */
|
||||
extern int network_card; /* (C) net interface num */
|
||||
extern char network_host[512]; /* (C) host network intf */
|
||||
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
|
||||
10
src/bugger.c
10
src/bugger.c
@@ -44,10 +44,10 @@
|
||||
* configuration register (CTRL_SPCFG bit set) but have to
|
||||
* remember that stuff first...
|
||||
*
|
||||
* Version: @(#)bugger.c 1.0.9 2017/10/28
|
||||
* Version: @(#)bugger.c 1.0.10 2018/03/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 1989-2017 Fred N. van Kempen.
|
||||
* Copyright 1989-2018 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -309,7 +309,7 @@ bug_read(uint16_t port, void *priv)
|
||||
|
||||
/* Initialize the ISA BusBugger emulator. */
|
||||
static void *
|
||||
bug_init(device_t *info)
|
||||
bug_init(const device_t *info)
|
||||
{
|
||||
pclog("%s, I/O=%04x\n", info->name, BUGGER_ADDR);
|
||||
|
||||
@@ -320,7 +320,7 @@ bug_init(device_t *info)
|
||||
bug_read, NULL, NULL, bug_write, NULL, NULL, NULL);
|
||||
|
||||
/* Just so its not NULL. */
|
||||
return(info);
|
||||
return(&bug_ctrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ bug_close(UNUSED(void *priv))
|
||||
}
|
||||
|
||||
|
||||
device_t bugger_device = {
|
||||
const device_t bugger_device = {
|
||||
"ISA/PCI Bus Bugger",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*
|
||||
* Definitions for the BUGGER card.
|
||||
*
|
||||
* Version: @(#)bugger.h 1.0.5 2017/10/28
|
||||
* Version: @(#)bugger.h 1.0.6 2018/03/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 1989-2017 Fred N. van Kempen.
|
||||
* Copyright 1989-2018 Fred N. van Kempen.
|
||||
*/
|
||||
#ifndef BUGGER_H
|
||||
# define BUGGER_H
|
||||
@@ -35,7 +35,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Global variables. */
|
||||
extern device_t bugger_device;
|
||||
extern const device_t bugger_device;
|
||||
|
||||
|
||||
/* Functions. */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the CD-ROM drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)cdrom.c 1.0.40 2018/03/18
|
||||
* Version: @(#)cdrom.c 1.0.41 2018/03/18
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -97,7 +97,7 @@ static struct
|
||||
|
||||
|
||||
/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */
|
||||
uint8_t cdrom_command_flags[0x100] =
|
||||
const uint8_t cdrom_command_flags[0x100] =
|
||||
{
|
||||
IMPLEMENTED | CHECK_READY | NONDATA,
|
||||
IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY,
|
||||
|
||||
32
src/config.c
32
src/config.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Configuration file handler.
|
||||
*
|
||||
* Version: @(#)config.c 1.0.45 2018/03/17
|
||||
* Version: @(#)config.c 1.0.46 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "sound/sound.h"
|
||||
#include "video/video.h"
|
||||
#include "plat.h"
|
||||
#include "plat_joystick.h"
|
||||
#include "plat_midi.h"
|
||||
#include "ui.h"
|
||||
|
||||
@@ -649,22 +648,27 @@ load_network(void)
|
||||
} else
|
||||
network_type = NET_TYPE_NONE;
|
||||
|
||||
memset(network_pcap, '\0', sizeof(network_pcap));
|
||||
p = config_get_string(cat, "net_pcap_device", NULL);
|
||||
memset(network_host, '\0', sizeof(network_host));
|
||||
p = config_get_string(cat, "net_host_device", NULL);
|
||||
if (p == NULL) {
|
||||
p = config_get_string(cat, "net_host_device", NULL);
|
||||
if (p != NULL)
|
||||
config_delete_var(cat, "net_host_device");
|
||||
}
|
||||
if (p != NULL) {
|
||||
if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) {
|
||||
if ((network_ndev == 1) && strcmp(network_pcap, "none")) {
|
||||
if ((network_ndev == 1) && strcmp(network_host, "none")) {
|
||||
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2140);
|
||||
} else if (network_dev_to_id(p) == -1) {
|
||||
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2141);
|
||||
}
|
||||
|
||||
strcpy(network_pcap, "none");
|
||||
strcpy(network_host, "none");
|
||||
} else {
|
||||
strcpy(network_pcap, p);
|
||||
strcpy(network_host, p);
|
||||
}
|
||||
} else
|
||||
strcpy(network_pcap, "none");
|
||||
strcpy(network_host, "none");
|
||||
|
||||
p = config_get_string(cat, "net_card", NULL);
|
||||
if (p != NULL)
|
||||
@@ -1752,14 +1756,14 @@ save_network(void)
|
||||
config_set_string(cat, "net_type",
|
||||
(network_type == NET_TYPE_SLIRP) ? "slirp" : "pcap");
|
||||
|
||||
if (network_pcap[0] != '\0') {
|
||||
if (! strcmp(network_pcap, "none"))
|
||||
config_delete_var(cat, "net_pcap_device");
|
||||
if (network_host[0] != '\0') {
|
||||
if (! strcmp(network_host, "none"))
|
||||
config_delete_var(cat, "net_host_device");
|
||||
else
|
||||
config_set_string(cat, "net_pcap_device", network_pcap);
|
||||
config_set_string(cat, "net_host_device", network_host);
|
||||
} else {
|
||||
/* config_set_string(cat, "net_pcap_device", "none"); */
|
||||
config_delete_var(cat, "net_pcap_device");
|
||||
/* config_set_string(cat, "net_host_device", "none"); */
|
||||
config_delete_var(cat, "net_host_device");
|
||||
}
|
||||
|
||||
if (network_card == 0)
|
||||
|
||||
171
src/device.c
171
src/device.c
@@ -1,21 +1,41 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the generic device interface to handle
|
||||
* all devices attached to the emulator.
|
||||
*
|
||||
* Version: @(#)device.c 1.0.9 2018/03/02
|
||||
* Version: @(#)device.c 1.0.5 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -32,8 +52,8 @@
|
||||
#define DEVICE_MAX 256 /* max # of devices */
|
||||
|
||||
|
||||
static device_t *devices[DEVICE_MAX];
|
||||
static void *device_priv[DEVICE_MAX];
|
||||
static device_t *devices[DEVICE_MAX];
|
||||
static device_t *device_current;
|
||||
|
||||
|
||||
@@ -45,48 +65,49 @@ device_init(void)
|
||||
|
||||
|
||||
void *
|
||||
device_add(device_t *d)
|
||||
device_add(const device_t *d)
|
||||
{
|
||||
void *priv = NULL;
|
||||
int c;
|
||||
|
||||
for (c=0; c<256; c++) {
|
||||
if (devices[c] == d) {
|
||||
fatal("device_add: device already exists!\n");
|
||||
break;
|
||||
if (devices[c] == (device_t *)d) {
|
||||
pclog("DEVICE: device already exists!\n");
|
||||
return(NULL);
|
||||
}
|
||||
if (devices[c] == NULL) break;
|
||||
}
|
||||
if (c >= DEVICE_MAX)
|
||||
fatal("device_add: too many devices\n");
|
||||
fatal("DEVICE: too many devices\n");
|
||||
|
||||
device_current = d;
|
||||
device_current = (device_t *)d;
|
||||
|
||||
if (d->init != NULL) {
|
||||
priv = d->init(d);
|
||||
if (priv == NULL) {
|
||||
if (d->name)
|
||||
fatal("device_add: device init failed (%s)\n", d->name);
|
||||
else
|
||||
fatal("device_add: device init failed\n");
|
||||
pclog("DEVICE: device '%s' init failed\n", d->name);
|
||||
else
|
||||
pclog("DEVICE: device init failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
devices[c] = d;
|
||||
devices[c] = (device_t *)d;
|
||||
device_priv[c] = priv;
|
||||
|
||||
return priv;
|
||||
return(priv);
|
||||
}
|
||||
|
||||
|
||||
/* For devices that do not have an init function (internal video etc.) */
|
||||
void
|
||||
device_add_ex(device_t *d, void *priv)
|
||||
device_add_ex(const device_t *d, void *priv)
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c=0; c<256; c++) {
|
||||
if (devices[c] == d) {
|
||||
if (devices[c] == (device_t *)d) {
|
||||
fatal("device_add: device already exists!\n");
|
||||
break;
|
||||
}
|
||||
@@ -95,9 +116,9 @@ device_add_ex(device_t *d, void *priv)
|
||||
if (c >= DEVICE_MAX)
|
||||
fatal("device_add: too many devices\n");
|
||||
|
||||
device_current = d;
|
||||
device_current = (device_t *)d;
|
||||
|
||||
devices[c] = d;
|
||||
devices[c] = (device_t *)d;
|
||||
device_priv[c] = priv;
|
||||
}
|
||||
|
||||
@@ -132,7 +153,7 @@ device_reset_all(void)
|
||||
|
||||
|
||||
void *
|
||||
device_get_priv(device_t *d)
|
||||
device_get_priv(const device_t *d)
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -148,7 +169,7 @@ device_get_priv(device_t *d)
|
||||
|
||||
|
||||
int
|
||||
device_available(device_t *d)
|
||||
device_available(const device_t *d)
|
||||
{
|
||||
#ifdef RELEASE_BUILD
|
||||
if (d->flags & DEVICE_NOT_WORKING) return(0);
|
||||
@@ -207,11 +228,11 @@ device_add_status_info(char *s, int max_len)
|
||||
char *
|
||||
device_get_config_string(char *s)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_string((char *) device_current->name, s, (char *) c->default_string));
|
||||
return(config_get_string((char *)device_current->name, s, (char *)c->default_string));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -223,11 +244,11 @@ device_get_config_string(char *s)
|
||||
int
|
||||
device_get_config_int(char *s)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_int((char *) device_current->name, s, c->default_int));
|
||||
return(config_get_int((char *)device_current->name, s, c->default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -239,11 +260,11 @@ device_get_config_int(char *s)
|
||||
int
|
||||
device_get_config_int_ex(char *s, int default_int)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_int((char *) device_current->name, s, default_int));
|
||||
return(config_get_int((char *)device_current->name, s, default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -255,11 +276,11 @@ device_get_config_int_ex(char *s, int default_int)
|
||||
int
|
||||
device_get_config_hex16(char *s)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_hex16((char *) device_current->name, s, c->default_int));
|
||||
return(config_get_hex16((char *)device_current->name, s, c->default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -271,11 +292,11 @@ device_get_config_hex16(char *s)
|
||||
int
|
||||
device_get_config_hex20(char *s)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_hex20((char *) device_current->name, s, c->default_int));
|
||||
return(config_get_hex20((char *)device_current->name, s, c->default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -287,11 +308,11 @@ device_get_config_hex20(char *s)
|
||||
int
|
||||
device_get_config_mac(char *s, int default_int)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_mac((char *) device_current->name, s, default_int));
|
||||
return(config_get_mac((char *)device_current->name, s, default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -303,11 +324,11 @@ device_get_config_mac(char *s, int default_int)
|
||||
void
|
||||
device_set_config_int(char *s, int val)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name)) {
|
||||
config_set_int((char *) device_current->name, s, val);
|
||||
config_set_int((char *)device_current->name, s, val);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -319,11 +340,11 @@ device_set_config_int(char *s, int val)
|
||||
void
|
||||
device_set_config_hex16(char *s, int val)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name)) {
|
||||
config_set_hex16((char *) device_current->name, s, val);
|
||||
config_set_hex16((char *)device_current->name, s, val);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -335,11 +356,11 @@ device_set_config_hex16(char *s, int val)
|
||||
void
|
||||
device_set_config_hex20(char *s, int val)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name)) {
|
||||
config_set_hex20((char *) device_current->name, s, val);
|
||||
config_set_hex20((char *)device_current->name, s, val);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -351,11 +372,11 @@ device_set_config_hex20(char *s, int val)
|
||||
void
|
||||
device_set_config_mac(char *s, int val)
|
||||
{
|
||||
device_config_t *c = device_current->config;
|
||||
const device_config_t *c = device_current->config;
|
||||
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name)) {
|
||||
config_set_mac((char *) device_current->name, s, val);
|
||||
config_set_mac((char *)device_current->name, s, val);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -365,65 +386,43 @@ device_set_config_mac(char *s, int val)
|
||||
|
||||
|
||||
int
|
||||
device_is_valid(device_t *device, int machine_flags)
|
||||
device_is_valid(const device_t *device, int mflags)
|
||||
{
|
||||
if (!device)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (device == NULL) return(1);
|
||||
|
||||
if ((device->flags & DEVICE_AT) && !(machine_flags & MACHINE_AT)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_AT) && !(mflags & MACHINE_AT)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_CBUS) && !(machine_flags & MACHINE_CBUS)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_CBUS) && !(mflags & MACHINE_CBUS)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_ISA) && !(machine_flags & MACHINE_ISA)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_ISA) && !(mflags & MACHINE_ISA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_MCA) && !(machine_flags & MACHINE_MCA)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_MCA) && !(mflags & MACHINE_MCA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_EISA) && !(machine_flags & MACHINE_EISA)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_EISA) && !(mflags & MACHINE_EISA)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_VLB) && !(machine_flags & MACHINE_VLB)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_VLB) && !(mflags & MACHINE_VLB)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_PCI) && !(machine_flags & MACHINE_PCI)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_PCI) && !(mflags & MACHINE_PCI)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_PS2) && !(machine_flags & MACHINE_HDC_PS2)) {
|
||||
return 0;
|
||||
}
|
||||
if ((device->flags & DEVICE_PS2) && !(mflags & MACHINE_HDC_PS2)) return(0);
|
||||
if ((device->flags & DEVICE_AGP) && !(mflags & MACHINE_AGP)) return(0);
|
||||
|
||||
if ((device->flags & DEVICE_AGP) && !(machine_flags & MACHINE_AGP)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
machine_get_config_int(char *s)
|
||||
{
|
||||
device_t *d = machine_getdevice(machine);
|
||||
device_config_t *c;
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL) return(0);
|
||||
|
||||
c = d->config;
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_int((char *) d->name, s, c->default_int));
|
||||
return(config_get_int((char *)d->name, s, c->default_int));
|
||||
|
||||
c++;
|
||||
}
|
||||
@@ -435,15 +434,15 @@ machine_get_config_int(char *s)
|
||||
char *
|
||||
machine_get_config_string(char *s)
|
||||
{
|
||||
device_t *d = machine_getdevice(machine);
|
||||
device_config_t *c;
|
||||
const device_t *d = machine_getdevice(machine);
|
||||
const device_config_t *c;
|
||||
|
||||
if (d == NULL) return(0);
|
||||
|
||||
c = d->config;
|
||||
while (c && c->type != -1) {
|
||||
if (! strcmp(s, c->name))
|
||||
return(config_get_string((char *) d->name, s, (char *) c->default_string));
|
||||
return(config_get_string((char *)d->name, s, (char *)c->default_string));
|
||||
|
||||
c++;
|
||||
}
|
||||
|
||||
55
src/device.h
55
src/device.h
@@ -1,23 +1,40 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the generic device interface to handle
|
||||
* all devices attached to the emulator.
|
||||
* Definitions for the device handler.
|
||||
*
|
||||
* Version: @(#)device.h 1.0.8 2018/02/18
|
||||
* Version: @(#)device.h 1.0.3 2018/03/15
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_DEVICE_H
|
||||
# define EMU_DEVICE_H
|
||||
@@ -81,7 +98,7 @@ typedef struct _device_ {
|
||||
uint32_t flags; /* system flags */
|
||||
uint32_t local; /* flags local to device */
|
||||
|
||||
void *(*init)(struct _device_ *);
|
||||
void *(*init)(const struct _device_ *);
|
||||
void (*close)(void *p);
|
||||
void (*reset)(void *p);
|
||||
int (*available)(/*void*/);
|
||||
@@ -89,7 +106,7 @@ typedef struct _device_ {
|
||||
void (*force_redraw)(void *p);
|
||||
void (*add_status_info)(char *s, int max_len, void *p);
|
||||
|
||||
device_config_t *config;
|
||||
const device_config_t *config;
|
||||
} device_t;
|
||||
|
||||
|
||||
@@ -98,12 +115,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern void device_init(void);
|
||||
extern void *device_add(device_t *d);
|
||||
extern void device_add_ex(device_t *d, void *priv);
|
||||
extern void *device_add(const device_t *d);
|
||||
extern void device_add_ex(const device_t *d, void *priv);
|
||||
extern void device_close_all(void);
|
||||
extern void device_reset_all(void);
|
||||
extern void *device_get_priv(device_t *d);
|
||||
extern int device_available(device_t *d);
|
||||
extern void *device_get_priv(const device_t *d);
|
||||
extern int device_available(const device_t *d);
|
||||
extern void device_speed_changed(void);
|
||||
extern void device_force_redraw(void);
|
||||
extern void device_add_status_info(char *s, int max_len);
|
||||
@@ -118,7 +135,7 @@ extern void device_set_config_hex16(char *s, int val);
|
||||
extern void device_set_config_hex20(char *s, int val);
|
||||
extern void device_set_config_mac(char *s, int val);
|
||||
extern char *device_get_config_string(char *name);
|
||||
extern int device_is_valid(device_t *device, int machine_flags);
|
||||
extern int device_is_valid(const device_t *device, int machine_flags);
|
||||
|
||||
extern int machine_get_config_int(char *s);
|
||||
extern char *machine_get_config_string(char *s);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Common code to handle all sorts of disk controllers.
|
||||
*
|
||||
* Version: @(#)hdc.c 1.0.10 2018/03/17
|
||||
* Version: @(#)hdc.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -32,7 +32,7 @@ int hdc_current;
|
||||
|
||||
|
||||
static void *
|
||||
null_init(device_t *info)
|
||||
null_init(const device_t *info)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
@@ -44,7 +44,7 @@ null_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t null_device = {
|
||||
static const device_t null_device = {
|
||||
"Null HDC", 0, 0,
|
||||
null_init, null_close, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
@@ -52,7 +52,7 @@ static device_t null_device = {
|
||||
|
||||
|
||||
static void *
|
||||
inthdc_init(device_t *info)
|
||||
inthdc_init(const device_t *info)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
@@ -64,17 +64,17 @@ inthdc_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t inthdc_device = {
|
||||
static const device_t inthdc_device = {
|
||||
"Internal Controller", 0, 0,
|
||||
inthdc_init, inthdc_close, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
static struct {
|
||||
static const struct {
|
||||
char *name;
|
||||
char *internal_name;
|
||||
device_t *device;
|
||||
const device_t *device;
|
||||
int is_mfm;
|
||||
} controllers[] = {
|
||||
{ "None", "none",
|
||||
@@ -185,7 +185,7 @@ hdc_get_internal_name(int hdc)
|
||||
}
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
hdc_get_device(int hdc)
|
||||
{
|
||||
return(controllers[hdc].device);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the common disk controller handler.
|
||||
*
|
||||
* Version: @(#)hdc.h 1.0.5 2018/02/14
|
||||
* Version: @(#)hdc.h 1.0.6 2018/03/18
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -32,25 +32,25 @@ extern char *hdc_name;
|
||||
extern int hdc_current;
|
||||
|
||||
|
||||
extern device_t mfm_xt_xebec_device; /* mfm_xt_xebec */
|
||||
extern device_t mfm_xt_dtc5150x_device; /* mfm_xt_dtc */
|
||||
extern device_t mfm_at_wd1003_device; /* mfm_at_wd1003 */
|
||||
extern const device_t mfm_xt_xebec_device; /* mfm_xt_xebec */
|
||||
extern const device_t mfm_xt_dtc5150x_device; /* mfm_xt_dtc */
|
||||
extern const device_t mfm_at_wd1003_device; /* mfm_at_wd1003 */
|
||||
|
||||
extern device_t esdi_at_wd1007vse1_device; /* esdi_at */
|
||||
extern device_t esdi_ps2_device; /* esdi_mca */
|
||||
extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */
|
||||
extern const device_t esdi_ps2_device; /* esdi_mca */
|
||||
|
||||
extern device_t ide_isa_device; /* isa_ide */
|
||||
extern device_t ide_isa_2ch_device; /* isa_ide_2ch */
|
||||
extern device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
|
||||
extern device_t ide_vlb_device; /* vlb_ide */
|
||||
extern device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
|
||||
extern device_t ide_pci_device; /* pci_ide */
|
||||
extern device_t ide_pci_2ch_device; /* pci_ide_2ch */
|
||||
extern const device_t ide_isa_device; /* isa_ide */
|
||||
extern const device_t ide_isa_2ch_device; /* isa_ide_2ch */
|
||||
extern const device_t ide_isa_2ch_opt_device; /* isa_ide_2ch_opt */
|
||||
extern const device_t ide_vlb_device; /* vlb_ide */
|
||||
extern const device_t ide_vlb_2ch_device; /* vlb_ide_2ch */
|
||||
extern const device_t ide_pci_device; /* pci_ide */
|
||||
extern const device_t ide_pci_2ch_device; /* pci_ide_2ch */
|
||||
|
||||
extern device_t xtide_device; /* xtide_xt */
|
||||
extern device_t xtide_at_device; /* xtide_at */
|
||||
extern device_t xtide_acculogic_device; /* xtide_ps2 */
|
||||
extern device_t xtide_at_ps2_device; /* xtide_at_ps2 */
|
||||
extern const device_t xtide_device; /* xtide_xt */
|
||||
extern const device_t xtide_at_device; /* xtide_at */
|
||||
extern const device_t xtide_acculogic_device; /* xtide_ps2 */
|
||||
extern const device_t xtide_at_ps2_device; /* xtide_at_ps2 */
|
||||
|
||||
|
||||
extern void hdc_init(char *name);
|
||||
@@ -58,7 +58,7 @@ extern void hdc_reset(void);
|
||||
|
||||
extern char *hdc_get_name(int hdc);
|
||||
extern char *hdc_get_internal_name(int hdc);
|
||||
extern device_t *hdc_get_device(int hdc);
|
||||
extern const device_t *hdc_get_device(int hdc);
|
||||
extern int hdc_get_flags(int hdc);
|
||||
extern int hdc_available(int hdc);
|
||||
extern int hdc_current_is_mfm(void);
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
*
|
||||
* Driver for the ESDI controller (WD1007-vse1) for PC/AT.
|
||||
*
|
||||
* Version: @(#)hdc_esdi_at.c 1.0.8 2017/11/08
|
||||
* Version: @(#)hdc_esdi_at.c 1.0.9 2018/03/18
|
||||
*
|
||||
* 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.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*/
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
@@ -770,7 +770,7 @@ loadhd(esdi_t *esdi, int hdd_num, int d, const wchar_t *fn)
|
||||
|
||||
|
||||
static void *
|
||||
wd1007vse1_init(device_t *info)
|
||||
wd1007vse1_init(const device_t *info)
|
||||
{
|
||||
int c, d;
|
||||
|
||||
@@ -835,7 +835,7 @@ wd1007vse1_available(void)
|
||||
}
|
||||
|
||||
|
||||
device_t esdi_at_wd1007vse1_device = {
|
||||
const device_t esdi_at_wd1007vse1_device = {
|
||||
"Western Digital WD1007V-SE1 (ESDI)",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
|
||||
@@ -52,13 +52,13 @@
|
||||
* however, are auto-configured by the system software as
|
||||
* shown above.
|
||||
*
|
||||
* Version: @(#)hdc_esdi_mca.c 1.0.8 2017/11/04
|
||||
* Version: @(#)hdc_esdi_mca.c 1.0.9 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -1041,7 +1041,7 @@ esdi_mca_write(int port, uint8_t val, void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
esdi_init(device_t *info)
|
||||
esdi_init(const device_t *info)
|
||||
{
|
||||
drive_t *drive;
|
||||
esdi_t *dev;
|
||||
@@ -1135,7 +1135,7 @@ esdi_available(void)
|
||||
}
|
||||
|
||||
|
||||
device_t esdi_ps2_device = {
|
||||
const device_t esdi_ps2_device = {
|
||||
"IBM ESDI Fixed Disk Adapter (MCA)",
|
||||
DEVICE_MCA, 0,
|
||||
esdi_init, esdi_close, NULL,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the IDE emulation for hard disks and ATAPI
|
||||
* CD-ROM devices.
|
||||
*
|
||||
* Version: @(#)hdc_ide.c 1.0.39 2018/03/17
|
||||
* Version: @(#)hdc_ide.c 1.0.40 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -2856,12 +2856,12 @@ void secondary_ide_check(void)
|
||||
* Initialization of standalone IDE controller instance.
|
||||
*
|
||||
* Eventually, we should clean up the whole mess by only
|
||||
* using device_t units, with configuration parameters to
|
||||
* using const device_t units, with configuration parameters to
|
||||
* indicate primary/secondary and all that, rather than
|
||||
* keeping a zillion of duplicate functions around.
|
||||
*/
|
||||
static void *
|
||||
ide_sainit(device_t *info)
|
||||
ide_sainit(const device_t *info)
|
||||
{
|
||||
switch(info->local) {
|
||||
case 0: /* ISA, single-channel */
|
||||
@@ -2891,7 +2891,7 @@ ide_sainit(device_t *info)
|
||||
break;
|
||||
}
|
||||
|
||||
return(info);
|
||||
return(ide_drives);
|
||||
}
|
||||
|
||||
|
||||
@@ -2903,7 +2903,7 @@ ide_saclose(void *priv)
|
||||
}
|
||||
|
||||
|
||||
device_t ide_isa_device = {
|
||||
const device_t ide_isa_device = {
|
||||
"ISA PC/AT IDE Controller",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
@@ -2912,7 +2912,7 @@ device_t ide_isa_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_isa_2ch_device = {
|
||||
const device_t ide_isa_2ch_device = {
|
||||
"ISA PC/AT IDE Controller (Dual-Channel)",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
2,
|
||||
@@ -2921,7 +2921,7 @@ device_t ide_isa_2ch_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_isa_2ch_opt_device = {
|
||||
const device_t ide_isa_2ch_opt_device = {
|
||||
"ISA PC/AT IDE Controller (Single/Dual)",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
3,
|
||||
@@ -2930,7 +2930,7 @@ device_t ide_isa_2ch_opt_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_vlb_device = {
|
||||
const device_t ide_vlb_device = {
|
||||
"VLB IDE Controller",
|
||||
DEVICE_VLB | DEVICE_AT,
|
||||
4,
|
||||
@@ -2939,7 +2939,7 @@ device_t ide_vlb_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_vlb_2ch_device = {
|
||||
const device_t ide_vlb_2ch_device = {
|
||||
"VLB IDE Controller (Dual-Channel)",
|
||||
DEVICE_VLB | DEVICE_AT,
|
||||
6,
|
||||
@@ -2948,7 +2948,7 @@ device_t ide_vlb_2ch_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_pci_device = {
|
||||
const device_t ide_pci_device = {
|
||||
"PCI IDE Controller",
|
||||
DEVICE_PCI | DEVICE_AT,
|
||||
8,
|
||||
@@ -2957,7 +2957,7 @@ device_t ide_pci_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t ide_pci_2ch_device = {
|
||||
const device_t ide_pci_2ch_device = {
|
||||
"PCI IDE Controller (Dual-Channel)",
|
||||
DEVICE_PCI | DEVICE_AT,
|
||||
10,
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* based design. Most cards were WD1003-WA2 or -WAH, where the
|
||||
* -WA2 cards had a floppy controller as well (to save space.)
|
||||
*
|
||||
* Version: @(#)hdc_mfm_at.c 1.0.12 2017/12/09
|
||||
* Version: @(#)hdc_mfm_at.c 1.0.13 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*/
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
@@ -707,7 +707,7 @@ loadhd(mfm_t *mfm, int c, int d, const wchar_t *fn)
|
||||
|
||||
|
||||
static void *
|
||||
mfm_init(device_t *info)
|
||||
mfm_init(const device_t *info)
|
||||
{
|
||||
mfm_t *mfm;
|
||||
int c, d;
|
||||
@@ -764,7 +764,7 @@ mfm_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
device_t mfm_at_wd1003_device = {
|
||||
const device_t mfm_at_wd1003_device = {
|
||||
"WD1003 AT MFM/RLL Controller",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
* Since all controllers (including the ones made by DTC) use
|
||||
* (mostly) the same API, we keep them all in this module.
|
||||
*
|
||||
* Version: @(#)hdc_mfm_xt.c 1.0.13 2017/11/06
|
||||
* Version: @(#)hdc_mfm_xt.c 1.0.14 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*/
|
||||
#define __USE_LARGEFILE64
|
||||
#define _LARGEFILE_SOURCE
|
||||
@@ -808,7 +808,7 @@ mfm_set_switches(mfm_t *mfm)
|
||||
|
||||
|
||||
static void *
|
||||
xebec_init(device_t *info)
|
||||
xebec_init(const device_t *info)
|
||||
{
|
||||
int i, c = 0;
|
||||
|
||||
@@ -863,7 +863,7 @@ xebec_available(void)
|
||||
}
|
||||
|
||||
|
||||
device_t mfm_xt_xebec_device = {
|
||||
const device_t mfm_xt_xebec_device = {
|
||||
"IBM PC Fixed Disk Adapter",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
@@ -874,7 +874,7 @@ device_t mfm_xt_xebec_device = {
|
||||
|
||||
|
||||
static void *
|
||||
dtc5150x_init(device_t *info)
|
||||
dtc5150x_init(const device_t *info)
|
||||
{
|
||||
int i, c = 0;
|
||||
|
||||
@@ -918,7 +918,7 @@ dtc5150x_available(void)
|
||||
}
|
||||
|
||||
|
||||
device_t mfm_xt_dtc5150x_device = {
|
||||
const device_t mfm_xt_dtc5150x_device = {
|
||||
"DTC 5150X",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* already on their way out, the newer IDE standard based on the
|
||||
* PC/AT controller and 16b design became the IDE we now know.
|
||||
*
|
||||
* Version: @(#)hdc_xtide.c 1.0.11 2018/02/14
|
||||
* Version: @(#)hdc_xtide.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -127,7 +127,7 @@ xtide_read(uint16_t port, void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
xtide_init(device_t *info)
|
||||
xtide_init(const device_t *info)
|
||||
{
|
||||
xtide_t *xtide = malloc(sizeof(xtide_t));
|
||||
|
||||
@@ -154,7 +154,7 @@ xtide_available(void)
|
||||
|
||||
|
||||
static void *
|
||||
xtide_at_init(device_t *info)
|
||||
xtide_at_init(const device_t *info)
|
||||
{
|
||||
xtide_t *xtide = malloc(sizeof(xtide_t));
|
||||
|
||||
@@ -177,7 +177,7 @@ xtide_at_available(void)
|
||||
|
||||
|
||||
static void *
|
||||
xtide_acculogic_init(device_t *info)
|
||||
xtide_acculogic_init(const device_t *info)
|
||||
{
|
||||
xtide_t *xtide = malloc(sizeof(xtide_t));
|
||||
|
||||
@@ -204,7 +204,7 @@ xtide_acculogic_available(void)
|
||||
|
||||
|
||||
static void *
|
||||
xtide_at_ps2_init(device_t *info)
|
||||
xtide_at_ps2_init(const device_t *info)
|
||||
{
|
||||
xtide_t *xtide = malloc(sizeof(xtide_t));
|
||||
|
||||
@@ -235,7 +235,7 @@ xtide_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
device_t xtide_device = {
|
||||
const device_t xtide_device = {
|
||||
"XTIDE",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
@@ -244,7 +244,7 @@ device_t xtide_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t xtide_at_device = {
|
||||
const device_t xtide_at_device = {
|
||||
"XTIDE (AT)",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
0,
|
||||
@@ -253,7 +253,7 @@ device_t xtide_at_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t xtide_acculogic_device = {
|
||||
const device_t xtide_acculogic_device = {
|
||||
"XTIDE (Acculogic)",
|
||||
DEVICE_ISA,
|
||||
0,
|
||||
@@ -262,7 +262,7 @@ device_t xtide_acculogic_device = {
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t xtide_at_ps2_device = {
|
||||
const device_t xtide_at_ps2_device = {
|
||||
"XTIDE (AT) (1.1.5)",
|
||||
DEVICE_ISA | DEVICE_PS2,
|
||||
0,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the Iomega ZIP drive with SCSI(-like)
|
||||
* commands, for both ATAPI and SCSI usage.
|
||||
*
|
||||
* Version: @(#)zip.c 1.0.12 2018/03/17
|
||||
* Version: @(#)zip.c 1.0.13 2018/03/18
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -70,7 +70,7 @@ uint8_t scsi_zip_drives[16][8] = { { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0
|
||||
|
||||
|
||||
/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */
|
||||
uint8_t zip_command_flags[0x100] =
|
||||
const uint8_t zip_command_flags[0x100] =
|
||||
{
|
||||
IMPLEMENTED | CHECK_READY | NONDATA, /* 0x00 */
|
||||
IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, /* 0x01 */
|
||||
|
||||
@@ -1,21 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the NEC uPD-765 and compatible floppy disk
|
||||
* controller.
|
||||
*
|
||||
* Version: @(#)fdc->c 1.0.18 2018/03/08
|
||||
* Version: @(#)fdc.c 1.0.5 2018/03/16
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -42,7 +60,7 @@
|
||||
extern int64_t motoron[FDD_NUM];
|
||||
|
||||
|
||||
int command_has_drivesel[256] = {
|
||||
const int command_has_drivesel[256] = {
|
||||
0, 0,
|
||||
1, /* READ TRACK */
|
||||
0,
|
||||
@@ -1147,7 +1165,6 @@ fdc_read(uint16_t addr, void *priv)
|
||||
{
|
||||
fdc_t *fdc = (fdc_t *) priv;
|
||||
uint8_t ret;
|
||||
|
||||
int drive;
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
@@ -2020,7 +2037,7 @@ fdc_close(void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
fdc_init(device_t *info)
|
||||
fdc_init(const device_t *info)
|
||||
{
|
||||
fdc_t *fdc = (fdc_t *) malloc(sizeof(fdc_t));
|
||||
memset(fdc, 0, sizeof(fdc_t));
|
||||
@@ -2058,7 +2075,7 @@ fdc_3f1_enable(fdc_t *fdc, int enable)
|
||||
}
|
||||
|
||||
|
||||
device_t fdc_xt_device = {
|
||||
const device_t fdc_xt_device = {
|
||||
"PC/XT Floppy Drive Controller",
|
||||
0,
|
||||
0,
|
||||
@@ -2068,7 +2085,7 @@ device_t fdc_xt_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_pcjr_device = {
|
||||
const device_t fdc_pcjr_device = {
|
||||
"PCjr Floppy Drive Controller",
|
||||
0,
|
||||
FDC_FLAG_PCJR,
|
||||
@@ -2078,7 +2095,7 @@ device_t fdc_pcjr_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_device = {
|
||||
const device_t fdc_at_device = {
|
||||
"PC/AT Floppy Drive Controller",
|
||||
0,
|
||||
FDC_FLAG_AT,
|
||||
@@ -2088,7 +2105,7 @@ device_t fdc_at_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_actlow_device = {
|
||||
const device_t fdc_at_actlow_device = {
|
||||
"PC/AT Floppy Drive Controller (Active low)",
|
||||
0,
|
||||
FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT,
|
||||
@@ -2098,7 +2115,7 @@ device_t fdc_at_actlow_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_ps1_device = {
|
||||
const device_t fdc_at_ps1_device = {
|
||||
"PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)",
|
||||
0,
|
||||
FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1,
|
||||
@@ -2108,7 +2125,7 @@ device_t fdc_at_ps1_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_smc_device = {
|
||||
const device_t fdc_at_smc_device = {
|
||||
"PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)",
|
||||
0,
|
||||
FDC_FLAG_AT | FDC_FLAG_SUPERIO,
|
||||
@@ -2118,7 +2135,7 @@ device_t fdc_at_smc_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_winbond_device = {
|
||||
const device_t fdc_at_winbond_device = {
|
||||
"PC/AT Floppy Drive Controller (Winbond W83x77F)",
|
||||
0,
|
||||
FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS,
|
||||
@@ -2128,7 +2145,7 @@ device_t fdc_at_winbond_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t fdc_at_nsc_device = {
|
||||
const device_t fdc_at_nsc_device = {
|
||||
"PC/AT Floppy Drive Controller (NSC PC8730x)",
|
||||
0,
|
||||
FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC,
|
||||
|
||||
@@ -1,20 +1,41 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the NEC uPD-765 and compatible floppy disk
|
||||
* controller.
|
||||
*
|
||||
* Version: @(#)fdc.h 1.0.5 2018/03/02
|
||||
* Version: @(#)fdc.h 1.0.3 2018/03/17
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FDC_H
|
||||
# define EMU_FDC_H
|
||||
@@ -29,8 +50,8 @@
|
||||
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
|
||||
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
typedef struct {
|
||||
uint8_t dor, stat, command, dat, st0, swap;
|
||||
uint8_t swwp, disable_write;
|
||||
uint8_t params[256], res[256];
|
||||
@@ -79,6 +100,7 @@ typedef struct
|
||||
int64_t watchdog_timer, watchdog_count;
|
||||
} fdc_t;
|
||||
|
||||
|
||||
extern void fdc_remove(fdc_t *fdc);
|
||||
extern void fdc_poll(fdc_t *fdc);
|
||||
extern void fdc_abort(fdc_t *fdc);
|
||||
@@ -148,7 +170,9 @@ extern void fdc_set_base(fdc_t *fdc, int base);
|
||||
extern int fdc_getdata(fdc_t *fdc, int last);
|
||||
extern int fdc_data(fdc_t *fdc, uint8_t data);
|
||||
|
||||
extern void fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side, uint8_t sector, uint8_t size, uint8_t crc1, uint8_t crc2);
|
||||
extern void fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side,
|
||||
uint8_t sector, uint8_t size, uint8_t crc1,
|
||||
uint8_t crc2);
|
||||
|
||||
extern uint8_t fdc_read(uint16_t addr, void *priv);
|
||||
extern void fdc_reset(void *priv);
|
||||
@@ -156,14 +180,14 @@ extern void fdc_reset(void *priv);
|
||||
extern uint8_t fdc_ps1_525(void);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t fdc_xt_device;
|
||||
extern device_t fdc_pcjr_device;
|
||||
extern device_t fdc_at_device;
|
||||
extern device_t fdc_at_actlow_device;
|
||||
extern device_t fdc_at_ps1_device;
|
||||
extern device_t fdc_at_smc_device;
|
||||
extern device_t fdc_at_winbond_device;
|
||||
extern device_t fdc_at_nsc_device;
|
||||
extern const device_t fdc_xt_device;
|
||||
extern const device_t fdc_pcjr_device;
|
||||
extern const device_t fdc_at_device;
|
||||
extern const device_t fdc_at_actlow_device;
|
||||
extern const device_t fdc_at_ps1_device;
|
||||
extern const device_t fdc_at_smc_device;
|
||||
extern const device_t fdc_at_winbond_device;
|
||||
extern const device_t fdc_at_nsc_device;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,40 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the floppy drive emulation.
|
||||
*
|
||||
* Version: @(#)fdd.c 1.0.9 2018/03/14
|
||||
* Version: @(#)fdd.c 1.0.5 2018/03/16
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -66,8 +86,9 @@ int fdc_indexcount = 52;
|
||||
|
||||
fdc_t *fdd_fdc;
|
||||
|
||||
d86f_handler_t d86f_handler[FDD_NUM];
|
||||
|
||||
static struct
|
||||
static const struct
|
||||
{
|
||||
wchar_t *ext;
|
||||
void (*load)(int drive, wchar_t *fn);
|
||||
@@ -150,7 +171,7 @@ int ui_writeprot[FDD_NUM] = {0, 0, 0, 0};
|
||||
#define FLAG_IGNORE_DENSEL 512
|
||||
#define FLAG_PS2 1024
|
||||
|
||||
static struct
|
||||
static const struct
|
||||
{
|
||||
int max_track;
|
||||
int flags;
|
||||
@@ -207,12 +228,12 @@ static struct
|
||||
|
||||
char *fdd_getname(int type)
|
||||
{
|
||||
return drive_types[type].name;
|
||||
return (char *)drive_types[type].name;
|
||||
}
|
||||
|
||||
char *fdd_get_internal_name(int type)
|
||||
{
|
||||
return drive_types[type].internal_name;
|
||||
return (char *)drive_types[type].internal_name;
|
||||
}
|
||||
|
||||
int fdd_get_from_internal_name(char *s)
|
||||
@@ -221,7 +242,7 @@ int fdd_get_from_internal_name(char *s)
|
||||
|
||||
while (strlen(drive_types[c].internal_name))
|
||||
{
|
||||
if (!strcmp(drive_types[c].internal_name, s))
|
||||
if (!strcmp((char *)drive_types[c].internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
@@ -433,6 +454,9 @@ void fdd_load(int drive, wchar_t *fn)
|
||||
int c = 0, size;
|
||||
wchar_t *p;
|
||||
FILE *f;
|
||||
|
||||
pclog("FDD: loading drive %d with '%ls'\n", drive, fn);
|
||||
|
||||
if (!fn) return;
|
||||
p = plat_get_extension(fn);
|
||||
if (!p) return;
|
||||
@@ -447,7 +471,7 @@ void fdd_load(int drive, wchar_t *fn)
|
||||
{
|
||||
driveloaders[drive] = c;
|
||||
memcpy(floppyfns[drive], fn, (wcslen(fn) << 1) + 2);
|
||||
d86f_initialize_linked_lists(drive);
|
||||
d86f_setup(drive);
|
||||
loaders[c].load(drive, floppyfns[drive]);
|
||||
drive_empty[drive] = 0;
|
||||
fdd_forced_seek(drive, 0);
|
||||
@@ -456,7 +480,7 @@ void fdd_load(int drive, wchar_t *fn)
|
||||
}
|
||||
c++;
|
||||
}
|
||||
pclog("Couldn't load %ls %s\n",fn,p);
|
||||
pclog("FDD: could not load '%ls' %s\n",fn,p);
|
||||
drive_empty[drive] = 1;
|
||||
fdd_set_head(drive, 0);
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
@@ -465,12 +489,13 @@ void fdd_load(int drive, wchar_t *fn)
|
||||
|
||||
void fdd_close(int drive)
|
||||
{
|
||||
pclog("FDD: closing drive %d\n", drive);
|
||||
|
||||
if (loaders[driveloaders[drive]].close) loaders[driveloaders[drive]].close(drive);
|
||||
drive_empty[drive] = 1;
|
||||
fdd_set_head(drive, 0);
|
||||
floppyfns[drive][0] = 0;
|
||||
d86f_destroy_linked_lists(drive, 0);
|
||||
d86f_destroy_linked_lists(drive, 1);
|
||||
d86f_destroy(drive);
|
||||
drives[drive].hole = NULL;
|
||||
drives[drive].poll = NULL;
|
||||
drives[drive].seek = NULL;
|
||||
@@ -526,18 +551,7 @@ double fdd_real_period(int drive)
|
||||
return (32.0 * dusec);
|
||||
}
|
||||
|
||||
#if defined(DEV_BRANCH) && defined(USE_MRTHOR)
|
||||
if (romset == ROM_MRTHOR)
|
||||
{
|
||||
return (ddbp * dusec) / 4.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (ddbp * dusec);
|
||||
}
|
||||
#else
|
||||
return (ddbp * dusec);
|
||||
#endif
|
||||
}
|
||||
|
||||
void fdd_poll(int drive)
|
||||
@@ -705,6 +719,7 @@ void fdd_init(void)
|
||||
d86f_init();
|
||||
td0_init();
|
||||
imd_init();
|
||||
json_init();
|
||||
|
||||
fdd_load(0, floppyfns[0]);
|
||||
fdd_load(1, floppyfns[1]);
|
||||
|
||||
271
src/floppy/fdd.h
271
src/floppy/fdd.h
@@ -1,34 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the floppy drive emulation.
|
||||
* Definitions for the floppy drive emulation.
|
||||
*
|
||||
* Version: @(#)fdd.h 1.0.5 2018/01/18
|
||||
* Version: @(#)fdd.h 1.0.3 2018/03/17
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FDD_H
|
||||
# define EMU_FDD_H
|
||||
|
||||
|
||||
#define FDD_NUM 4
|
||||
#define SEEK_RECALIBRATE -999
|
||||
#define FDD_NUM 4
|
||||
#define SEEK_RECALIBRATE -999
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int fdd_swap;
|
||||
extern int fdd_swap;
|
||||
|
||||
|
||||
extern void fdd_do_seek(int drive, int track);
|
||||
@@ -65,16 +85,19 @@ extern int fdd_current_track(int drive);
|
||||
|
||||
|
||||
typedef struct {
|
||||
void (*seek)(int drive, int track);
|
||||
void (*readsector)(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
void (*writesector)(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
void (*comparesector)(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
void (*readaddress)(int drive, int side, int density);
|
||||
void (*format)(int drive, int side, int density, uint8_t fill);
|
||||
int (*hole)(int drive);
|
||||
double (*byteperiod)(int drive);
|
||||
void (*stop)(int drive);
|
||||
void (*poll)(int drive);
|
||||
void (*seek)(int drive, int track);
|
||||
void (*readsector)(int drive, int sector, int track, int side,
|
||||
int density, int sector_size);
|
||||
void (*writesector)(int drive, int sector, int track, int side,
|
||||
int density, int sector_size);
|
||||
void (*comparesector)(int drive, int sector, int track, int side,
|
||||
int density, int sector_size);
|
||||
void (*readaddress)(int drive, int side, int density);
|
||||
void (*format)(int drive, int side, int density, uint8_t fill);
|
||||
int (*hole)(int drive);
|
||||
double (*byteperiod)(int drive);
|
||||
void (*stop)(int drive);
|
||||
void (*poll)(int drive);
|
||||
} DRIVE;
|
||||
|
||||
|
||||
@@ -115,60 +138,24 @@ extern void fdd_stop(int drive);
|
||||
extern int fdd_empty(int drive);
|
||||
extern void fdd_set_rate(int drive, int drvden, int rate);
|
||||
|
||||
extern int motorspin;
|
||||
extern int64_t motoron[FDD_NUM];
|
||||
extern int motorspin;
|
||||
extern int64_t motoron[FDD_NUM];
|
||||
|
||||
extern int swwp;
|
||||
extern int disable_write;
|
||||
extern int swwp;
|
||||
extern int disable_write;
|
||||
|
||||
extern int defaultwriteprot;
|
||||
extern int defaultwriteprot;
|
||||
|
||||
extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
|
||||
extern int fdd_cur_track[FDD_NUM];
|
||||
extern int fdd_changed[FDD_NUM];
|
||||
extern int drive_empty[FDD_NUM];
|
||||
extern int drive_type[FDD_NUM];
|
||||
extern int writeprot[FDD_NUM], fwriteprot[FDD_NUM];
|
||||
extern int fdd_cur_track[FDD_NUM];
|
||||
extern int fdd_changed[FDD_NUM];
|
||||
extern int drive_empty[FDD_NUM];
|
||||
extern int drive_type[FDD_NUM];
|
||||
|
||||
/*Used in the Read A Track command. Only valid for fdd_readsector(). */
|
||||
#define SECTOR_FIRST -2
|
||||
#define SECTOR_NEXT -1
|
||||
|
||||
#if 0
|
||||
/* Bits 0-3 define byte type, bit 5 defines whether it is a per-track (0) or per-sector (1) byte, if bit 7 is set, the byte is the index hole. */
|
||||
#define BYTE_GAP0 0x00
|
||||
#define BYTE_GAP1 0x10
|
||||
#define BYTE_GAP4 0x20
|
||||
#define BYTE_GAP2 0x40
|
||||
#define BYTE_GAP3 0x50
|
||||
#define BYTE_I_SYNC 0x01
|
||||
#define BYTE_ID_SYNC 0x41
|
||||
#define BYTE_DATA_SYNC 0x51
|
||||
#define BYTE_IAM_SYNC 0x02
|
||||
#define BYTE_IDAM_SYNC 0x42
|
||||
#define BYTE_DATAAM_SYNC 0x52
|
||||
#define BYTE_IAM 0x03
|
||||
#define BYTE_IDAM 0x43
|
||||
#define BYTE_DATAAM 0x53
|
||||
#define BYTE_ID 0x44
|
||||
#define BYTE_DATA 0x54
|
||||
#define BYTE_ID_CRC 0x45
|
||||
#define BYTE_DATA_CRC 0x55
|
||||
|
||||
#define BYTE_IS_FUZZY 0x80
|
||||
#define BYTE_INDEX_HOLE 0x80 /* 1 = index hole, 0 = regular byte */
|
||||
#define BYTE_IS_SECTOR 0x40 /* 1 = per-sector, 0 = per-track */
|
||||
#define BYTE_IS_POST_TRACK 0x20 /* 1 = after all sectors, 0 = before or during all sectors */
|
||||
#define BYTE_IS_DATA 0x10 /* 1 = data, 0 = id */
|
||||
#define BYTE_TYPE 0x0F /* 5 = crc, 4 = data, 3 = address mark, 2 = address mark sync, 1 = sync, 0 = gap */
|
||||
|
||||
#define BYTE_TYPE_GAP 0x00
|
||||
#define BYTE_TYPE_SYNC 0x01
|
||||
#define BYTE_TYPE_AM_SYNC 0x02
|
||||
#define BYTE_TYPE_AM 0x03
|
||||
#define BYTE_TYPE_DATA 0x04
|
||||
#define BYTE_TYPE_CRC 0x05
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
uint16_t word;
|
||||
uint8_t bytes[2];
|
||||
@@ -176,94 +163,92 @@ typedef union {
|
||||
|
||||
void fdd_calccrc(uint8_t byte, crc_t *crc_var);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t (*disk_flags)(int drive);
|
||||
uint16_t (*side_flags)(int drive);
|
||||
void (*writeback)(int drive);
|
||||
void (*set_sector)(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n);
|
||||
uint8_t (*read_data)(int drive, int side, uint16_t pos);
|
||||
void (*write_data)(int drive, int side, uint16_t pos, uint8_t data);
|
||||
int (*format_conditions)(int drive);
|
||||
int32_t (*extra_bit_cells)(int drive, int side);
|
||||
uint16_t* (*encoded_data)(int drive, int side);
|
||||
void (*read_revolution)(int drive);
|
||||
uint32_t (*index_hole_pos)(int drive, int side);
|
||||
uint32_t (*get_raw_size)(int drive, int side);
|
||||
uint8_t check_crc;
|
||||
typedef struct {
|
||||
uint16_t (*disk_flags)(int drive);
|
||||
uint16_t (*side_flags)(int drive);
|
||||
void (*writeback)(int drive);
|
||||
void (*set_sector)(int drive, int side, uint8_t c, uint8_t h,
|
||||
uint8_t r, uint8_t n);
|
||||
uint8_t (*read_data)(int drive, int side, uint16_t pos);
|
||||
void (*write_data)(int drive, int side, uint16_t pos,
|
||||
uint8_t data);
|
||||
int (*format_conditions)(int drive);
|
||||
int32_t (*extra_bit_cells)(int drive, int side);
|
||||
uint16_t* (*encoded_data)(int drive, int side);
|
||||
void (*read_revolution)(int drive);
|
||||
uint32_t (*index_hole_pos)(int drive, int side);
|
||||
uint32_t (*get_raw_size)(int drive, int side);
|
||||
|
||||
uint8_t check_crc;
|
||||
} d86f_handler_t;
|
||||
|
||||
d86f_handler_t d86f_handler[FDD_NUM];
|
||||
extern const int gap3_sizes[5][8][48];
|
||||
extern d86f_handler_t d86f_handler[FDD_NUM];
|
||||
|
||||
void d86f_common_handlers(int drive);
|
||||
extern void d86f_setup(int drive);
|
||||
extern void d86f_destroy(int drive);
|
||||
extern int d86f_export(int drive, wchar_t *fn);
|
||||
extern void d86f_unregister(int drive);
|
||||
extern void d86f_common_handlers(int drive);
|
||||
extern void d86f_set_version(int drive, uint16_t version);
|
||||
extern int d86f_is_40_track(int drive);
|
||||
extern void d86f_reset_index_hole_pos(int drive, int side);
|
||||
extern uint16_t d86f_prepare_pretrack(int drive, int side, int iso);
|
||||
extern uint16_t d86f_prepare_sector(int drive, int side, int prev_pos,
|
||||
uint8_t *id_buf, uint8_t *data_buf,
|
||||
int data_len, int gap2, int gap3,
|
||||
int deleted, int bad_crc);
|
||||
extern void d86f_set_track_pos(int drive, uint32_t track_pos);
|
||||
extern void d86f_set_cur_track(int drive, int track);
|
||||
extern void d86f_zero_track(int drive);
|
||||
extern void d86f_initialize_last_sector_id(int drive, int c, int h,
|
||||
int r, int n);
|
||||
extern void d86f_initialize_linked_lists(int drive);
|
||||
extern void d86f_destroy_linked_lists(int drive, int side);
|
||||
extern uint16_t *common_encoded_data(int drive, int side);
|
||||
extern void common_read_revolution(int drive);
|
||||
extern uint32_t common_get_raw_size(int drive, int side);
|
||||
extern void null_writeback(int drive);
|
||||
extern void null_write_data(int drive, int side, uint16_t pos,
|
||||
uint8_t data);
|
||||
extern int null_format_conditions(int drive);
|
||||
extern int32_t null_extra_bit_cells(int drive, int side);
|
||||
extern void null_set_sector(int drive, int side, uint8_t c, uint8_t h,
|
||||
uint8_t r, uint8_t n);
|
||||
extern uint32_t null_index_hole_pos(int drive, int side);
|
||||
|
||||
int d86f_is_40_track(int drive);
|
||||
extern const uint8_t dmf_r[21];
|
||||
extern const uint8_t xdf_physical_sectors[2][2];
|
||||
extern const uint8_t xdf_gap3_sizes[2][2];
|
||||
extern const uint16_t xdf_trackx_spos[2][8];
|
||||
|
||||
void d86f_reset_index_hole_pos(int drive, int side);
|
||||
|
||||
uint16_t d86f_prepare_pretrack(int drive, int side, int iso);
|
||||
uint16_t d86f_prepare_sector(int drive, int side, int prev_pos, uint8_t *id_buf, uint8_t *data_buf, int data_len, int gap2, int gap3, int deleted, int bad_crc);
|
||||
|
||||
extern int gap3_sizes[5][8][48];
|
||||
|
||||
void null_writeback(int drive);
|
||||
void null_write_data(int drive, int side, uint16_t pos, uint8_t data);
|
||||
int null_format_conditions(int drive);
|
||||
void d86f_unregister(int drive);
|
||||
|
||||
extern uint8_t dmf_r[21];
|
||||
extern uint8_t xdf_physical_sectors[2][2];
|
||||
extern uint8_t xdf_gap3_sizes[2][2];
|
||||
extern uint16_t xdf_trackx_spos[2][8];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
typedef struct {
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
} xdf_id_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint16_t word;
|
||||
xdf_id_t id;
|
||||
typedef union {
|
||||
uint16_t word;
|
||||
xdf_id_t id;
|
||||
} xdf_sector_t;
|
||||
|
||||
extern xdf_sector_t xdf_img_layout[2][2][46];
|
||||
extern xdf_sector_t xdf_disk_layout[2][2][38];
|
||||
extern const xdf_sector_t xdf_img_layout[2][2][46];
|
||||
extern const xdf_sector_t xdf_disk_layout[2][2][38];
|
||||
|
||||
uint32_t td0_get_raw_tsize(int side_flags, int slower_rpm);
|
||||
|
||||
void d86f_set_track_pos(int drive, uint32_t track_pos);
|
||||
|
||||
int32_t null_extra_bit_cells(int drive, int side);
|
||||
uint16_t* common_encoded_data(int drive, int side);
|
||||
|
||||
void common_read_revolution(int drive);
|
||||
void null_set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n);
|
||||
|
||||
uint32_t null_index_hole_pos(int drive, int side);
|
||||
|
||||
uint32_t common_get_raw_size(int drive, int side);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t c;
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
uint8_t n;
|
||||
typedef struct {
|
||||
uint8_t c;
|
||||
uint8_t h;
|
||||
uint8_t r;
|
||||
uint8_t n;
|
||||
} sector_id_fields_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint32_t dword;
|
||||
uint8_t byte_array[4];
|
||||
sector_id_fields_t id;
|
||||
typedef union {
|
||||
uint32_t dword;
|
||||
uint8_t byte_array[4];
|
||||
sector_id_fields_t id;
|
||||
} sector_id_t;
|
||||
|
||||
void d86f_set_version(int drive, uint16_t version);
|
||||
|
||||
void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
|
||||
void d86f_destroy_linked_lists(int drive, int side);
|
||||
|
||||
void d86f_set_fdc(void *fdc);
|
||||
void fdi_set_fdc(void *fdc);
|
||||
@@ -271,10 +256,6 @@ void fdd_set_fdc(void *fdc);
|
||||
void imd_set_fdc(void *fdc);
|
||||
void img_set_fdc(void *fdc);
|
||||
|
||||
extern void d86f_set_cur_track(int drive, int track);
|
||||
extern void d86f_zero_track(int drive);
|
||||
|
||||
extern int d86f_export(int drive, wchar_t *fn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
6932
src/floppy/fdd_86f.c
6932
src/floppy/fdd_86f.c
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,46 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the 86F floppy image format (stores the
|
||||
* data in the form of FM/MFM-encoded transitions) which also
|
||||
* forms the core of the emulator's floppy disk emulation.
|
||||
* Definitions for the 86F floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_86f.h 1.0.5 2018/03/14
|
||||
* Version: @(#)floppy_86f.h 1.0.4 2018/03/17
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_86F_H
|
||||
# define EMU_FLOPPY_86F_H
|
||||
|
||||
|
||||
#define D86FVER 0x020B
|
||||
|
||||
|
||||
extern void d86f_init(void);
|
||||
extern void d86f_load(int drive, wchar_t *fn);
|
||||
extern void d86f_close(int drive);
|
||||
@@ -39,6 +61,10 @@ extern void d86f_prepare_track_layout(int drive, int side);
|
||||
extern void d86f_set_version(int drive, uint16_t version);
|
||||
extern uint16_t d86f_side_flags(int drive);
|
||||
extern uint16_t d86f_track_flags(int drive);
|
||||
extern void d86f_initialize_last_sector_id(int drive, int c, int h,
|
||||
int r, int n);
|
||||
extern void d86f_initialize_linked_lists(int drive);
|
||||
extern void d86f_destroy_linked_lists(int drive, int side);
|
||||
|
||||
#define length_gap0 80
|
||||
#define length_gap1 50
|
||||
@@ -59,19 +85,5 @@ extern uint16_t d86f_track_flags(int drive);
|
||||
#define pre_data length_sync + length_am
|
||||
#define post_gap length_crc
|
||||
|
||||
#if 0
|
||||
extern int raw_tsize[2];
|
||||
extern int gap2_size[2];
|
||||
extern int gap3_size[2];
|
||||
extern int gap4_size[2];
|
||||
#endif
|
||||
|
||||
#define D86FVER 0x020B
|
||||
|
||||
extern void d86f_initialize_last_sector_id(int drive, int c, int h, int r, int n);
|
||||
|
||||
extern void d86f_initialize_linked_lists(int drive);
|
||||
extern void d86f_destroy_linked_lists(int drive, int side);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_86F_H*/
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Shared code for all the floppy modules.
|
||||
*
|
||||
* Version: @(#)fdd_common.c 1.0.5 2018/01/16
|
||||
* Version: @(#)fdd_common.c 1.0.2 2018/03/16
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -23,11 +42,11 @@
|
||||
#include "fdd_common.h"
|
||||
|
||||
|
||||
uint8_t fdd_holes[6] = { 0, 0, 0, 1, 1, 2 };
|
||||
const uint8_t fdd_holes[6] = { 0, 0, 0, 1, 1, 2 };
|
||||
|
||||
uint8_t fdd_rates[6] = { 2, 2, 1, 4, 0, 3 };
|
||||
const uint8_t fdd_rates[6] = { 2, 2, 1, 4, 0, 3 };
|
||||
|
||||
double fdd_bit_rates_300[6] = {
|
||||
const double fdd_bit_rates_300[6] = {
|
||||
(250.0 * 300.0) / 360.0,
|
||||
250.0,
|
||||
300.0,
|
||||
@@ -46,7 +65,7 @@ double fdd_bit_rates_300[6] = {
|
||||
* Disks formatted at 300 kbps @ 300 RPM can be read with any 300 RPM
|
||||
* single-RPM drive by setting the rate to 300 kbps.
|
||||
*/
|
||||
uint8_t fdd_max_sectors[8][6] = {
|
||||
const uint8_t fdd_max_sectors[8][6] = {
|
||||
{ 26, 31, 38, 53, 64, 118 }, /* 128 */
|
||||
{ 15, 19, 23, 32, 38, 73 }, /* 256 */
|
||||
{ 7, 10, 12, 17, 22, 41 }, /* 512 */
|
||||
@@ -57,12 +76,12 @@ uint8_t fdd_max_sectors[8][6] = {
|
||||
{ 0, 0, 0, 0, 0, 1 } /* 16384 */
|
||||
};
|
||||
|
||||
uint8_t fdd_dmf_r[21] = {
|
||||
const uint8_t fdd_dmf_r[21] = {
|
||||
12,2,13,3,14,4,15,5,16,6,17,7,18,8,19,9,20,10,21,11,1
|
||||
};
|
||||
|
||||
|
||||
static uint8_t fdd_gap3_sizes[5][8][48] = {
|
||||
static const uint8_t fdd_gap3_sizes[5][8][48] = {
|
||||
{ { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* [0][0] */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
@@ -346,7 +365,6 @@ static uint8_t fdd_gap3_sizes[5][8][48] = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
int
|
||||
fdd_get_gap3_size(int rate, int size, int sector)
|
||||
{
|
||||
|
||||
@@ -1,27 +1,46 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Shared code for all the floppy modules.
|
||||
*
|
||||
* Version: @(#)fdd_common.h 1.0.2 2018/01/16
|
||||
* Version: @(#)fdd_common.h 1.0.2 2018/03/16
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef fdd_COMMON_H
|
||||
# define fdd_COMMON_H
|
||||
#ifndef FDD_COMMON_H
|
||||
# define FDD_COMMON_H
|
||||
|
||||
|
||||
extern uint8_t fdd_holes[6];
|
||||
extern uint8_t fdd_rates[6];
|
||||
extern double fdd_bit_rates_300[6];
|
||||
extern uint8_t fdd_max_sectors[8][6];
|
||||
extern uint8_t fdd_dmf_r[21];
|
||||
extern const uint8_t fdd_holes[6];
|
||||
extern const uint8_t fdd_rates[6];
|
||||
extern const double fdd_bit_rates_300[6];
|
||||
extern const uint8_t fdd_max_sectors[8][6];
|
||||
extern const uint8_t fdd_dmf_r[21];
|
||||
|
||||
|
||||
extern int fdd_get_gap3_size(int rate, int size, int sector);
|
||||
@@ -31,4 +50,4 @@ extern int fdd_bps_valid(uint16_t bps);
|
||||
extern int fdd_interleave(int sector, int skew, int spt);
|
||||
|
||||
|
||||
#endif /*fdd_COMMON_H*/
|
||||
#endif /*FDD_COMMON_H*/
|
||||
|
||||
@@ -1,25 +1,46 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the FDI floppy stream image format
|
||||
* interface to the FDI2RAW module.
|
||||
*
|
||||
* Version: @(#)fdd_fdi.c 1.0.7 2018/01/16
|
||||
* Version: @(#)fdd_fdi.c 1.0.2 2018/03/17
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include "../86box.h"
|
||||
#include "../plat.h"
|
||||
@@ -31,317 +52,355 @@
|
||||
#include "fdi2raw.h"
|
||||
|
||||
|
||||
static struct
|
||||
typedef struct {
|
||||
FILE *f;
|
||||
FDI *h;
|
||||
|
||||
int lasttrack;
|
||||
int sides;
|
||||
int track;
|
||||
int tracklen[2][4];
|
||||
int trackindex[2][4];
|
||||
|
||||
uint8_t track_data[2][4][256*1024];
|
||||
uint8_t track_timing[2][4][256*1024];
|
||||
} fdi_t;
|
||||
|
||||
|
||||
static fdi_t *fdi[FDD_NUM];
|
||||
static fdc_t *fdi_fdc;
|
||||
|
||||
|
||||
static uint16_t
|
||||
disk_flags(int drive)
|
||||
{
|
||||
FILE *f;
|
||||
FDI *h;
|
||||
uint8_t track_data[2][4][256*1024];
|
||||
uint8_t track_timing[2][4][256*1024];
|
||||
|
||||
int sides;
|
||||
int track;
|
||||
int tracklen[2][4];
|
||||
int trackindex[2][4];
|
||||
|
||||
int lasttrack;
|
||||
} fdi[FDD_NUM];
|
||||
fdi_t *dev = fdi[drive];
|
||||
uint16_t temp_disk_flags = 0x80; /* We ALWAYS claim to have extra bit cells, even if the actual amount is 0. */
|
||||
|
||||
static fdc_t *fdi_fdc;
|
||||
switch (fdi2raw_get_bit_rate(dev->h)) {
|
||||
case 500:
|
||||
temp_disk_flags |= 2;
|
||||
break;
|
||||
|
||||
uint16_t fdi_disk_flags(int drive)
|
||||
{
|
||||
uint16_t temp_disk_flags = 0x80; /* We ALWAYS claim to have extra bit cells, even if the actual amount is 0. */
|
||||
case 300:
|
||||
case 250:
|
||||
temp_disk_flags |= 0;
|
||||
break;
|
||||
|
||||
switch (fdi2raw_get_bit_rate(fdi[drive].h))
|
||||
{
|
||||
case 500:
|
||||
temp_disk_flags |= 2;
|
||||
break;
|
||||
case 300:
|
||||
case 250:
|
||||
temp_disk_flags |= 0;
|
||||
break;
|
||||
case 1000:
|
||||
temp_disk_flags |= 4;
|
||||
break;
|
||||
default:
|
||||
temp_disk_flags |= 0;
|
||||
}
|
||||
case 1000:
|
||||
temp_disk_flags |= 4;
|
||||
break;
|
||||
|
||||
if (fdi[drive].sides == 2)
|
||||
{
|
||||
temp_disk_flags |= 8;
|
||||
}
|
||||
default:
|
||||
temp_disk_flags |= 0;
|
||||
}
|
||||
|
||||
/* Tell the 86F handler that will handle our data to handle it in reverse byte endianness. */
|
||||
temp_disk_flags |= 0x800;
|
||||
if (dev->sides == 2)
|
||||
temp_disk_flags |= 8;
|
||||
|
||||
return temp_disk_flags;
|
||||
/*
|
||||
* Tell the 86F handler that we will handle our
|
||||
* data to handle it in reverse byte endianness.
|
||||
*/
|
||||
temp_disk_flags |= 0x800;
|
||||
|
||||
return(temp_disk_flags);
|
||||
}
|
||||
|
||||
uint16_t fdi_side_flags(int drive)
|
||||
|
||||
static uint16_t
|
||||
side_flags(int drive)
|
||||
{
|
||||
uint16_t temp_side_flags = 0;
|
||||
switch (fdi2raw_get_bit_rate(fdi[drive].h))
|
||||
{
|
||||
case 500:
|
||||
temp_side_flags = 0;
|
||||
break;
|
||||
case 300:
|
||||
temp_side_flags = 1;
|
||||
break;
|
||||
case 250:
|
||||
temp_side_flags = 2;
|
||||
break;
|
||||
case 1000:
|
||||
temp_side_flags = 3;
|
||||
break;
|
||||
default:
|
||||
temp_side_flags = 2;
|
||||
}
|
||||
if (fdi2raw_get_rotation(fdi[drive].h) == 360)
|
||||
{
|
||||
temp_side_flags |= 0x20;
|
||||
}
|
||||
fdi_t *dev = fdi[drive];
|
||||
uint16_t temp_side_flags = 0;
|
||||
|
||||
/* Set the encoding value to match that provided by the FDC. Then if it's wrong, it will sector not found anyway. */
|
||||
temp_side_flags |= 0x08;
|
||||
switch (fdi2raw_get_bit_rate(dev->h)) {
|
||||
case 500:
|
||||
temp_side_flags = 0;
|
||||
break;
|
||||
|
||||
return temp_side_flags;
|
||||
case 300:
|
||||
temp_side_flags = 1;
|
||||
break;
|
||||
|
||||
case 250:
|
||||
temp_side_flags = 2;
|
||||
break;
|
||||
|
||||
case 1000:
|
||||
temp_side_flags = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
temp_side_flags = 2;
|
||||
}
|
||||
|
||||
if (fdi2raw_get_rotation(dev->h) == 360)
|
||||
temp_side_flags |= 0x20;
|
||||
|
||||
/*
|
||||
* Set the encoding value to match that provided by the FDC.
|
||||
* Then if it's wrong, it will sector not found anyway.
|
||||
*/
|
||||
temp_side_flags |= 0x08;
|
||||
|
||||
return(temp_side_flags);
|
||||
}
|
||||
|
||||
int fdi_density()
|
||||
{
|
||||
if (!fdc_is_mfm(fdi_fdc))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (fdc_get_bit_rate(fdi_fdc))
|
||||
{
|
||||
case 0:
|
||||
return 2;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
case 5:
|
||||
return 3;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
static int
|
||||
fdi_density(void)
|
||||
{
|
||||
if (! fdc_is_mfm(fdi_fdc)) return(0);
|
||||
|
||||
switch (fdc_get_bit_rate(fdi_fdc)) {
|
||||
case 0:
|
||||
return(2);
|
||||
|
||||
case 1:
|
||||
return(1);
|
||||
|
||||
case 2:
|
||||
return(1);
|
||||
|
||||
case 3:
|
||||
case 5:
|
||||
return(3);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int32_t fdi_extra_bit_cells(int drive, int side)
|
||||
|
||||
static int32_t
|
||||
extra_bit_cells(int drive, int side)
|
||||
{
|
||||
int density = 0;
|
||||
fdi_t *dev = fdi[drive];
|
||||
int density = 0;
|
||||
int raw_size = 0;
|
||||
int is_300_rpm = 0;
|
||||
|
||||
int raw_size = 0;
|
||||
density = fdi_density();
|
||||
|
||||
int is_300_rpm = 0;
|
||||
is_300_rpm = (fdd_getrpm(drive) == 300);
|
||||
|
||||
density = fdi_density();
|
||||
switch (fdc_get_bit_rate(fdi_fdc)) {
|
||||
case 0:
|
||||
raw_size = is_300_rpm ? 200000 : 166666;
|
||||
break;
|
||||
|
||||
is_300_rpm = (fdd_getrpm(drive) == 300);
|
||||
case 1:
|
||||
raw_size = is_300_rpm ? 120000 : 100000;
|
||||
break;
|
||||
|
||||
switch (fdc_get_bit_rate(fdi_fdc))
|
||||
{
|
||||
case 0:
|
||||
raw_size = is_300_rpm ? 200000 : 166666;
|
||||
break;
|
||||
case 1:
|
||||
raw_size = is_300_rpm ? 120000 : 100000;
|
||||
break;
|
||||
case 2:
|
||||
raw_size = is_300_rpm ? 100000 : 83333;
|
||||
case 3:
|
||||
case 5:
|
||||
raw_size = is_300_rpm ? 400000 : 333333;
|
||||
break;
|
||||
default:
|
||||
raw_size = is_300_rpm ? 100000 : 83333;
|
||||
case 2:
|
||||
raw_size = is_300_rpm ? 100000 : 83333;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 5:
|
||||
raw_size = is_300_rpm ? 400000 : 333333;
|
||||
break;
|
||||
|
||||
default:
|
||||
raw_size = is_300_rpm ? 100000 : 83333;
|
||||
}
|
||||
|
||||
return((dev->tracklen[side][density] - raw_size));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_revolution(int drive)
|
||||
{
|
||||
fdi_t *dev = fdi[drive];
|
||||
int c, den, side;
|
||||
int track = dev->track;
|
||||
|
||||
if (track > dev->lasttrack) {
|
||||
for (den = 0; den < 4; den++) {
|
||||
memset(dev->track_data[0][den], 0, 106096);
|
||||
memset(dev->track_data[1][den], 0, 106096);
|
||||
dev->tracklen[0][den] = dev->tracklen[1][den] = 100000;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (den = 0; den < 4; den++) {
|
||||
for (side = 0; side < dev->sides; side++) {
|
||||
c = fdi2raw_loadtrack(dev->h,
|
||||
(uint16_t *)dev->track_data[side][den],
|
||||
(uint16_t *)dev->track_timing[side][den],
|
||||
(track * dev->sides) + side,
|
||||
&dev->tracklen[side][den],
|
||||
&dev->trackindex[side][den], NULL, den);
|
||||
if (! c)
|
||||
memset(dev->track_data[side][den], 0, dev->tracklen[side][den]);
|
||||
}
|
||||
|
||||
return (fdi[drive].tracklen[side][density] - raw_size);
|
||||
}
|
||||
|
||||
int fdi_hole(int drive)
|
||||
{
|
||||
switch (fdi2raw_get_bit_rate(fdi[drive].h))
|
||||
{
|
||||
case 1000:
|
||||
return 2;
|
||||
case 500:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
if (dev->sides == 1) {
|
||||
memset(dev->track_data[1][den], 0, 106096);
|
||||
dev->tracklen[1][den] = 100000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fdi_read_revolution(int drive)
|
||||
|
||||
static uint32_t
|
||||
index_hole_pos(int drive, int side)
|
||||
{
|
||||
int density;
|
||||
int track = fdi[drive].track;
|
||||
fdi_t *dev = fdi[drive];
|
||||
int density;
|
||||
|
||||
int side = 0;
|
||||
density = fdi_density();
|
||||
|
||||
if (track > fdi[drive].lasttrack)
|
||||
{
|
||||
for (density = 0; density < 4; density++)
|
||||
{
|
||||
memset(fdi[drive].track_data[0][density], 0, 106096);
|
||||
memset(fdi[drive].track_data[1][density], 0, 106096);
|
||||
fdi[drive].tracklen[0][density] = fdi[drive].tracklen[1][density] = 100000;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (density = 0; density < 4; density++)
|
||||
{
|
||||
for (side = 0; side < fdi[drive].sides; side++)
|
||||
{
|
||||
int c = fdi2raw_loadtrack(fdi[drive].h, (uint16_t *)fdi[drive].track_data[side][density],
|
||||
(uint16_t *)fdi[drive].track_timing[side][density],
|
||||
(track * fdi[drive].sides) + side,
|
||||
&fdi[drive].tracklen[side][density],
|
||||
&fdi[drive].trackindex[side][density], NULL, density);
|
||||
if (!c)
|
||||
memset(fdi[drive].track_data[side][density], 0, fdi[drive].tracklen[side][density]);
|
||||
}
|
||||
|
||||
if (fdi[drive].sides == 1)
|
||||
{
|
||||
memset(fdi[drive].track_data[1][density], 0, 106096);
|
||||
fdi[drive].tracklen[1][density] = 100000;
|
||||
}
|
||||
}
|
||||
return(dev->trackindex[side][density]);
|
||||
}
|
||||
|
||||
uint32_t fdi_index_hole_pos(int drive, int side)
|
||||
|
||||
static uint32_t
|
||||
get_raw_size(int drive, int side)
|
||||
{
|
||||
int density;
|
||||
fdi_t *dev = fdi[drive];
|
||||
int density;
|
||||
|
||||
density = fdi_density();
|
||||
density = fdi_density();
|
||||
|
||||
return fdi[drive].trackindex[side][density];
|
||||
return(dev->tracklen[side][density]);
|
||||
}
|
||||
|
||||
uint32_t fdi_get_raw_size(int drive, int side)
|
||||
|
||||
static uint16_t *
|
||||
encoded_data(int drive, int side)
|
||||
{
|
||||
int density;
|
||||
fdi_t *dev = fdi[drive];
|
||||
int density = 0;
|
||||
|
||||
density = fdi_density();
|
||||
density = fdi_density();
|
||||
|
||||
return fdi[drive].tracklen[side][density];
|
||||
return((uint16_t *)dev->track_data[side][density]);
|
||||
}
|
||||
|
||||
uint16_t* fdi_encoded_data(int drive, int side)
|
||||
|
||||
void
|
||||
fdi_seek(int drive, int track)
|
||||
{
|
||||
int density = 0;
|
||||
fdi_t *dev = fdi[drive];
|
||||
|
||||
density = fdi_density();
|
||||
if (fdd_doublestep_40(drive)) {
|
||||
if (fdi2raw_get_tpi(dev->h) < 2)
|
||||
track /= 2;
|
||||
}
|
||||
|
||||
return (uint16_t *)fdi[drive].track_data[side][density];
|
||||
}
|
||||
d86f_set_cur_track(drive, track);
|
||||
|
||||
void d86f_register_fdi(int drive)
|
||||
{
|
||||
d86f_handler[drive].disk_flags = fdi_disk_flags;
|
||||
d86f_handler[drive].side_flags = fdi_side_flags;
|
||||
d86f_handler[drive].writeback = null_writeback;
|
||||
d86f_handler[drive].set_sector = null_set_sector;
|
||||
d86f_handler[drive].write_data = null_write_data;
|
||||
d86f_handler[drive].format_conditions = null_format_conditions;
|
||||
d86f_handler[drive].extra_bit_cells = fdi_extra_bit_cells;
|
||||
d86f_handler[drive].encoded_data = fdi_encoded_data;
|
||||
d86f_handler[drive].read_revolution = fdi_read_revolution;
|
||||
d86f_handler[drive].index_hole_pos = fdi_index_hole_pos;
|
||||
d86f_handler[drive].get_raw_size = fdi_get_raw_size;
|
||||
d86f_handler[drive].check_crc = 1;
|
||||
d86f_set_version(drive, D86FVER);
|
||||
}
|
||||
if (dev->f == NULL) return;
|
||||
|
||||
void fdi_load(int drive, wchar_t *fn)
|
||||
{
|
||||
char header[26];
|
||||
|
||||
writeprot[drive] = fwriteprot[drive] = 1;
|
||||
fdi[drive].f = plat_fopen(fn, L"rb");
|
||||
if (!fdi[drive].f)
|
||||
{
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
d86f_unregister(drive);
|
||||
|
||||
fread(header, 1, 25, fdi[drive].f);
|
||||
fseek(fdi[drive].f, 0, SEEK_SET);
|
||||
header[25] = 0;
|
||||
if (strcmp(header, "Formatted Disk Image file") != 0)
|
||||
{
|
||||
/* This is a Japanese FDI file. */
|
||||
pclog("fdi_load(): Japanese FDI file detected, redirecting to IMG loader\n");
|
||||
fclose(fdi[drive].f);
|
||||
fdi[drive].f = NULL;
|
||||
img_load(drive, fn);
|
||||
return;
|
||||
}
|
||||
|
||||
fdi[drive].h = fdi2raw_header(fdi[drive].f);
|
||||
fdi[drive].lasttrack = fdi2raw_get_last_track(fdi[drive].h);
|
||||
fdi[drive].sides = fdi2raw_get_last_head(fdi[drive].h) + 1;
|
||||
|
||||
d86f_register_fdi(drive);
|
||||
|
||||
drives[drive].seek = fdi_seek;
|
||||
d86f_common_handlers(drive);
|
||||
|
||||
pclog("Loaded as FDI\n");
|
||||
}
|
||||
|
||||
void fdi_close(int drive)
|
||||
{
|
||||
d86f_unregister(drive);
|
||||
drives[drive].seek = NULL;
|
||||
if (fdi[drive].h)
|
||||
fdi2raw_header_free(fdi[drive].h);
|
||||
if (fdi[drive].f)
|
||||
{
|
||||
fclose(fdi[drive].f);
|
||||
fdi[drive].f = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void fdi_seek(int drive, int track)
|
||||
{
|
||||
if (fdd_doublestep_40(drive))
|
||||
{
|
||||
if (fdi2raw_get_tpi(fdi[drive].h) < 2)
|
||||
{
|
||||
track /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
d86f_set_cur_track(drive, track);
|
||||
|
||||
if (!fdi[drive].f)
|
||||
return;
|
||||
if (track < 0)
|
||||
track = 0;
|
||||
if (track < 0)
|
||||
track = 0;
|
||||
|
||||
#if 0
|
||||
if (track > fdi[drive].lasttrack)
|
||||
track = fdi[drive].lasttrack - 1;
|
||||
if (track > dev->lasttrack)
|
||||
track = dev->lasttrack - 1;
|
||||
#endif
|
||||
|
||||
fdi[drive].track = track;
|
||||
dev->track = track;
|
||||
|
||||
fdi_read_revolution(drive);
|
||||
read_revolution(drive);
|
||||
}
|
||||
|
||||
void fdi_set_fdc(void *fdc)
|
||||
|
||||
void
|
||||
fdi_load(int drive, wchar_t *fn)
|
||||
{
|
||||
fdi_fdc = (fdc_t *) fdc;
|
||||
char header[26];
|
||||
fdi_t *dev;
|
||||
|
||||
writeprot[drive] = fwriteprot[drive] = 1;
|
||||
|
||||
/* Allocate a drive block. */
|
||||
dev = (fdi_t *)malloc(sizeof(fdi_t));
|
||||
memset(dev, 0x00, sizeof(fdi_t));
|
||||
|
||||
dev->f = plat_fopen(fn, L"rb");
|
||||
if (dev == NULL) {
|
||||
free(dev);
|
||||
memset(floppyfns[drive], 0, sizeof(floppyfns[drive]));
|
||||
return;
|
||||
}
|
||||
|
||||
d86f_unregister(drive);
|
||||
|
||||
fread(header, 1, 25, dev->f);
|
||||
fseek(dev->f, 0, SEEK_SET);
|
||||
header[25] = 0;
|
||||
if (strcmp(header, "Formatted Disk Image file") != 0) {
|
||||
/* This is a Japanese FDI file. */
|
||||
pclog("fdi_load(): Japanese FDI file detected, redirecting to IMG loader\n");
|
||||
fclose(dev->f);
|
||||
free(dev);
|
||||
img_load(drive, fn);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set up the drive unit. */
|
||||
fdi[drive] = dev;
|
||||
|
||||
dev->h = fdi2raw_header(dev->f);
|
||||
dev->lasttrack = fdi2raw_get_last_track(dev->h);
|
||||
dev->sides = fdi2raw_get_last_head(dev->h) + 1;
|
||||
|
||||
/* Attach this format to the D86F engine. */
|
||||
d86f_handler[drive].disk_flags = disk_flags;
|
||||
d86f_handler[drive].side_flags = side_flags;
|
||||
d86f_handler[drive].writeback = null_writeback;
|
||||
d86f_handler[drive].set_sector = null_set_sector;
|
||||
d86f_handler[drive].write_data = null_write_data;
|
||||
d86f_handler[drive].format_conditions = null_format_conditions;
|
||||
d86f_handler[drive].extra_bit_cells = extra_bit_cells;
|
||||
d86f_handler[drive].encoded_data = encoded_data;
|
||||
d86f_handler[drive].read_revolution = read_revolution;
|
||||
d86f_handler[drive].index_hole_pos = index_hole_pos;
|
||||
d86f_handler[drive].get_raw_size = get_raw_size;
|
||||
d86f_handler[drive].check_crc = 1;
|
||||
d86f_set_version(drive, D86FVER);
|
||||
|
||||
d86f_common_handlers(drive);
|
||||
|
||||
drives[drive].seek = fdi_seek;
|
||||
|
||||
pclog("Loaded as FDI\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fdi_close(int drive)
|
||||
{
|
||||
fdi_t *dev = fdi[drive];
|
||||
|
||||
if (dev == NULL) return;
|
||||
|
||||
d86f_unregister(drive);
|
||||
|
||||
drives[drive].seek = NULL;
|
||||
|
||||
if (dev->h)
|
||||
fdi2raw_header_free(dev->h);
|
||||
|
||||
if (dev->f)
|
||||
fclose(dev->f);
|
||||
|
||||
/* Release the memory. */
|
||||
free(dev);
|
||||
fdi[drive] = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fdi_set_fdc(void *fdc)
|
||||
{
|
||||
fdi_fdc = (fdc_t *)fdc;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,49 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the FDI floppy stream image format
|
||||
* interface to the FDI2RAW module.
|
||||
*
|
||||
* Version: @(#)floppy_fdi.h 1.0.3 2017/12/14
|
||||
* Version: @(#)floppy_fdi.h 1.0.2 2018/03/17
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_FDI_H
|
||||
# define EMU_FLOPPY_FDI_H
|
||||
|
||||
|
||||
extern void fdi_load(int drive, wchar_t *fn);
|
||||
extern void fdi_close(int drive);
|
||||
extern void fdi_seek(int drive, int track);
|
||||
extern void fdi_readsector(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
extern void fdi_writesector(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
extern void fdi_comparesector(int drive, int sector, int track, int side, int density, int sector_size);
|
||||
extern void fdi_readaddress(int drive, int sector, int side, int density);
|
||||
extern void fdi_format(int drive, int sector, int side, int density, uint8_t fill);
|
||||
extern int fdi_hole(int drive);
|
||||
extern double fdi_byteperiod(int drive);
|
||||
extern void fdi_stop(void);
|
||||
extern void fdi_poll(void);
|
||||
extern void fdi_seek(int drive, int track);
|
||||
extern void fdi_load(int drive, wchar_t *fn);
|
||||
extern void fdi_close(int drive);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_FDI_H*/
|
||||
|
||||
1483
src/floppy/fdd_imd.c
1483
src/floppy/fdd_imd.c
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the IMD floppy image format.
|
||||
* Definitions for the IMD floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_imd.h 1.0.2 2017/09/03
|
||||
* Version: @(#)floppy_imd.h 1.0.2 2018/03/17
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_IMD_H
|
||||
# define EMU_FLOPPY_IMD_H
|
||||
@@ -20,7 +41,6 @@
|
||||
extern void imd_init(void);
|
||||
extern void imd_load(int drive, wchar_t *fn);
|
||||
extern void imd_close(int drive);
|
||||
extern void imd_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_IMD_H*/
|
||||
|
||||
1888
src/floppy/fdd_img.c
1888
src/floppy/fdd_img.c
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,49 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the raw sector-based floppy image format,
|
||||
* as well as the Japanese FDI, CopyQM, and FDF formats.
|
||||
*
|
||||
* Version: @(#)floppy_img.h 1.0.2 2017/09/03
|
||||
* Version: @(#)floppy_img.h 1.0.2 2018/03/17
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_IMG_H
|
||||
# define EMU_FLOPPY_IMG_H
|
||||
|
||||
|
||||
extern void img_init(void);
|
||||
extern void img_load(int drive, wchar_t *fn);
|
||||
extern void img_close(int drive);
|
||||
extern void img_seek(int drive, int track);
|
||||
extern void img_init(void);
|
||||
extern void img_load(int drive, wchar_t *fn);
|
||||
extern void img_close(int drive);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_IMG_H*/
|
||||
|
||||
@@ -1,18 +1,48 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the PCjs JSON floppy image format.
|
||||
*
|
||||
* Version: @(#)fdd_json.c 1.0.11 2018/03/14
|
||||
* Version: @(#)fdd_json.c 1.0.4 2018/03/17
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -71,11 +101,11 @@ typedef struct {
|
||||
} json_t;
|
||||
|
||||
|
||||
static json_t images[FDD_NUM];
|
||||
static json_t *images[FDD_NUM];
|
||||
|
||||
|
||||
static void
|
||||
handle(json_t *img, char *name, char *str)
|
||||
handle(json_t *dev, char *name, char *str)
|
||||
{
|
||||
sector_t *sec = NULL;
|
||||
uint32_t l, pat;
|
||||
@@ -84,7 +114,7 @@ handle(json_t *img, char *name, char *str)
|
||||
int i, s;
|
||||
|
||||
/* Point to the currently selected sector. */
|
||||
sec = &img->sects[img->track][img->side][img->dmf-1];
|
||||
sec = &dev->sects[dev->track][dev->side][dev->dmf-1];
|
||||
|
||||
/* If no name given, assume sector is done. */
|
||||
if (name == NULL) {
|
||||
@@ -98,8 +128,8 @@ handle(json_t *img, char *name, char *str)
|
||||
sec->size = fdd_sector_size_code(sec->size);
|
||||
|
||||
/* Set up the rest of the Sector ID. */
|
||||
sec->track = img->track;
|
||||
sec->side = img->side;
|
||||
sec->track = dev->track;
|
||||
sec->side = dev->side;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -159,13 +189,13 @@ unexpect(int c, int state, int level)
|
||||
|
||||
|
||||
static int
|
||||
load_image(json_t *img)
|
||||
load_image(json_t *dev)
|
||||
{
|
||||
char buff[4096], name[32];
|
||||
int c, i, j, state, level;
|
||||
char *ptr;
|
||||
|
||||
if (img->f == NULL) {
|
||||
if (dev->f == NULL) {
|
||||
pclog("JSON: no file loaded!\n");
|
||||
return(0);
|
||||
}
|
||||
@@ -173,17 +203,17 @@ load_image(json_t *img)
|
||||
/* Initialize. */
|
||||
for (i=0; i<NTRACKS; i++) {
|
||||
for (j=0; j<NSIDES; j++)
|
||||
memset(img->sects[i][j], 0x00, sizeof(sector_t));
|
||||
memset(dev->sects[i][j], 0x00, sizeof(sector_t));
|
||||
}
|
||||
img->track = img->side = img->dmf = 0; /* "dmf" is "sector#" */
|
||||
dev->track = dev->side = dev->dmf = 0; /* "dmf" is "sector#" */
|
||||
|
||||
/* Now run the state machine. */
|
||||
ptr = NULL;
|
||||
level = state = 0;
|
||||
while (state >= 0) {
|
||||
/* Get a character from the input. */
|
||||
c = fgetc(img->f);
|
||||
if ((c == EOF) || ferror(img->f)) {
|
||||
c = fgetc(dev->f);
|
||||
if ((c == EOF) || ferror(dev->f)) {
|
||||
state = -1;
|
||||
break;
|
||||
}
|
||||
@@ -191,7 +221,7 @@ load_image(json_t *img)
|
||||
/* Process it. */
|
||||
switch(state) {
|
||||
case 0: /* read level header */
|
||||
img->dmf = 1;
|
||||
dev->dmf = 1;
|
||||
if (c != '[') {
|
||||
state = unexpect(c, state, level);
|
||||
} else {
|
||||
@@ -239,7 +269,7 @@ load_image(json_t *img)
|
||||
case ',':
|
||||
case '}':
|
||||
*ptr = '\0';
|
||||
handle(img, name, buff);
|
||||
handle(dev, name, buff);
|
||||
|
||||
if (c == '}')
|
||||
state = 7; /* done */
|
||||
@@ -264,10 +294,10 @@ load_image(json_t *img)
|
||||
break;
|
||||
|
||||
case 7: /* sector done */
|
||||
handle(img, NULL, NULL);
|
||||
handle(dev, NULL, NULL);
|
||||
switch(c) {
|
||||
case ',': /* next sector */
|
||||
img->dmf++;
|
||||
dev->dmf++;
|
||||
state = 1;
|
||||
break;
|
||||
|
||||
@@ -297,14 +327,14 @@ load_image(json_t *img)
|
||||
default:
|
||||
state = unexpect(c, state, level);
|
||||
}
|
||||
img->spt[img->track][img->side] = img->dmf;
|
||||
img->side++;
|
||||
dev->spt[dev->track][dev->side] = dev->dmf;
|
||||
dev->side++;
|
||||
break;
|
||||
|
||||
case 9: /* track done */
|
||||
switch(c) {
|
||||
case ',': /* next track */
|
||||
img->side = 0;
|
||||
dev->side = 0;
|
||||
state = 0;
|
||||
break;
|
||||
|
||||
@@ -317,15 +347,15 @@ load_image(json_t *img)
|
||||
default:
|
||||
state = unexpect(c, state, level);
|
||||
}
|
||||
img->track++;
|
||||
dev->track++;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Save derived values. */
|
||||
img->tracks = img->track;
|
||||
img->sides = img->side;
|
||||
dev->tracks = dev->track;
|
||||
dev->sides = dev->side;
|
||||
|
||||
return(1);
|
||||
}
|
||||
@@ -336,69 +366,71 @@ static void
|
||||
json_seek(int drive, int track)
|
||||
{
|
||||
uint8_t id[4] = { 0,0,0,0 };
|
||||
json_t *img = &images[drive];
|
||||
json_t *dev = images[drive];
|
||||
int side, sector;
|
||||
int rate, gap2, gap3, pos;
|
||||
int ssize, rsec, asec;
|
||||
int interleave_type;
|
||||
|
||||
if (img->f == NULL) {
|
||||
if (dev->f == NULL) {
|
||||
pclog("JSON: seek: no file loaded!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Allow for doublestepping tracks. */
|
||||
if (! img->track_width && fdd_doublestep_40(drive)) track /= 2;
|
||||
if (! dev->track_width && fdd_doublestep_40(drive)) track /= 2;
|
||||
|
||||
/* Set the new track. */
|
||||
img->track = track;
|
||||
dev->track = track;
|
||||
d86f_set_cur_track(drive, track);
|
||||
|
||||
/* Reset the 86F state machine. */
|
||||
d86f_reset_index_hole_pos(drive, 0);
|
||||
d86f_reset_index_hole_pos(drive, 1);
|
||||
d86f_destroy_linked_lists(drive, 0);
|
||||
d86f_reset_index_hole_pos(drive, 1);
|
||||
d86f_destroy_linked_lists(drive, 1);
|
||||
|
||||
interleave_type = 0;
|
||||
|
||||
if (track > img->tracks) {
|
||||
if (track > dev->tracks) {
|
||||
d86f_zero_track(drive);
|
||||
return;
|
||||
}
|
||||
|
||||
for (side=0; side<img->sides; side++) {
|
||||
for (side=0; side<dev->sides; side++) {
|
||||
/* Get transfer rate for this side. */
|
||||
rate = img->track_flags & 0x07;
|
||||
if (!rate && (img->track_flags & 0x20)) rate = 4;
|
||||
rate = dev->track_flags & 0x07;
|
||||
if (!rate && (dev->track_flags & 0x20)) rate = 4;
|
||||
|
||||
/* Get correct GAP3 value for this side. */
|
||||
gap3 = fdd_get_gap3_size(rate,
|
||||
img->sects[track][side][0].size,
|
||||
img->spt[track][side]);
|
||||
dev->sects[track][side][0].size,
|
||||
dev->spt[track][side]);
|
||||
|
||||
/* Get correct GAP2 value for this side. */
|
||||
gap2 = ((img->track_flags & 0x07) >= 3) ? 41 : 22;
|
||||
gap2 = ((dev->track_flags & 0x07) >= 3) ? 41 : 22;
|
||||
|
||||
pos = d86f_prepare_pretrack(drive, side, 0);
|
||||
|
||||
for (sector=0; sector<img->spt[track][side]; sector++) {
|
||||
for (sector=0; sector<dev->spt[track][side]; sector++) {
|
||||
if (interleave_type == 0) {
|
||||
rsec = img->sects[track][side][sector].sector;
|
||||
rsec = dev->sects[track][side][sector].sector;
|
||||
asec = sector;
|
||||
} else {
|
||||
rsec = fdd_dmf_r[sector];
|
||||
asec = img->interleave_ordered[rsec][side];
|
||||
asec = dev->interleave_ordered[rsec][side];
|
||||
}
|
||||
id[0] = track;
|
||||
id[1] = side;
|
||||
id[2] = rsec;
|
||||
id[3] = img->sects[track][side][asec].size;
|
||||
ssize = fdd_sector_code_size(img->sects[track][side][asec].size);
|
||||
if (dev->sects[track][side][asec].size > 255)
|
||||
perror("fdd_json.c: json_seek: sector size too big.");
|
||||
id[3] = dev->sects[track][side][asec].size & 0xff;
|
||||
ssize = fdd_sector_code_size(dev->sects[track][side][asec].size & 0xff);
|
||||
|
||||
pos = d86f_prepare_sector(
|
||||
drive, side, pos, id,
|
||||
img->sects[track][side][asec].data,
|
||||
dev->sects[track][side][asec].data,
|
||||
ssize, gap2, gap3,
|
||||
0, /*deleted flag*/
|
||||
0 /*bad_crc flag*/
|
||||
@@ -414,38 +446,42 @@ json_seek(int drive, int track)
|
||||
static uint16_t
|
||||
disk_flags(int drive)
|
||||
{
|
||||
return(images[drive].disk_flags);
|
||||
json_t *dev = images[drive];
|
||||
|
||||
return(dev->disk_flags);
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
track_flags(int drive)
|
||||
{
|
||||
return(images[drive].track_flags);
|
||||
json_t *dev = images[drive];
|
||||
|
||||
return(dev->track_flags);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n)
|
||||
{
|
||||
json_t *img = &images[drive];
|
||||
json_t *dev = images[drive];
|
||||
int i;
|
||||
|
||||
img->sector[side] = 0;
|
||||
dev->sector[side] = 0;
|
||||
|
||||
/* Make sure we are on the desired track. */
|
||||
if (c != img->track) return;
|
||||
if (c != dev->track) return;
|
||||
|
||||
/* Set the desired side. */
|
||||
img->side = side;
|
||||
dev->side = side;
|
||||
|
||||
/* Now loop over all sector ID's on this side to find our sector. */
|
||||
for (i=0; i<img->spt[c][side]; i++) {
|
||||
if ((img->sects[img->track][side][i].track == c) &&
|
||||
(img->sects[img->track][side][i].side == h) &&
|
||||
(img->sects[img->track][side][i].sector == r) &&
|
||||
(img->sects[img->track][side][i].size == n)) {
|
||||
img->sector[side] = i;
|
||||
for (i=0; i<dev->spt[c][side]; i++) {
|
||||
if ((dev->sects[dev->track][side][i].track == c) &&
|
||||
(dev->sects[dev->track][side][i].side == h) &&
|
||||
(dev->sects[dev->track][side][i].sector == r) &&
|
||||
(dev->sects[dev->track][side][i].size == n)) {
|
||||
dev->sector[side] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -454,10 +490,10 @@ set_sector(int drive, int side, uint8_t c, uint8_t h, uint8_t r, uint8_t n)
|
||||
static uint8_t
|
||||
poll_read_data(int drive, int side, uint16_t pos)
|
||||
{
|
||||
json_t *img = &images[drive];
|
||||
uint8_t sec = img->sector[side];
|
||||
json_t *dev = images[drive];
|
||||
uint8_t sec = dev->sector[side];
|
||||
|
||||
return(img->sects[img->track][side][sec].data[pos]);
|
||||
return(dev->sects[dev->track][side][sec].data[pos]);
|
||||
}
|
||||
|
||||
|
||||
@@ -471,21 +507,23 @@ json_init(void)
|
||||
void
|
||||
json_load(int drive, wchar_t *fn)
|
||||
{
|
||||
json_t *img = &images[drive];
|
||||
sector_t *sec;
|
||||
double bit_rate;
|
||||
int temp_rate;
|
||||
sector_t *sec;
|
||||
json_t *dev;
|
||||
int i;
|
||||
|
||||
/* Just in case- remove ourselves from 86F. */
|
||||
d86f_unregister(drive);
|
||||
|
||||
/* Zap any old data. */
|
||||
memset(img, 0x00, sizeof(json_t));
|
||||
/* Allocate a drive block. */
|
||||
dev = (json_t *)malloc(sizeof(json_t));
|
||||
memset(dev, 0x00, sizeof(json_t));
|
||||
|
||||
/* Open the image file. */
|
||||
img->f = plat_fopen(fn, L"rb");
|
||||
if (img->f == NULL) {
|
||||
dev->f = plat_fopen(fn, L"rb");
|
||||
if (dev->f == NULL) {
|
||||
free(dev);
|
||||
memset(fn, 0x00, sizeof(wchar_t));
|
||||
return;
|
||||
}
|
||||
@@ -493,66 +531,70 @@ json_load(int drive, wchar_t *fn)
|
||||
/* Our images are always RO. */
|
||||
writeprot[drive] = 1;
|
||||
|
||||
/* Set up the drive unit. */
|
||||
images[drive] = dev;
|
||||
|
||||
/* Load all sectors from the image file. */
|
||||
if (! load_image(img)) {
|
||||
if (! load_image(dev)) {
|
||||
pclog("JSON: failed to initialize\n");
|
||||
(void)fclose(img->f);
|
||||
img->f = NULL;
|
||||
(void)fclose(dev->f);
|
||||
free(dev);
|
||||
images[drive] = NULL;
|
||||
memset(fn, 0x00, sizeof(wchar_t));
|
||||
return;
|
||||
}
|
||||
|
||||
pclog("JSON(%d): %ls (%i tracks, %i sides, %i sectors)\n",
|
||||
drive, fn, img->tracks, img->sides, img->spt[0][0]);
|
||||
drive, fn, dev->tracks, dev->sides, dev->spt[0][0]);
|
||||
|
||||
/*
|
||||
* If the image has more than 43 tracks, then
|
||||
* the tracks are thin (96 tpi).
|
||||
*/
|
||||
img->track_width = (img->tracks > 43) ? 1 : 0;
|
||||
dev->track_width = (dev->tracks > 43) ? 1 : 0;
|
||||
|
||||
/* If the image has 2 sides, mark it as such. */
|
||||
img->disk_flags = 0x00;
|
||||
if (img->sides == 2)
|
||||
img->disk_flags |= 0x08;
|
||||
dev->disk_flags = 0x00;
|
||||
if (dev->sides == 2)
|
||||
dev->disk_flags |= 0x08;
|
||||
|
||||
/* JSON files are always assumed to be MFM-encoded. */
|
||||
img->track_flags = 0x08;
|
||||
dev->track_flags = 0x08;
|
||||
|
||||
img->interleave = 0;
|
||||
dev->interleave = 0;
|
||||
#if 0
|
||||
img->skew = 0;
|
||||
dev->skew = 0;
|
||||
#endif
|
||||
|
||||
temp_rate = 0xff;
|
||||
sec = &img->sects[0][0][0];
|
||||
sec = &dev->sects[0][0][0];
|
||||
for (i=0; i<6; i++) {
|
||||
if (img->spt[0][0] > fdd_max_sectors[sec->size][i]) continue;
|
||||
if (dev->spt[0][0] > fdd_max_sectors[sec->size][i]) continue;
|
||||
|
||||
bit_rate = fdd_bit_rates_300[i];
|
||||
temp_rate = fdd_rates[i];
|
||||
img->disk_flags |= (fdd_holes[i] << 1);
|
||||
dev->disk_flags |= (fdd_holes[i] << 1);
|
||||
|
||||
if ((bit_rate == 500.0) && (img->spt[0][0] == 21) &&
|
||||
(sec->size == 2) && (img->tracks >= 80) &&
|
||||
(img->tracks <= 82) && (img->sides == 2)) {
|
||||
if ((bit_rate == 500.0) && (dev->spt[0][0] == 21) &&
|
||||
(sec->size == 2) && (dev->tracks >= 80) &&
|
||||
(dev->tracks <= 82) && (dev->sides == 2)) {
|
||||
/*
|
||||
* This is a DMF floppy, set the flag so
|
||||
* we know to interleave the sectors.
|
||||
*/
|
||||
img->dmf = 1;
|
||||
dev->dmf = 1;
|
||||
} else {
|
||||
if ((bit_rate == 500.0) && (img->spt[0][0] == 22) &&
|
||||
(sec->size == 2) && (img->tracks >= 80) &&
|
||||
(img->tracks <= 82) && (img->sides == 2)) {
|
||||
if ((bit_rate == 500.0) && (dev->spt[0][0] == 22) &&
|
||||
(sec->size == 2) && (dev->tracks >= 80) &&
|
||||
(dev->tracks <= 82) && (dev->sides == 2)) {
|
||||
/*
|
||||
* This is marked specially because of the
|
||||
* track flag (a RPM slow down is needed).
|
||||
*/
|
||||
img->interleave = 2;
|
||||
dev->interleave = 2;
|
||||
}
|
||||
|
||||
img->dmf = 0;
|
||||
dev->dmf = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -560,41 +602,44 @@ json_load(int drive, wchar_t *fn)
|
||||
|
||||
if (temp_rate == 0xff) {
|
||||
pclog("JSON: invalid image (temp_rate=0xff)\n");
|
||||
(void)fclose(img->f);
|
||||
img->f = NULL;
|
||||
(void)fclose(dev->f);
|
||||
dev->f = NULL;
|
||||
free(dev);
|
||||
images[drive] = NULL;
|
||||
memset(fn, 0x00, sizeof(wchar_t));
|
||||
return;
|
||||
}
|
||||
|
||||
if (img->interleave == 2) {
|
||||
img->interleave = 1;
|
||||
img->disk_flags |= 0x60;
|
||||
if (dev->interleave == 2) {
|
||||
dev->interleave = 1;
|
||||
dev->disk_flags |= 0x60;
|
||||
}
|
||||
|
||||
img->gap2_len = (temp_rate == 3) ? 41 : 22;
|
||||
if (img->dmf) {
|
||||
img->gap3_len = 8;
|
||||
} else {
|
||||
img->gap3_len = fdd_get_gap3_size(temp_rate,sec->size,img->spt[0][0]);
|
||||
}
|
||||
dev->gap2_len = (temp_rate == 3) ? 41 : 22;
|
||||
if (dev->dmf)
|
||||
dev->gap3_len = 8;
|
||||
else
|
||||
dev->gap3_len = fdd_get_gap3_size(temp_rate,sec->size,dev->spt[0][0]);
|
||||
|
||||
if (! img->gap3_len) {
|
||||
if (! dev->gap3_len) {
|
||||
pclog("JSON: image of unknown format was inserted into drive %c:!\n",
|
||||
'C'+drive);
|
||||
(void)fclose(img->f);
|
||||
img->f = NULL;
|
||||
(void)fclose(dev->f);
|
||||
dev->f = NULL;
|
||||
free(dev);
|
||||
images[drive] = NULL;
|
||||
memset(fn, 0x00, sizeof(wchar_t));
|
||||
return;
|
||||
}
|
||||
|
||||
img->track_flags |= (temp_rate & 0x03); /* data rate */
|
||||
dev->track_flags |= (temp_rate & 0x03); /* data rate */
|
||||
if (temp_rate & 0x04)
|
||||
img->track_flags |= 0x20; /* RPM */
|
||||
dev->track_flags |= 0x20; /* RPM */
|
||||
|
||||
pclog(" disk_flags: 0x%02x, track_flags: 0x%02x, GAP3 length: %i\n",
|
||||
img->disk_flags, img->track_flags, img->gap3_len);
|
||||
dev->disk_flags, dev->track_flags, dev->gap3_len);
|
||||
pclog(" bit rate 300: %.2f, temporary rate: %i, hole: %i, DMF: %i\n",
|
||||
bit_rate, temp_rate, (img->disk_flags >> 1), img->dmf);
|
||||
bit_rate, temp_rate, (dev->disk_flags >> 1), dev->dmf);
|
||||
|
||||
/* Set up handlers for 86F layer. */
|
||||
d86f_handler[drive].disk_flags = disk_flags;
|
||||
@@ -622,26 +667,30 @@ json_load(int drive, wchar_t *fn)
|
||||
void
|
||||
json_close(int drive)
|
||||
{
|
||||
json_t *img = &images[drive];
|
||||
json_t *dev = images[drive];
|
||||
int t, h, s;
|
||||
|
||||
if (dev == NULL) return;
|
||||
|
||||
/* Unlink image from the system. */
|
||||
d86f_unregister(drive);
|
||||
|
||||
/* Release all the sector buffers. */
|
||||
for (t=0; t<256; t++) {
|
||||
for (h=0; h<2; h++) {
|
||||
memset(img->sects[t][h], 0x00, sizeof(sector_t));
|
||||
memset(dev->sects[t][h], 0x00, sizeof(sector_t));
|
||||
for (s=0; s<256; s++) {
|
||||
if (img->sects[t][h][s].data != NULL)
|
||||
free(img->sects[t][h][s].data);
|
||||
img->sects[t][h][s].data = NULL;
|
||||
if (dev->sects[t][h][s].data != NULL)
|
||||
free(dev->sects[t][h][s].data);
|
||||
dev->sects[t][h][s].data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (img->f != NULL) {
|
||||
(void)fclose(img->f);
|
||||
img->f = NULL;
|
||||
}
|
||||
if (dev->f != NULL)
|
||||
(void)fclose(dev->f);
|
||||
|
||||
/* Release the memory. */
|
||||
free(dev);
|
||||
images[drive] = NULL;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,56 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the PCjs JSON floppy image format.
|
||||
* Definitions for the PCjs JSON floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_json.h 1.0.1 2017/09/06
|
||||
* Version: @(#)floppy_json.h 1.0.2 2018/03/17
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017 Fred N. van Kempen.
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_JSON_H
|
||||
# define EMU_FLOPPY_JSON_H
|
||||
|
||||
|
||||
//extern void json_init(void);
|
||||
extern void json_init(void);
|
||||
extern void json_load(int drive, wchar_t *fn);
|
||||
extern void json_close(int drive);
|
||||
//extern void json_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_JSON_H*/
|
||||
|
||||
2129
src/floppy/fdd_td0.c
2129
src/floppy/fdd_td0.c
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the Teledisk floppy image format.
|
||||
* Definitions for the Teledisk floppy image format.
|
||||
*
|
||||
* Version: @(#)floppy_td0.h 1.0.2 2017/09/03
|
||||
* Version: @(#)floppy_td0.h 1.0.2 2018/03/17
|
||||
*
|
||||
* Authors: Milodrag Milanovic,
|
||||
* Haruhiko OKUMURA,
|
||||
* Haruyasu YOSHIZAKI,
|
||||
* Kenji RIKITAKE,
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Copyright 1988-2017 Haruhiko OKUMURA.
|
||||
* Copyright 1988-2017 Haruyasu YOSHIZAKI.
|
||||
* Copyright 1988-2017 Kenji RIKITAKE.
|
||||
* Copyright 2013-2017 Milodrag Milanovic.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_FLOPPY_TD0_H
|
||||
# define EMU_FLOPPY_TD0_H
|
||||
@@ -28,7 +41,6 @@
|
||||
extern void td0_init(void);
|
||||
extern void td0_load(int drive, wchar_t *fn);
|
||||
extern void td0_close(int drive);
|
||||
extern void td0_seek(int drive, int track);
|
||||
|
||||
|
||||
#endif /*EMU_FLOPPY_TD0_H*/
|
||||
|
||||
@@ -1,22 +1,45 @@
|
||||
/* Copyright holders: Toni Wilen
|
||||
see COPYING for more details
|
||||
*/
|
||||
/*
|
||||
|
||||
FDI to raw bit stream converter
|
||||
Copyright (c) 2001 by Toni Wilen <twilen@arabuusimiehet.com>
|
||||
FDI 2.0 support
|
||||
Copyright (c) 2003-2004 by Toni Wilen <twilen@arabuusimiehet.com>
|
||||
and Vincent Joguin
|
||||
|
||||
FDI format created by Vincent "ApH" Joguin
|
||||
|
||||
Tiny changes - function type fixes, multiple drives, addition of
|
||||
get_last_head and C++ callability - by Thomas Harte, 2001,
|
||||
T.Harte@excite.co.uk
|
||||
|
||||
*/
|
||||
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* FDI to raw bit stream converter
|
||||
* FDI format created by Vincent "ApH" Joguin
|
||||
* Tiny changes - function type fixes, multiple drives,
|
||||
* addition of get_last_head and C++ callability by Thomas
|
||||
* Harte.
|
||||
*
|
||||
* Version: @(#)fdi2raw.c 1.0.2 2018/03/12
|
||||
*
|
||||
* Authors: Toni Wilen, <twilen@arabuusimiehet.com>
|
||||
* and Vincent Joguin,
|
||||
* Thomas Harte, <T.Harte@excite.co.uk>
|
||||
*
|
||||
* Copyright 2001-2004 Toni Wilen.
|
||||
* Copyright 2001-2004 Vincent Joguin.
|
||||
* Copyright 2001 Thomas Harte.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#define STATIC_INLINE
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -1857,7 +1880,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache)
|
||||
indexoffset = 0;
|
||||
p1 = idxp;
|
||||
for (i = 0; i < pulses; i++) {
|
||||
if (p1[idx_off1] + p1[idx_off2] > maxidx)
|
||||
if ((uint32_t)p1[idx_off1] + (uint32_t)p1[idx_off2] > maxidx)
|
||||
maxidx = p1[idx_off1] + p1[idx_off2];
|
||||
p1 += idx_off3;
|
||||
}
|
||||
@@ -1893,7 +1916,7 @@ static int decode_lowlevel_track (FDI *fdi, int track, struct fdi_cache *cache)
|
||||
totalavg = 0;
|
||||
weakbits = 0;
|
||||
for (i = 0; i < pulses; i++) {
|
||||
int sum = p1[idx_off1] + p1[idx_off2];
|
||||
uint32_t sum = p1[idx_off1] + p1[idx_off2];
|
||||
if (sum >= maxidx) {
|
||||
totalavg += *p2;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,41 @@
|
||||
/* Copyright holders: Toni Wilen
|
||||
see COPYING for more details
|
||||
*/
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the FDI floppy file format.
|
||||
*
|
||||
* Version: @(#)fdi2raw.h 1.0.1 2018/02/14
|
||||
*
|
||||
* Authors: Toni Wilen, <twilen@arabuusimiehet.com>
|
||||
* and Vincent Joguin,
|
||||
* Thomas Harte, <T.Harte@excite.co.uk>
|
||||
*
|
||||
* Copyright 2001-2004 Toni Wilen.
|
||||
* Copyright 2001-2004 Vincent Joguin.
|
||||
* Copyright 2001 Thomas Harte.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef __FDI2RAW_H
|
||||
#define __FDI2RAW_H
|
||||
|
||||
|
||||
@@ -1,6 +1,39 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of a generic Game Port.
|
||||
*
|
||||
* Version: @(#)gameport.c 1.0.3 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -17,261 +50,286 @@
|
||||
#include "joystick_standard.h"
|
||||
#include "joystick_sw_pad.h"
|
||||
#include "joystick_tm_fcs.h"
|
||||
#include "../plat_joystick.h"
|
||||
|
||||
|
||||
int joystick_type;
|
||||
typedef struct {
|
||||
int64_t count;
|
||||
int axis_nr;
|
||||
struct _gameport_ *gameport;
|
||||
} g_axis_t;
|
||||
|
||||
typedef struct _gameport_ {
|
||||
uint8_t state;
|
||||
|
||||
joystick_if_t joystick_none =
|
||||
{
|
||||
"No joystick",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
g_axis_t axis[4];
|
||||
|
||||
static joystick_if_t *joystick_list[] =
|
||||
{
|
||||
&joystick_standard,
|
||||
&joystick_standard_4button,
|
||||
&joystick_standard_6button,
|
||||
&joystick_standard_8button,
|
||||
&joystick_ch_flightstick_pro,
|
||||
&joystick_sw_pad,
|
||||
&joystick_tm_fcs,
|
||||
&joystick_none,
|
||||
NULL
|
||||
};
|
||||
|
||||
char *joystick_get_name(int64_t joystick)
|
||||
{
|
||||
if (!joystick_list[joystick])
|
||||
return NULL;
|
||||
return (char *) joystick_list[joystick]->name;
|
||||
}
|
||||
|
||||
int64_t joystick_get_max_joysticks(int64_t joystick)
|
||||
{
|
||||
return joystick_list[joystick]->max_joysticks;
|
||||
}
|
||||
|
||||
int64_t joystick_get_axis_count(int64_t joystick)
|
||||
{
|
||||
return joystick_list[joystick]->axis_count;
|
||||
}
|
||||
|
||||
int64_t joystick_get_button_count(int64_t joystick)
|
||||
{
|
||||
return joystick_list[joystick]->button_count;
|
||||
}
|
||||
|
||||
int64_t joystick_get_pov_count(int64_t joystick)
|
||||
{
|
||||
return joystick_list[joystick]->pov_count;
|
||||
}
|
||||
|
||||
char *joystick_get_axis_name(int64_t joystick, int64_t id)
|
||||
{
|
||||
return (char *) joystick_list[joystick]->axis_names[id];
|
||||
}
|
||||
|
||||
char *joystick_get_button_name(int64_t joystick, int64_t id)
|
||||
{
|
||||
return (char *) joystick_list[joystick]->button_names[id];
|
||||
}
|
||||
|
||||
char *joystick_get_pov_name(int64_t joystick, int64_t id)
|
||||
{
|
||||
return (char *) joystick_list[joystick]->pov_names[id];
|
||||
}
|
||||
|
||||
typedef struct gameport_axis_t
|
||||
{
|
||||
int64_t count;
|
||||
int64_t axis_nr;
|
||||
struct gameport_t *gameport;
|
||||
} gameport_axis_t;
|
||||
|
||||
typedef struct gameport_t
|
||||
{
|
||||
uint8_t state;
|
||||
|
||||
gameport_axis_t axis[4];
|
||||
|
||||
joystick_if_t *joystick;
|
||||
void *joystick_dat;
|
||||
const joystick_if_t *joystick;
|
||||
void *joystick_dat;
|
||||
} gameport_t;
|
||||
|
||||
|
||||
int joystick_type;
|
||||
|
||||
|
||||
static const joystick_if_t joystick_none = {
|
||||
"No joystick",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
static const joystick_if_t *joystick_list[] = {
|
||||
&joystick_standard,
|
||||
&joystick_standard_4button,
|
||||
&joystick_standard_6button,
|
||||
&joystick_standard_8button,
|
||||
&joystick_ch_flightstick_pro,
|
||||
&joystick_sw_pad,
|
||||
&joystick_tm_fcs,
|
||||
&joystick_none,
|
||||
NULL
|
||||
};
|
||||
static gameport_t *gameport_global = NULL;
|
||||
|
||||
static int64_t gameport_time(int64_t axis)
|
||||
{
|
||||
if (axis == AXIS_NOT_PRESENT)
|
||||
return 0;
|
||||
|
||||
axis += 32768;
|
||||
axis = (axis * 100) / 65; /*Axis now in ohms*/
|
||||
axis = (axis * 11) / 1000;
|
||||
return TIMER_USEC * (axis + 24); /*max = 11.115 ms*/
|
||||
char *
|
||||
joystick_get_name(int js)
|
||||
{
|
||||
if (! joystick_list[js])
|
||||
return(NULL);
|
||||
return((char *)joystick_list[js]->name);
|
||||
}
|
||||
|
||||
void gameport_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
int
|
||||
joystick_get_max_joysticks(int js)
|
||||
{
|
||||
gameport_t *gameport = (gameport_t *)p;
|
||||
|
||||
timer_clock();
|
||||
gameport->state |= 0x0f;
|
||||
pclog("gameport_write : joysticks_present=%i\n", joysticks_present);
|
||||
|
||||
gameport->axis[0].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 0));
|
||||
gameport->axis[1].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 1));
|
||||
gameport->axis[2].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 2));
|
||||
gameport->axis[3].count = gameport_time(gameport->joystick->read_axis(gameport->joystick_dat, 3));
|
||||
|
||||
gameport->joystick->write(gameport->joystick_dat);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
return(joystick_list[js]->max_joysticks);
|
||||
}
|
||||
|
||||
uint8_t gameport_read(uint16_t addr, void *p)
|
||||
|
||||
int
|
||||
joystick_get_axis_count(int js)
|
||||
{
|
||||
gameport_t *gameport = (gameport_t *)p;
|
||||
uint8_t ret;
|
||||
|
||||
timer_clock();
|
||||
ret = gameport->state | gameport->joystick->read(gameport->joystick_dat);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
|
||||
return ret;
|
||||
return(joystick_list[js]->axis_count);
|
||||
}
|
||||
|
||||
void gameport_timer_over(void *p)
|
||||
|
||||
int
|
||||
joystick_get_button_count(int js)
|
||||
{
|
||||
gameport_axis_t *axis = (gameport_axis_t *)p;
|
||||
gameport_t *gameport = axis->gameport;
|
||||
|
||||
gameport->state &= ~(1 << axis->axis_nr);
|
||||
axis->count = 0;
|
||||
|
||||
if (axis == &gameport->axis[0])
|
||||
gameport->joystick->a0_over(gameport->joystick_dat);
|
||||
return(joystick_list[js]->button_count);
|
||||
}
|
||||
|
||||
void *gameport_init_common(void)
|
||||
{
|
||||
gameport_t *gameport = malloc(sizeof(gameport_t));
|
||||
|
||||
memset(gameport, 0, sizeof(gameport_t));
|
||||
|
||||
gameport->axis[0].gameport = gameport;
|
||||
gameport->axis[1].gameport = gameport;
|
||||
gameport->axis[2].gameport = gameport;
|
||||
gameport->axis[3].gameport = gameport;
|
||||
|
||||
gameport->axis[0].axis_nr = 0;
|
||||
gameport->axis[1].axis_nr = 1;
|
||||
gameport->axis[2].axis_nr = 2;
|
||||
gameport->axis[3].axis_nr = 3;
|
||||
|
||||
timer_add(gameport_timer_over, &gameport->axis[0].count, &gameport->axis[0].count, &gameport->axis[0]);
|
||||
timer_add(gameport_timer_over, &gameport->axis[1].count, &gameport->axis[1].count, &gameport->axis[1]);
|
||||
timer_add(gameport_timer_over, &gameport->axis[2].count, &gameport->axis[2].count, &gameport->axis[2]);
|
||||
timer_add(gameport_timer_over, &gameport->axis[3].count, &gameport->axis[3].count, &gameport->axis[3]);
|
||||
|
||||
gameport->joystick = joystick_list[joystick_type];
|
||||
gameport->joystick_dat = gameport->joystick->init();
|
||||
|
||||
gameport_global = gameport;
|
||||
|
||||
return gameport;
|
||||
int
|
||||
joystick_get_pov_count(int js)
|
||||
{
|
||||
return(joystick_list[js]->pov_count);
|
||||
}
|
||||
|
||||
void gameport_update_joystick_type(void)
|
||||
|
||||
char *
|
||||
joystick_get_axis_name(int js, int id)
|
||||
{
|
||||
gameport_t *gameport = gameport_global;
|
||||
|
||||
if (gameport)
|
||||
{
|
||||
gameport->joystick->close(gameport->joystick_dat);
|
||||
gameport->joystick = joystick_list[joystick_type];
|
||||
gameport->joystick_dat = gameport->joystick->init();
|
||||
}
|
||||
return((char *)joystick_list[js]->axis_names[id]);
|
||||
}
|
||||
|
||||
void *gameport_init(device_t *info)
|
||||
|
||||
char *
|
||||
joystick_get_button_name(int js, int id)
|
||||
{
|
||||
gameport_t *gameport = NULL;
|
||||
|
||||
if (joystick_type == 7)
|
||||
{
|
||||
gameport = NULL;
|
||||
return gameport;
|
||||
}
|
||||
|
||||
gameport = gameport_init_common();
|
||||
|
||||
io_sethandler(0x0200, 0x0008, gameport_read, NULL, NULL, gameport_write, NULL, NULL, gameport);
|
||||
|
||||
return gameport;
|
||||
return((char *)joystick_list[js]->button_names[id]);
|
||||
}
|
||||
|
||||
void *gameport_201_init(device_t *info)
|
||||
|
||||
char *
|
||||
joystick_get_pov_name(int js, int id)
|
||||
{
|
||||
gameport_t *gameport;
|
||||
|
||||
if (joystick_type == 7)
|
||||
{
|
||||
gameport = NULL;
|
||||
return gameport;
|
||||
}
|
||||
|
||||
gameport = gameport_init_common();
|
||||
|
||||
io_sethandler(0x0201, 0x0001, gameport_read, NULL, NULL, gameport_write, NULL, NULL, gameport);
|
||||
|
||||
return gameport;
|
||||
return (char *)joystick_list[js]->pov_names[id];
|
||||
}
|
||||
|
||||
void gameport_close(void *p)
|
||||
|
||||
static int
|
||||
gameport_time(int axis)
|
||||
{
|
||||
gameport_t *gameport = (gameport_t *)p;
|
||||
if (axis == AXIS_NOT_PRESENT) return(0);
|
||||
|
||||
if (!p)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gameport->joystick->close(gameport->joystick_dat);
|
||||
axis += 32768;
|
||||
axis = (axis * 100) / 65; /*Axis now in ohms*/
|
||||
axis = (axis * 11) / 1000;
|
||||
|
||||
gameport_global = NULL;
|
||||
|
||||
free(gameport);
|
||||
return(TIMER_USEC * (axis + 24)); /*max = 11.115 ms*/
|
||||
}
|
||||
|
||||
device_t gameport_device =
|
||||
|
||||
static void
|
||||
gameport_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
"Game port",
|
||||
0, 0,
|
||||
gameport_init,
|
||||
gameport_close,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
gameport_t *p = (gameport_t *)priv;
|
||||
|
||||
timer_clock();
|
||||
p->state |= 0x0f;
|
||||
pclog("gameport_write : joysticks_present=%i\n", joysticks_present);
|
||||
|
||||
p->axis[0].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 0));
|
||||
p->axis[1].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 1));
|
||||
p->axis[2].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 2));
|
||||
p->axis[3].count = gameport_time(p->joystick->read_axis(p->joystick_dat, 3));
|
||||
|
||||
p->joystick->write(p->joystick_dat);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
gameport_read(uint16_t addr, void *priv)
|
||||
{
|
||||
gameport_t *p = (gameport_t *)p;
|
||||
uint8_t ret;
|
||||
|
||||
timer_clock();
|
||||
ret = p->state | p->joystick->read(p->joystick_dat);
|
||||
|
||||
cycles -= ISA_CYCLES(8);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
timer_over(void *priv)
|
||||
{
|
||||
g_axis_t *axis = (g_axis_t *)priv;
|
||||
gameport_t *p = axis->gameport;
|
||||
|
||||
p->state &= ~(1 << axis->axis_nr);
|
||||
axis->count = 0;
|
||||
|
||||
if (axis == &p->axis[0])
|
||||
p->joystick->a0_over(p->joystick_dat);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
init_common(void)
|
||||
{
|
||||
gameport_t *p = malloc(sizeof(gameport_t));
|
||||
|
||||
memset(p, 0x00, sizeof(gameport_t));
|
||||
|
||||
p->axis[0].gameport = p;
|
||||
p->axis[1].gameport = p;
|
||||
p->axis[2].gameport = p;
|
||||
p->axis[3].gameport = p;
|
||||
|
||||
p->axis[0].axis_nr = 0;
|
||||
p->axis[1].axis_nr = 1;
|
||||
p->axis[2].axis_nr = 2;
|
||||
p->axis[3].axis_nr = 3;
|
||||
|
||||
timer_add(timer_over, &p->axis[0].count, &p->axis[0].count, &p->axis[0]);
|
||||
timer_add(timer_over, &p->axis[1].count, &p->axis[1].count, &p->axis[1]);
|
||||
timer_add(timer_over, &p->axis[2].count, &p->axis[2].count, &p->axis[2]);
|
||||
timer_add(timer_over, &p->axis[3].count, &p->axis[3].count, &p->axis[3]);
|
||||
|
||||
p->joystick = joystick_list[joystick_type];
|
||||
p->joystick_dat = p->joystick->init();
|
||||
|
||||
gameport_global = p;
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gameport_update_joystick_type(void)
|
||||
{
|
||||
gameport_t *p = gameport_global;
|
||||
|
||||
if (p != NULL) {
|
||||
p->joystick->close(p->joystick_dat);
|
||||
p->joystick = joystick_list[joystick_type];
|
||||
p->joystick_dat = p->joystick->init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
gameport_init(const device_t *info)
|
||||
{
|
||||
gameport_t *p = NULL;
|
||||
|
||||
if (joystick_type == 7) {
|
||||
p = NULL;
|
||||
return(p);
|
||||
}
|
||||
|
||||
p = init_common();
|
||||
|
||||
io_sethandler(0x0200, 8,
|
||||
gameport_read,NULL,NULL, gameport_write,NULL,NULL, p);
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
gameport_201_init(const device_t *info)
|
||||
{
|
||||
gameport_t *p;
|
||||
|
||||
if (joystick_type == 7) {
|
||||
p = NULL;
|
||||
return(p);
|
||||
}
|
||||
|
||||
p = init_common();
|
||||
|
||||
io_sethandler(0x0201, 1,
|
||||
gameport_read,NULL,NULL, gameport_write,NULL,NULL, p);
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gameport_close(void *priv)
|
||||
{
|
||||
gameport_t *p = (gameport_t *)priv;
|
||||
|
||||
if (p == NULL) return;
|
||||
|
||||
p->joystick->close(p->joystick_dat);
|
||||
|
||||
gameport_global = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
const device_t gameport_device = {
|
||||
"Game port",
|
||||
0, 0,
|
||||
gameport_init,
|
||||
gameport_close,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
device_t gameport_201_device =
|
||||
{
|
||||
"Game port (port 201h only)",
|
||||
0, 0,
|
||||
gameport_201_init,
|
||||
gameport_close,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
const device_t gameport_201_device = {
|
||||
"Game port (port 201h only)",
|
||||
0, 0,
|
||||
gameport_201_init,
|
||||
gameport_close,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -1,49 +1,142 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the generic game port handlers.
|
||||
*
|
||||
* NOTE: This module needs a good cleanup someday.
|
||||
*
|
||||
* Version: @(#)gameport.h 1.0.3 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef EMU_GAMEPORT_H
|
||||
# define EMU_GAMEPORT_H
|
||||
|
||||
|
||||
#define AXIS_NOT_PRESENT -99999
|
||||
#define MAX_PLAT_JOYSTICKS 8
|
||||
#define MAX_JOYSTICKS 4
|
||||
|
||||
#define POV_X 0x80000000
|
||||
#define POV_Y 0x40000000
|
||||
|
||||
#define AXIS_NOT_PRESENT -99999
|
||||
|
||||
#define JOYSTICK_PRESENT(n) (joystick_state[n].plat_joystick_nr != 0)
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
void *(*init)(void);
|
||||
void (*close)(void *p);
|
||||
uint8_t (*read)(void *p);
|
||||
void (*write)(void *p);
|
||||
int (*read_axis)(void *p, int axis);
|
||||
void (*a0_over)(void *p);
|
||||
int axis_count, button_count, pov_count;
|
||||
int max_joysticks;
|
||||
const char *axis_names[8];
|
||||
const char *button_names[32];
|
||||
const char *pov_names[4];
|
||||
typedef struct {
|
||||
char name[64];
|
||||
|
||||
int a[8];
|
||||
int b[32];
|
||||
int p[4];
|
||||
|
||||
struct {
|
||||
char name[32];
|
||||
int id;
|
||||
} axis[8];
|
||||
|
||||
struct {
|
||||
char name[32];
|
||||
int id;
|
||||
} button[32];
|
||||
|
||||
struct {
|
||||
char name[32];
|
||||
int id;
|
||||
} pov[4];
|
||||
|
||||
int nr_axes;
|
||||
int nr_buttons;
|
||||
int nr_povs;
|
||||
} plat_joystick_t;
|
||||
|
||||
typedef struct {
|
||||
int axis[8];
|
||||
int button[32];
|
||||
int pov[4];
|
||||
|
||||
int plat_joystick_nr;
|
||||
int axis_mapping[8];
|
||||
int button_mapping[32];
|
||||
int pov_mapping[4][2];
|
||||
} joystick_t;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
|
||||
void *(*init)(void);
|
||||
void (*close)(void *p);
|
||||
uint8_t (*read)(void *p);
|
||||
void (*write)(void *p);
|
||||
int (*read_axis)(void *p, int axis);
|
||||
void (*a0_over)(void *p);
|
||||
|
||||
int axis_count,
|
||||
button_count,
|
||||
pov_count;
|
||||
int max_joysticks;
|
||||
const char *axis_names[8];
|
||||
const char *button_names[32];
|
||||
const char *pov_names[4];
|
||||
} joystick_if_t;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern device_t gameport_device;
|
||||
extern device_t gameport_201_device;
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t gameport_device;
|
||||
extern const device_t gameport_201_device;
|
||||
#endif
|
||||
|
||||
extern int joystick_type;
|
||||
extern plat_joystick_t plat_joystick_state[MAX_PLAT_JOYSTICKS];
|
||||
extern joystick_t joystick_state[MAX_JOYSTICKS];
|
||||
extern int joysticks_present;
|
||||
|
||||
extern int joystick_type;
|
||||
|
||||
|
||||
extern char *joystick_get_name(int64_t joystick);
|
||||
extern int64_t joystick_get_max_joysticks(int64_t joystick);
|
||||
extern int64_t joystick_get_axis_count(int64_t joystick);
|
||||
extern int64_t joystick_get_button_count(int64_t joystick);
|
||||
extern int64_t joystick_get_pov_count(int64_t joystick);
|
||||
extern char *joystick_get_axis_name(int64_t joystick, int64_t id);
|
||||
extern char *joystick_get_button_name(int64_t joystick, int64_t id);
|
||||
extern char *joystick_get_pov_name(int64_t joystick, int64_t id);
|
||||
extern void joystick_init(void);
|
||||
extern void joystick_close(void);
|
||||
extern void joystick_process(void);
|
||||
|
||||
extern char *joystick_get_name(int js);
|
||||
extern int joystick_get_max_joysticks(int js);
|
||||
extern int joystick_get_axis_count(int js);
|
||||
extern int joystick_get_button_count(int js);
|
||||
extern int joystick_get_pov_count(int js);
|
||||
extern char *joystick_get_axis_name(int js, int id);
|
||||
extern char *joystick_get_button_name(int js, int id);
|
||||
extern char *joystick_get_pov_name(int js, int id);
|
||||
|
||||
extern void gameport_update_joystick_type(void);
|
||||
|
||||
|
||||
@@ -1,3 +1,39 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the Flight Stick Pro.
|
||||
*
|
||||
* Version: @(#)flightstick_pro.c 1.0.4 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -6,12 +42,11 @@
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../plat_joystick.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
|
||||
static void *ch_flightstick_pro_init()
|
||||
static void *ch_flightstick_pro_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -78,7 +113,7 @@ static void ch_flightstick_pro_a0_over(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
joystick_if_t joystick_ch_flightstick_pro =
|
||||
const joystick_if_t joystick_ch_flightstick_pro =
|
||||
{
|
||||
"CH Flightstick Pro",
|
||||
ch_flightstick_pro_init,
|
||||
|
||||
@@ -1 +1,38 @@
|
||||
extern joystick_if_t joystick_ch_flightstick_pro;
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the Flight Stick Pro driver.
|
||||
*
|
||||
* Version: @(#)joystick_ch_flightstickpro.h 1.0.2 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
|
||||
extern const joystick_if_t joystick_ch_flightstick_pro;
|
||||
|
||||
@@ -1,3 +1,39 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of a standard joystick.
|
||||
*
|
||||
* Version: @(#)joystick_standard.c 1.0.4 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -6,12 +42,11 @@
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../plat_joystick.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
|
||||
static void *joystick_standard_init()
|
||||
static void *joystick_standard_init(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -160,7 +195,7 @@ static void joystick_standard_a0_over(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
joystick_if_t joystick_standard =
|
||||
const joystick_if_t joystick_standard =
|
||||
{
|
||||
"Standard 2-button joystick(s)",
|
||||
joystick_standard_init,
|
||||
@@ -176,7 +211,7 @@ joystick_if_t joystick_standard =
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2"}
|
||||
};
|
||||
joystick_if_t joystick_standard_4button =
|
||||
const joystick_if_t joystick_standard_4button =
|
||||
{
|
||||
"Standard 4-button joystick",
|
||||
joystick_standard_init,
|
||||
@@ -192,7 +227,7 @@ joystick_if_t joystick_standard_4button =
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4"}
|
||||
};
|
||||
joystick_if_t joystick_standard_6button =
|
||||
const joystick_if_t joystick_standard_6button =
|
||||
{
|
||||
"Standard 6-button joystick",
|
||||
joystick_standard_init,
|
||||
@@ -208,7 +243,7 @@ joystick_if_t joystick_standard_6button =
|
||||
{"X axis", "Y axis"},
|
||||
{"Button 1", "Button 2", "Button 3", "Button 4", "Button 5", "Button 6"}
|
||||
};
|
||||
joystick_if_t joystick_standard_8button =
|
||||
const joystick_if_t joystick_standard_8button =
|
||||
{
|
||||
"Standard 8-button joystick",
|
||||
joystick_standard_init,
|
||||
|
||||
@@ -1,4 +1,41 @@
|
||||
extern joystick_if_t joystick_standard;
|
||||
extern joystick_if_t joystick_standard_4button;
|
||||
extern joystick_if_t joystick_standard_6button;
|
||||
extern joystick_if_t joystick_standard_8button;
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the joystick driver.
|
||||
*
|
||||
* Version: @(#)joystick_standard.h 1.0.2 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
|
||||
extern const joystick_if_t joystick_standard;
|
||||
extern const joystick_if_t joystick_standard_4button;
|
||||
extern const joystick_if_t joystick_standard_6button;
|
||||
extern const joystick_if_t joystick_standard_8button;
|
||||
|
||||
@@ -1,24 +1,60 @@
|
||||
/*Sidewinder game pad notes :
|
||||
|
||||
- Write to 0x201 starts packet transfer (5*N or 15*N bits)
|
||||
- Currently alternates between Mode A and Mode B (is there any way of
|
||||
actually controlling which is used?)
|
||||
- Windows 9x drivers require Mode B when more than 1 pad connected
|
||||
- Packet preceeded by high data (currently 50us), and followed by low
|
||||
data (currently 160us) - timings are probably wrong, but good enough
|
||||
for everything I've tried
|
||||
- Analogue inputs are only used to time ID packet request. If A0 timing
|
||||
out is followed after ~64us by another 0x201 write then an ID packet
|
||||
is triggered
|
||||
- Sidewinder game pad ID is 'H0003'
|
||||
- ID is sent in Mode A (1 bit per clock), but data bit 2 must change
|
||||
during ID packet transfer, or Windows 9x drivers won't use Mode B. I
|
||||
don't know if it oscillates, mirrors the data transfer, or something
|
||||
else - the drivers only check that it changes at least 10 times during
|
||||
the transfer
|
||||
- Some DOS stuff will write to 0x201 while a packet is being transferred.
|
||||
This seems to be ignored.
|
||||
*/
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of a Side Winder GamePad.
|
||||
*
|
||||
* Notes: - Write to 0x201 starts packet transfer (5*N or 15*N bits)
|
||||
* - Currently alternates between Mode A and Mode B (is there
|
||||
* any way of actually controlling which is used?)
|
||||
* - Windows 9x drivers require Mode B when more than 1 pad
|
||||
* connected
|
||||
* - Packet preceeded by high data (currently 50us), and
|
||||
* followed by low data (currently 160us) - timings are
|
||||
* probably wrong, but good enoughfor everything I've tried
|
||||
* - Analog inputs are only used to time ID packet request.
|
||||
* If A0 timing out is followed after ~64us by another 0x201
|
||||
* write then an ID packet is triggered
|
||||
* - Sidewinder game pad ID is 'H0003'
|
||||
* - ID is sent in Mode A (1 bit per clock), but data bit 2
|
||||
* must change during ID packet transfer, or Windows 9x
|
||||
* drivers won't use Mode B. I don't know if it oscillates,
|
||||
* mirrors the data transfer, or something else - the drivers
|
||||
* only check that it changes at least 10 times during the
|
||||
* transfer
|
||||
* - Some DOS stuff will write to 0x201 while a packet is
|
||||
* being transferred. This seems to be ignored.
|
||||
*
|
||||
* Version: @(#)sw_pad.c 1.0.5 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -27,7 +63,6 @@
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../plat_joystick.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_sw_pad.h"
|
||||
|
||||
@@ -90,7 +125,7 @@ static int sw_parity(uint16_t data)
|
||||
return bits_set & 1;
|
||||
}
|
||||
|
||||
static void *sw_init()
|
||||
static void *sw_init(void)
|
||||
{
|
||||
sw_data *sw = (sw_data *)malloc(sizeof(sw_data));
|
||||
memset(sw, 0, sizeof(sw_data));
|
||||
@@ -139,7 +174,7 @@ static uint8_t sw_read(void *p)
|
||||
static void sw_write(void *p)
|
||||
{
|
||||
sw_data *sw = (sw_data *)p;
|
||||
int time_since_last = sw->trigger_time / TIMER_USEC;
|
||||
int64_t time_since_last = sw->trigger_time / TIMER_USEC;
|
||||
|
||||
if (!JOYSTICK_PRESENT(0))
|
||||
return;
|
||||
@@ -177,7 +212,7 @@ static void sw_write(void *p)
|
||||
|
||||
for (c = 0; c < 4; c++)
|
||||
{
|
||||
uint64_t data = 0x3fff;
|
||||
uint16_t data = 0x3fff;
|
||||
int b;
|
||||
|
||||
if (!JOYSTICK_PRESENT(c))
|
||||
@@ -235,7 +270,7 @@ static void sw_a0_over(void *p)
|
||||
sw->trigger_time = TIMER_USEC * 10000;
|
||||
}
|
||||
|
||||
joystick_if_t joystick_sw_pad =
|
||||
const joystick_if_t joystick_sw_pad =
|
||||
{
|
||||
"Microsoft SideWinder Pad",
|
||||
sw_init,
|
||||
|
||||
@@ -1 +1,38 @@
|
||||
extern joystick_if_t joystick_sw_pad;
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the Sidewinder Pro driver.
|
||||
*
|
||||
* Version: @(#)joystick_sw_pad.h 1.0.2 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
|
||||
extern const joystick_if_t joystick_sw_pad;
|
||||
|
||||
@@ -1,3 +1,39 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of Thrust Master Flight Control System.
|
||||
*
|
||||
* Version: @(#)tm_fcs.c 1.0.3 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@@ -6,7 +42,6 @@
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
#include "../plat_joystick.h"
|
||||
#include "gameport.h"
|
||||
#include "joystick_standard.h"
|
||||
|
||||
@@ -77,7 +112,7 @@ static void tm_fcs_a0_over(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
joystick_if_t joystick_tm_fcs =
|
||||
const joystick_if_t joystick_tm_fcs =
|
||||
{
|
||||
"Thrustmaster Flight Control System",
|
||||
tm_fcs_init,
|
||||
|
||||
@@ -1 +1,38 @@
|
||||
extern joystick_if_t joystick_tm_fcs;
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Definitions for the Flight Control System driver.
|
||||
*
|
||||
* Version: @(#)joystick_tm_fcs.h 1.0.2 2018/03/15
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
|
||||
extern const joystick_if_t joystick_tm_fcs;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation of the Intel 2 Mbit 8-bit flash devices.
|
||||
* Implementation of the Intel 1 Mbit 8-bit flash devices.
|
||||
*
|
||||
* Version: @(#)intel_flash.c 1.0.13 2018/02/09
|
||||
* Version: @(#)intel_flash.c 1.0.14 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -288,7 +288,7 @@ void intel_flash_close(void *p)
|
||||
}
|
||||
|
||||
|
||||
device_t intel_flash_bxt_ami_device =
|
||||
const device_t intel_flash_bxt_ami_device =
|
||||
{
|
||||
"Intel 28F001BXT Flash BIOS",
|
||||
0, 0,
|
||||
@@ -298,7 +298,7 @@ device_t intel_flash_bxt_ami_device =
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t intel_flash_bxb_ami_device =
|
||||
const device_t intel_flash_bxb_ami_device =
|
||||
{
|
||||
"Intel 28F001BXB Flash BIOS",
|
||||
0, 0,
|
||||
@@ -308,7 +308,7 @@ device_t intel_flash_bxb_ami_device =
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t intel_flash_bxt_device =
|
||||
const device_t intel_flash_bxt_device =
|
||||
{
|
||||
"Intel 28F001BXT Flash BIOS",
|
||||
0, 0,
|
||||
@@ -318,7 +318,7 @@ device_t intel_flash_bxt_device =
|
||||
NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t intel_flash_bxb_device =
|
||||
const device_t intel_flash_bxb_device =
|
||||
{
|
||||
"Intel 28F001BXB Flash BIOS",
|
||||
0, 0,
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation of the Intel 2 Mbit 8-bit flash devices.
|
||||
* Implementation of the Intel 1 Mbit 8-bit flash devices.
|
||||
*
|
||||
* Version: @(#)intel_flash.h 1.0.0 2017/05/30
|
||||
* Version: @(#)intel_flash.h 1.0.1 2018/03/14
|
||||
*
|
||||
* Author: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,7 +16,7 @@
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
|
||||
extern device_t intel_flash_bxt_ami_device;
|
||||
extern device_t intel_flash_bxb_ami_device;
|
||||
extern device_t intel_flash_bxt_device;
|
||||
extern device_t intel_flash_bxb_device;
|
||||
extern const device_t intel_flash_bxt_ami_device;
|
||||
extern const device_t intel_flash_bxb_ami_device;
|
||||
extern const device_t intel_flash_bxt_device;
|
||||
extern const device_t intel_flash_bxb_device;
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
*
|
||||
* Definitions for the keyboard interface.
|
||||
*
|
||||
* Version: @(#)keyboard.h 1.0.11 2018/02/10
|
||||
* Version: @(#)keyboard.h 1.0.12 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016,2018 Miran Grca.
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*/
|
||||
#ifndef EMU_KEYBOARD_H
|
||||
# define EMU_KEYBOARD_H
|
||||
@@ -60,15 +60,15 @@ extern int mouse_queue_start, mouse_queue_end;
|
||||
extern int mouse_scan;
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t keyboard_xt_device;
|
||||
extern device_t keyboard_tandy_device;
|
||||
extern device_t keyboard_at_device;
|
||||
extern device_t keyboard_at_ami_device;
|
||||
extern device_t keyboard_at_toshiba_device;
|
||||
extern device_t keyboard_ps2_device;
|
||||
extern device_t keyboard_ps2_ami_device;
|
||||
extern device_t keyboard_ps2_mca_device;
|
||||
extern device_t keyboard_ps2_quadtel_device;
|
||||
extern const device_t keyboard_xt_device;
|
||||
extern const device_t keyboard_tandy_device;
|
||||
extern const device_t keyboard_at_device;
|
||||
extern const device_t keyboard_at_ami_device;
|
||||
extern const device_t keyboard_at_toshiba_device;
|
||||
extern const device_t keyboard_ps2_device;
|
||||
extern const device_t keyboard_ps2_ami_device;
|
||||
extern const device_t keyboard_ps2_mca_device;
|
||||
extern const device_t keyboard_ps2_quadtel_device;
|
||||
#endif
|
||||
|
||||
extern void keyboard_init(void);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Intel 8042 (AT keyboard controller) emulation.
|
||||
*
|
||||
* Version: @(#)keyboard_at.c 1.0.30 2018/03/13
|
||||
* Version: @(#)keyboard_at.c 1.0.31 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -1891,7 +1891,7 @@ kbd_reset(void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
kbd_init(device_t *info)
|
||||
kbd_init(const device_t *info)
|
||||
{
|
||||
atkbd_t *kbd;
|
||||
|
||||
@@ -1969,7 +1969,7 @@ kbd_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
device_t keyboard_at_device = {
|
||||
const device_t keyboard_at_device = {
|
||||
"PC/AT Keyboard",
|
||||
0,
|
||||
KBC_TYPE_ISA | KBC_VEN_GENERIC,
|
||||
@@ -1979,7 +1979,7 @@ device_t keyboard_at_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_at_ami_device = {
|
||||
const device_t keyboard_at_ami_device = {
|
||||
"PC/AT Keyboard (AMI)",
|
||||
0,
|
||||
KBC_TYPE_ISA | KBC_VEN_AMI,
|
||||
@@ -1989,7 +1989,7 @@ device_t keyboard_at_ami_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_at_toshiba_device = {
|
||||
const device_t keyboard_at_toshiba_device = {
|
||||
"PC/AT Keyboard (Toshiba)",
|
||||
0,
|
||||
KBC_TYPE_ISA | KBC_VEN_TOSHIBA,
|
||||
@@ -1999,7 +1999,7 @@ device_t keyboard_at_toshiba_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_ps2_device = {
|
||||
const device_t keyboard_ps2_device = {
|
||||
"PS/2 Keyboard",
|
||||
0,
|
||||
KBC_TYPE_PS2_1 | KBC_VEN_GENERIC,
|
||||
@@ -2009,7 +2009,7 @@ device_t keyboard_ps2_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_ps2_ami_device = {
|
||||
const device_t keyboard_ps2_ami_device = {
|
||||
"PS/2 Keyboard (AMI)",
|
||||
0,
|
||||
KBC_TYPE_PS2_1 | KBC_VEN_AMI,
|
||||
@@ -2019,7 +2019,7 @@ device_t keyboard_ps2_ami_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_ps2_mca_device = {
|
||||
const device_t keyboard_ps2_mca_device = {
|
||||
"PS/2 Keyboard",
|
||||
0,
|
||||
KBC_TYPE_PS2_1 | KBC_VEN_IBM_MCA,
|
||||
@@ -2029,7 +2029,7 @@ device_t keyboard_ps2_mca_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_ps2_quadtel_device = {
|
||||
const device_t keyboard_ps2_quadtel_device = {
|
||||
"PS/2 Keyboard (Quadtel/MegaPC)",
|
||||
0,
|
||||
KBC_TYPE_PS2_1 | KBC_VEN_QUADTEL,
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
*
|
||||
* Implementation of the XT-style keyboard.
|
||||
*
|
||||
* Version: @(#)keyboard_xt.c 1.0.9 2018/02/24
|
||||
* Version: @(#)keyboard_xt.c 1.0.10 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016,2018 Miran Grca.
|
||||
* Copyright 2018 Fred N. van kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van kempen.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -530,7 +530,7 @@ kbd_reset(void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
kbd_init(device_t *info)
|
||||
kbd_init(const device_t *info)
|
||||
{
|
||||
xtkbd_t *kbd;
|
||||
|
||||
@@ -574,7 +574,7 @@ kbd_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
device_t keyboard_xt_device = {
|
||||
const device_t keyboard_xt_device = {
|
||||
"PC/XT Keyboard",
|
||||
0,
|
||||
0,
|
||||
@@ -584,7 +584,7 @@ device_t keyboard_xt_device = {
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
device_t keyboard_tandy_device = {
|
||||
const device_t keyboard_tandy_device = {
|
||||
"Tandy 1000 Keyboard",
|
||||
0,
|
||||
1,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
char lpt_device_names[3][16];
|
||||
|
||||
|
||||
static struct
|
||||
static const struct
|
||||
{
|
||||
const char *name;
|
||||
const char *internal_name;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* in alpha mode, but in highres ("ECD350") mode, it displays
|
||||
* some semi-random junk. Video-memory pointer maybe?
|
||||
*
|
||||
* Version: @(#)m_amstrad.c 1.0.10 2018/02/02
|
||||
* Version: @(#)m_amstrad.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -557,7 +557,7 @@ vid_speed_change_1512(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t vid_1512_device = {
|
||||
static const device_t vid_1512_device = {
|
||||
"Amstrad PC1512 (video)",
|
||||
0, 0,
|
||||
NULL, vid_close_1512, NULL,
|
||||
@@ -721,7 +721,7 @@ vid_speed_changed_1640(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t vid_1640_device = {
|
||||
static const device_t vid_1640_device = {
|
||||
"Amstrad PC1640 (video)",
|
||||
0, 0,
|
||||
NULL, vid_close_1640, NULL,
|
||||
@@ -856,7 +856,7 @@ vid_speed_changed_200(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t vid_200_device = {
|
||||
static const device_t vid_200_device = {
|
||||
"Amstrad PC200 (video)",
|
||||
0, 0,
|
||||
NULL, vid_close_200, NULL,
|
||||
@@ -1198,7 +1198,7 @@ ams_read(uint16_t port, void *priv)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
machine_amstrad_init(const machine_t *model)
|
||||
{
|
||||
amstrad_t *ams;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
void
|
||||
machine_at_common_init(machine_t *model)
|
||||
machine_at_common_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
@@ -38,7 +38,7 @@ machine_at_common_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_init(machine_t *model)
|
||||
machine_at_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
|
||||
@@ -47,7 +47,7 @@ machine_at_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ps2_init(machine_t *model)
|
||||
machine_at_ps2_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
|
||||
@@ -56,7 +56,7 @@ machine_at_ps2_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_common_ide_init(machine_t *model)
|
||||
machine_at_common_ide_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
|
||||
@@ -65,7 +65,7 @@ machine_at_common_ide_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ide_init(machine_t *model)
|
||||
machine_at_ide_init(const machine_t *model)
|
||||
{
|
||||
machine_at_init(model);
|
||||
|
||||
@@ -74,7 +74,7 @@ machine_at_ide_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ps2_ide_init(machine_t *model)
|
||||
machine_at_ps2_ide_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -83,7 +83,7 @@ machine_at_ps2_ide_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_top_remap_init(machine_t *model)
|
||||
machine_at_top_remap_init(const machine_t *model)
|
||||
{
|
||||
machine_at_init(model);
|
||||
|
||||
@@ -92,7 +92,7 @@ machine_at_top_remap_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ide_top_remap_init(machine_t *model)
|
||||
machine_at_ide_top_remap_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ide_init(model);
|
||||
|
||||
@@ -101,7 +101,7 @@ machine_at_ide_top_remap_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ibm_init(machine_t *model)
|
||||
machine_at_ibm_init(const machine_t *model)
|
||||
{
|
||||
machine_at_top_remap_init(model);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 430FX PCISet chip.
|
||||
*
|
||||
* Version: @(#)m_at_430fx.c 1.0.13 2018/02/23
|
||||
* Version: @(#)m_at_430fx.c 1.0.14 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -207,7 +207,7 @@ static void i430fx_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_p54tp4xe_init(machine_t *model)
|
||||
machine_at_p54tp4xe_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -228,7 +228,7 @@ machine_at_p54tp4xe_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_endeavor_init(machine_t *model)
|
||||
machine_at_endeavor_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
@@ -253,7 +253,7 @@ machine_at_endeavor_init(machine_t *model)
|
||||
}
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
at_endeavor_get_device(void)
|
||||
{
|
||||
return &s3_phoenix_trio64_onboard_pci_device;
|
||||
@@ -261,7 +261,7 @@ at_endeavor_get_device(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_zappa_init(machine_t *model)
|
||||
machine_at_zappa_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
@@ -282,7 +282,7 @@ machine_at_zappa_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_mb500n_init(machine_t *model)
|
||||
machine_at_mb500n_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -302,7 +302,7 @@ machine_at_mb500n_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_president_init(machine_t *model)
|
||||
machine_at_president_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -323,7 +323,7 @@ machine_at_president_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_thor_init(machine_t *model)
|
||||
machine_at_thor_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of the Intel 430HX PCISet chip.
|
||||
*
|
||||
* Version: @(#)m_at_430hx.c 1.0.11 2018/02/14
|
||||
* Version: @(#)m_at_430hx.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -216,7 +216,7 @@ acerm3a_in(uint16_t port, void *p)
|
||||
|
||||
|
||||
void
|
||||
machine_at_acerm3a_init(machine_t *model)
|
||||
machine_at_acerm3a_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -239,7 +239,7 @@ machine_at_acerm3a_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_acerv35n_init(machine_t *model)
|
||||
machine_at_acerv35n_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -262,7 +262,7 @@ machine_at_acerv35n_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ap53_init(machine_t *model)
|
||||
machine_at_ap53_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
@@ -286,7 +286,7 @@ machine_at_ap53_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_p55t2p4_init(machine_t *model)
|
||||
machine_at_p55t2p4_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -307,7 +307,7 @@ machine_at_p55t2p4_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_p55t2s_init(machine_t *model)
|
||||
machine_at_p55t2s_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
*
|
||||
* Implementation of the Intel 430LX and 430NX PCISet chips.
|
||||
*
|
||||
* Version: @(#)m_at_430lx_nx.c 1.0.10 2018/02/14
|
||||
* Version: @(#)m_at_430lx_nx.c 1.0.10 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016,2018 Miran Grca.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -211,7 +211,7 @@ static void i430nx_init(void)
|
||||
|
||||
|
||||
static void
|
||||
machine_at_premiere_common_init(machine_t *model)
|
||||
machine_at_premiere_common_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
@@ -233,7 +233,7 @@ machine_at_premiere_common_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_batman_init(machine_t *model)
|
||||
machine_at_batman_init(const machine_t *model)
|
||||
{
|
||||
machine_at_premiere_common_init(model);
|
||||
|
||||
@@ -242,7 +242,7 @@ machine_at_batman_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_plato_init(machine_t *model)
|
||||
machine_at_plato_init(const machine_t *model)
|
||||
{
|
||||
machine_at_premiere_common_init(model);
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
*
|
||||
* Implementation of the Intel 430VX PCISet chip.
|
||||
*
|
||||
* Version: @(#)m_at_430vx.c 1.0.11 2018/02/14
|
||||
* Version: @(#)m_at_430vx.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016,2018 Miran Grca.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -193,7 +193,7 @@ void i430vx_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_p55tvp4_init(machine_t *model)
|
||||
machine_at_p55tvp4_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -214,7 +214,7 @@ machine_at_p55tvp4_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_i430vx_init(machine_t *model)
|
||||
machine_at_i430vx_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -235,7 +235,7 @@ machine_at_i430vx_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_p55va_init(machine_t *model)
|
||||
machine_at_p55va_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
*
|
||||
* Implementation of the Intel 440FX PCISet chip.
|
||||
*
|
||||
* Version: @(#)m_at_440fx.c 1.0.10 2018/02/14
|
||||
* Version: @(#)m_at_440fx.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016,2018 Miran Grca.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -195,7 +195,7 @@ static void i440fx_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_i440fx_init(machine_t *model)
|
||||
machine_at_i440fx_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
|
||||
@@ -217,7 +217,7 @@ machine_at_i440fx_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_s1668_init(machine_t *model)
|
||||
machine_at_s1668_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
device_add(&keyboard_ps2_ami_device);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* NOTE: The NEAT 82c206 code should be moved into a 82c206 module,
|
||||
* so it can be re-used by other boards.
|
||||
*
|
||||
* Version: @(#)m_4gpv31.c 1.0.4 2018/01/16
|
||||
* Version: @(#)m_4gpv31.c 1.0.5 2018/03/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
@@ -143,7 +143,7 @@ neat_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_4gpv31_init(machine_t *model)
|
||||
machine_at_4gpv31_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_ide_init(model);
|
||||
device_add(&keyboard_at_ami_device);
|
||||
|
||||
@@ -98,7 +98,7 @@ static void ali1429_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_ali1429_init(machine_t *model)
|
||||
machine_at_ali1429_init(const machine_t *model)
|
||||
{
|
||||
ali1429_reset();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static void cbm_io_init()
|
||||
|
||||
|
||||
void
|
||||
machine_at_cmdpc_init(machine_t *model)
|
||||
machine_at_cmdpc_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ide_top_remap_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of various Compaq PC's.
|
||||
*
|
||||
* Version: @(#)m_at_compaq.c 1.0.4 2018/02/14
|
||||
* Version: @(#)m_at_compaq.c 1.0.5 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -98,7 +98,7 @@ write_raml(uint32_t addr, uint32_t val, void *priv)
|
||||
|
||||
|
||||
void
|
||||
machine_at_compaq_init(machine_t *model)
|
||||
machine_at_compaq_init(const machine_t *model)
|
||||
{
|
||||
machine_at_top_remap_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
@@ -70,7 +70,7 @@ static void headland_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_headland_init(machine_t *model)
|
||||
machine_at_headland_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_ide_init(model);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ static void neat_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_neat_init(machine_t *model)
|
||||
machine_at_neat_init(const machine_t *model)
|
||||
{
|
||||
machine_at_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
@@ -98,7 +98,7 @@ machine_at_neat_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_neat_ami_init(machine_t *model)
|
||||
machine_at_neat_ami_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_init(model);
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ static void opti495_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_opti495_init(machine_t *model)
|
||||
machine_at_opti495_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_ide_init(model);
|
||||
|
||||
@@ -335,7 +335,7 @@ machine_at_opti495_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_opti495_ami_init(machine_t *model)
|
||||
machine_at_opti495_ami_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_ide_init(model);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Re-worked version based on the 82C235 datasheet and errata.
|
||||
*
|
||||
* Version: @(#)m_at_scat.c 1.0.10 2018/03/02
|
||||
* Version: @(#)m_at_scat.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Original by GreatPsycho for PCem.
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -712,7 +712,7 @@ scatsx_init()
|
||||
|
||||
|
||||
void
|
||||
machine_at_scat_init(machine_t *model)
|
||||
machine_at_scat_init(const machine_t *model)
|
||||
{
|
||||
machine_at_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
@@ -722,7 +722,7 @@ machine_at_scat_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_scatsx_init(machine_t *model)
|
||||
machine_at_scatsx_init(const machine_t *model)
|
||||
{
|
||||
machine_at_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* SiS sis85c471 Super I/O Chip
|
||||
* Used by DTK PKM-0038S E-2
|
||||
*
|
||||
* Version: @(#)m_at_sis85c471.c 1.0.9 2018/01/16
|
||||
* Version: @(#)m_at_sis85c471.c 1.0.10 2018/03/18
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -240,7 +240,7 @@ static void sis_85c471_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_dtk486_init(machine_t *model)
|
||||
machine_at_dtk486_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ide_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
@@ -162,7 +162,7 @@ static void sis_85c496_init(void)
|
||||
|
||||
|
||||
static void
|
||||
machine_at_sis_85c496_common_init(machine_t *model)
|
||||
machine_at_sis_85c496_common_init(const machine_t *model)
|
||||
{
|
||||
machine_at_ps2_init(model);
|
||||
device_add(&ide_pci_device);
|
||||
@@ -180,7 +180,7 @@ machine_at_sis_85c496_common_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_at_r418_init(machine_t *model)
|
||||
machine_at_r418_init(const machine_t *model)
|
||||
{
|
||||
machine_at_sis_85c496_common_init(model);
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
*
|
||||
* Emulation of the SiS 50x PCI chips.
|
||||
*
|
||||
* Version: @(#)m_at_sis_85c50x.c 1.0.5 2017/11/04
|
||||
* Version: @(#)m_at_sis_85c50x.c 1.0.6 2018/03/18
|
||||
*
|
||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2017 Miran Grca.
|
||||
* Copyright 2015-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
* bit 2 set for single-pixel LCD font
|
||||
* bits 0,1 for display font
|
||||
*
|
||||
* Version: @(#)m_at_t3100e.c 1.0.3 2018/03/05
|
||||
* Version: @(#)m_at_t3100e.c 1.0.4 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -716,7 +716,7 @@ static void upper_write_raml(uint32_t addr, uint32_t val, void *priv)
|
||||
|
||||
|
||||
|
||||
void machine_at_t3100e_init(machine_t *model)
|
||||
void machine_at_t3100e_init(const machine_t *model)
|
||||
{
|
||||
int pg;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the Toshiba T3100e system.
|
||||
*
|
||||
* Version: @(#)m_at_t3100e.h 1.0.2 2018/03/05
|
||||
* Version: @(#)m_at_t3100e.h 1.0.3 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -40,7 +40,7 @@
|
||||
# define MACHINE_T3100E_H
|
||||
|
||||
|
||||
extern device_t t3100e_device;
|
||||
extern const device_t t3100e_device;
|
||||
|
||||
|
||||
extern void t3100e_notify_set(uint8_t value);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 61 50 52 0F 19 06 19 19 02 0D 0B 0C MONO
|
||||
* 2D 28 22 0A 67 00 64 67 02 03 06 07 640x400
|
||||
*
|
||||
* Version: @(#)m_at_t3100e_vid.c 1.0.3 2018/03/07
|
||||
* Version: @(#)m_at_t3100e_vid.c 1.0.4 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -703,7 +703,7 @@ void t3100e_recalcattrs(t3100e_t *t3100e)
|
||||
}
|
||||
|
||||
|
||||
void *t3100e_init(device_t *info)
|
||||
void *t3100e_init(const device_t *info)
|
||||
{
|
||||
t3100e_t *t3100e = malloc(sizeof(t3100e_t));
|
||||
memset(t3100e, 0, sizeof(t3100e_t));
|
||||
@@ -748,7 +748,7 @@ void t3100e_speed_changed(void *p)
|
||||
t3100e_recalctimings(t3100e);
|
||||
}
|
||||
|
||||
device_t t3100e_device =
|
||||
const device_t t3100e_device =
|
||||
{
|
||||
"Toshiba T3100e",
|
||||
0,
|
||||
|
||||
@@ -142,7 +142,7 @@ static void wd76c10_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_at_wd76c10_init(machine_t *model)
|
||||
machine_at_wd76c10_init(const machine_t *model)
|
||||
{
|
||||
machine_at_common_ide_init(model);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
*
|
||||
* WARNING THIS IS A WORK-IN-PROGRESS MODULE. USE AT OWN RISK.
|
||||
*
|
||||
* Version: @(#)europc.c 1.0.2 2018/03/11
|
||||
* Version: @(#)europc.c 1.0.3 2018/03/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -546,7 +546,7 @@ jim_read(uint16_t addr, void *priv)
|
||||
|
||||
/* Initialize the mainboard 'device' of the machine. */
|
||||
static void *
|
||||
europc_boot(device_t *info)
|
||||
europc_boot(const device_t *info)
|
||||
{
|
||||
europc_t *sys = &europc;
|
||||
uint8_t b;
|
||||
@@ -674,7 +674,7 @@ europc_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t europc_config[] = {
|
||||
static const device_config_t europc_config[] = {
|
||||
{
|
||||
"js9", "JS9 Jumper (JIM)", CONFIG_INT, "", 0,
|
||||
{
|
||||
@@ -695,7 +695,7 @@ static device_config_t europc_config[] = {
|
||||
};
|
||||
|
||||
|
||||
device_t europc_device = {
|
||||
const device_t europc_device = {
|
||||
"EuroPC System Board",
|
||||
0, 0,
|
||||
europc_boot, europc_close, NULL,
|
||||
@@ -713,7 +713,7 @@ device_t europc_device = {
|
||||
* user.
|
||||
*/
|
||||
void
|
||||
machine_europc_init(machine_t *model)
|
||||
machine_europc_init(const machine_t *model)
|
||||
{
|
||||
/* Clear the machine state. */
|
||||
memset(&europc, 0x00, sizeof(europc_t));
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*
|
||||
* Based on the original "xebec.c" from Sarah Walker.
|
||||
*
|
||||
* Version: @(#)m_europc_hdc.c 1.0.2 2018/03/11
|
||||
* Version: @(#)m_europc_hdc.c 1.0.3 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
@@ -902,7 +902,7 @@ hd20_write(uint16_t port, uint8_t val, void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
hd20_init(device_t *info)
|
||||
hd20_init(const device_t *info)
|
||||
{
|
||||
drive_t *drive;
|
||||
hd20_t *dev;
|
||||
@@ -978,7 +978,7 @@ hd20_available(void)
|
||||
}
|
||||
|
||||
|
||||
device_t europc_hdc_device = {
|
||||
const device_t europc_hdc_device = {
|
||||
"EuroPC HD20",
|
||||
0, 0,
|
||||
hd20_init, hd20_close, NULL,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the Olivetti M24.
|
||||
*
|
||||
* Version: @(#)m_olivetti_m24.c 1.0.10 2018/01/29
|
||||
* Version: @(#)m_olivetti_m24.c 1.0.11 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -789,7 +789,7 @@ vid_close(void *priv)
|
||||
free(m24);
|
||||
}
|
||||
|
||||
device_t m24_device = {
|
||||
const device_t m24_device = {
|
||||
"Olivetti M24",
|
||||
0, 0,
|
||||
NULL, vid_close, NULL,
|
||||
@@ -801,7 +801,7 @@ device_t m24_device = {
|
||||
|
||||
|
||||
void
|
||||
machine_olim24_init(machine_t *model)
|
||||
machine_olim24_init(const machine_t *model)
|
||||
{
|
||||
olim24_t *m24;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of the IBM PCjr.
|
||||
*
|
||||
* Version: @(#)m_pcjr.c 1.0.5 2018/02/09
|
||||
* Version: @(#)m_pcjr.c 1.0.6 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -693,7 +693,7 @@ speed_changed(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t pcjr_config[] = {
|
||||
static const device_config_t pcjr_config[] = {
|
||||
{
|
||||
"display_type", "Display type", CONFIG_SELECTION, "", PCJR_RGB,
|
||||
{
|
||||
@@ -714,7 +714,7 @@ static device_config_t pcjr_config[] = {
|
||||
};
|
||||
|
||||
|
||||
static device_t pcjr_device = {
|
||||
static const device_t pcjr_device = {
|
||||
"IBM PCjr",
|
||||
0, 0,
|
||||
NULL, NULL, NULL,
|
||||
@@ -726,7 +726,7 @@ static device_t pcjr_device = {
|
||||
};
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
pcjr_get_device(void)
|
||||
{
|
||||
return &pcjr_device;
|
||||
@@ -734,7 +734,7 @@ pcjr_get_device(void)
|
||||
|
||||
|
||||
void
|
||||
machine_pcjr_init(machine_t *model)
|
||||
machine_pcjr_init(const machine_t *model)
|
||||
{
|
||||
int display_type;
|
||||
pcjr_t *pcjr;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* boot. Sometimes, they do, and then it shows an "Incorrect
|
||||
* DOS" error message?? --FvK
|
||||
*
|
||||
* Version: @(#)m_ps1.c 1.0.6 2018/02/14
|
||||
* Version: @(#)m_ps1.c 1.0.7 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -236,7 +236,7 @@ snd_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
snd_init(device_t *info)
|
||||
snd_init(const device_t *info)
|
||||
{
|
||||
ps1snd_t *snd;
|
||||
|
||||
@@ -265,7 +265,7 @@ snd_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t snd_device = {
|
||||
static const device_t snd_device = {
|
||||
"PS/1 Audio Card",
|
||||
0, 0,
|
||||
snd_init, snd_close, NULL,
|
||||
@@ -535,7 +535,7 @@ ps1_setup(int model)
|
||||
|
||||
|
||||
static void
|
||||
ps1_common_init(machine_t *model)
|
||||
ps1_common_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
@@ -570,7 +570,7 @@ ps1_common_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_ps1_m2011_init(machine_t *model)
|
||||
machine_ps1_m2011_init(const machine_t *model)
|
||||
{
|
||||
ps1_common_init(model);
|
||||
|
||||
@@ -579,7 +579,7 @@ machine_ps1_m2011_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_ps1_m2121_init(machine_t *model)
|
||||
machine_ps1_m2121_init(const machine_t *model)
|
||||
{
|
||||
ps1_common_init(model);
|
||||
|
||||
@@ -588,7 +588,7 @@ machine_ps1_m2121_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_ps1_m2133_init(machine_t *model)
|
||||
machine_ps1_m2133_init(const machine_t *model)
|
||||
{
|
||||
ps1_common_init(model);
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ static void ps2board_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_ps2_m30_286_init(machine_t *model)
|
||||
machine_ps2_m30_286_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
device_add(&fdc_at_ps1_device);
|
||||
|
||||
@@ -1218,7 +1218,7 @@ static void ps2_mca_board_model_80_type2_init(int is486)
|
||||
|
||||
|
||||
static void
|
||||
machine_ps2_common_init(machine_t *model)
|
||||
machine_ps2_common_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
device_add(&fdc_at_device);
|
||||
@@ -1236,7 +1236,7 @@ machine_ps2_common_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_ps2_model_50_init(machine_t *model)
|
||||
machine_ps2_model_50_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
@@ -1245,7 +1245,7 @@ machine_ps2_model_50_init(machine_t *model)
|
||||
|
||||
|
||||
void
|
||||
machine_ps2_model_55sx_init(machine_t *model)
|
||||
machine_ps2_model_55sx_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ machine_ps2_model_55sx_init(machine_t *model)
|
||||
}
|
||||
|
||||
void
|
||||
machine_ps2_model_70_type3_init(machine_t *model)
|
||||
machine_ps2_model_70_type3_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
@@ -1261,7 +1261,7 @@ machine_ps2_model_70_type3_init(machine_t *model)
|
||||
}
|
||||
|
||||
void
|
||||
machine_ps2_model_70_type4_init(machine_t *model)
|
||||
machine_ps2_model_70_type4_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
@@ -1269,7 +1269,7 @@ machine_ps2_model_70_type4_init(machine_t *model)
|
||||
}
|
||||
|
||||
void
|
||||
machine_ps2_model_80_init(machine_t *model)
|
||||
machine_ps2_model_80_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
@@ -1279,7 +1279,7 @@ machine_ps2_model_80_init(machine_t *model)
|
||||
|
||||
#ifdef WALTJE
|
||||
void
|
||||
machine_ps2_model_80_486_init(machine_t *model)
|
||||
machine_ps2_model_80_486_init(const machine_t *model)
|
||||
{
|
||||
machine_ps2_common_init(model);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of Tandy models 1000, 1000HX and 1000SL2.
|
||||
*
|
||||
* Version: @(#)m_tandy.c 1.0.3 2018/02/09
|
||||
* Version: @(#)m_tandy.c 1.0.4 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -1353,7 +1353,7 @@ vid_init(tandy_t *dev)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t vid_config[] = {
|
||||
static const device_config_t vid_config[] = {
|
||||
{
|
||||
"display_type", "Display type", CONFIG_SELECTION, "", TANDY_RGB,
|
||||
{
|
||||
@@ -1374,7 +1374,7 @@ static device_config_t vid_config[] = {
|
||||
};
|
||||
|
||||
|
||||
static device_t vid_device = {
|
||||
static const device_t vid_device = {
|
||||
"Tandy 1000",
|
||||
0, 0,
|
||||
NULL, vid_close, NULL,
|
||||
@@ -1385,7 +1385,7 @@ static device_t vid_device = {
|
||||
vid_config
|
||||
};
|
||||
|
||||
static device_t vid_device_hx = {
|
||||
static const device_t vid_device_hx = {
|
||||
"Tandy 1000 HX",
|
||||
0, 0,
|
||||
NULL, vid_close, NULL,
|
||||
@@ -1396,7 +1396,7 @@ static device_t vid_device_hx = {
|
||||
vid_config
|
||||
};
|
||||
|
||||
static device_t vid_device_sl = {
|
||||
static const device_t vid_device_sl = {
|
||||
"Tandy 1000SL2",
|
||||
0, 1,
|
||||
NULL, vid_close, NULL,
|
||||
@@ -1408,14 +1408,14 @@ static device_t vid_device_sl = {
|
||||
};
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
tandy1k_get_device(void)
|
||||
{
|
||||
return &vid_device;
|
||||
}
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
tandy1k_hx_get_device(void)
|
||||
{
|
||||
return &vid_device_hx;
|
||||
@@ -1501,7 +1501,7 @@ eep_write(uint16_t addr, uint8_t val, void *priv)
|
||||
|
||||
|
||||
static void *
|
||||
eep_init(device_t *info)
|
||||
eep_init(const device_t *info)
|
||||
{
|
||||
t1keep_t *eep;
|
||||
FILE *f = NULL;
|
||||
@@ -1548,7 +1548,7 @@ eep_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_t eep_device = {
|
||||
static const device_t eep_device = {
|
||||
"Tandy 1000 EEPROM",
|
||||
0, 0,
|
||||
eep_init, eep_close, NULL,
|
||||
@@ -1692,7 +1692,7 @@ init_rom(tandy_t *dev)
|
||||
|
||||
|
||||
void
|
||||
machine_tandy1k_init(machine_t *model)
|
||||
machine_tandy1k_init(const machine_t *model)
|
||||
{
|
||||
tandy_t *dev;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
void
|
||||
machine_xt_init(machine_t *model)
|
||||
machine_xt_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Emulation of various Compaq XT-class PC's.
|
||||
*
|
||||
* Version: @(#)m_xt_compaq.c 1.0.3 2018/02/24
|
||||
* Version: @(#)m_xt_compaq.c 1.0.4 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
|
||||
void
|
||||
machine_xt_compaq_init(machine_t *model)
|
||||
machine_xt_compaq_init(const machine_t *model)
|
||||
{
|
||||
machine_common_init(model);
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ static void laserxt_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_xt_laserxt_init(machine_t *model)
|
||||
machine_xt_laserxt_init(const machine_t *model)
|
||||
{
|
||||
machine_xt_init(model);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
* NOTE: Still need to figure out a way to load/save ConfigSys and
|
||||
* HardRAM stuff. Needs to be linked in to the NVR code.
|
||||
*
|
||||
* Version: @(#)m_xt_t1000.c 1.0.2 2018/03/11
|
||||
* Version: @(#)m_xt_t1000.c 1.0.3 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -784,7 +784,7 @@ t1000_read_roml(uint32_t addr, void *priv)
|
||||
return(*(uint32_t *)(&sys->romdrive[sys->rom_offset + (addr & 0xffff)]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const device_t *
|
||||
t1000_get_device(void)
|
||||
{
|
||||
@@ -792,7 +792,7 @@ t1000_get_device(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
machine_xt_t1000_init(const machine_t *model)
|
||||
{
|
||||
FILE *f;
|
||||
@@ -862,7 +862,7 @@ machine_xt_t1000_init(machine_t *model)
|
||||
device_add(&t1000_video_device);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const device_t *
|
||||
t1200_get_device(void)
|
||||
{
|
||||
@@ -870,7 +870,7 @@ t1200_get_device(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
machine_xt_t1200_init(const machine_t *model)
|
||||
{
|
||||
int pg;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the Toshiba T1000/T1200 machines.
|
||||
*
|
||||
* Version: @(#)m_xt_t1000.h 1.0.2 2018/03/10
|
||||
* Version: @(#)m_xt_t1000.h 1.0.3 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -40,8 +40,8 @@
|
||||
# define MACHINE_T1000_H
|
||||
|
||||
|
||||
extern device_t t1000_video_device;
|
||||
extern device_t t1200_video_device;
|
||||
extern const device_t t1000_video_device;
|
||||
extern const device_t t1200_video_device;
|
||||
|
||||
|
||||
extern void t1000_video_options_set(uint8_t options);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Implementation of the Toshiba T1000 plasma display, which
|
||||
* has a fixed resolution of 640x200 pixels.
|
||||
*
|
||||
* Version: @(#)m_xt_t1000_vid.c 1.0.4 2018/03/10
|
||||
* Version: @(#)m_xt_t1000_vid.c 1.0.5 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -658,7 +658,7 @@ static void t1000_recalcattrs(t1000_t *t1000)
|
||||
}
|
||||
|
||||
|
||||
static void *t1000_init(device_t *info)
|
||||
static void *t1000_init(const device_t *info)
|
||||
{
|
||||
t1000_t *t1000 = malloc(sizeof(t1000_t));
|
||||
memset(t1000, 0, sizeof(t1000_t));
|
||||
@@ -704,7 +704,7 @@ static void t1000_speed_changed(void *p)
|
||||
t1000_recalctimings(t1000);
|
||||
}
|
||||
|
||||
static device_config_t t1000_config[] =
|
||||
static const device_config_t t1000_config[] =
|
||||
{
|
||||
{
|
||||
.name = "display_language",
|
||||
@@ -729,7 +729,7 @@ static device_config_t t1000_config[] =
|
||||
};
|
||||
|
||||
|
||||
device_t t1000_video_device = {
|
||||
const device_t t1000_video_device = {
|
||||
"Toshiba T1000 Video",
|
||||
0, 0,
|
||||
t1000_init, t1000_close, NULL,
|
||||
@@ -741,7 +741,7 @@ device_t t1000_video_device = {
|
||||
};
|
||||
|
||||
|
||||
device_t t1200_video_device = {
|
||||
const device_t t1200_video_device = {
|
||||
"Toshiba T1200 Video",
|
||||
0, 0,
|
||||
t1000_init, t1000_close, NULL,
|
||||
|
||||
@@ -76,7 +76,7 @@ static void *xi8088_init()
|
||||
return &xi8088;
|
||||
}
|
||||
|
||||
static device_config_t xi8088_config[] =
|
||||
static const device_config_t xi8088_config[] =
|
||||
{
|
||||
{
|
||||
.name = "turbo_setting",
|
||||
@@ -101,7 +101,7 @@ static device_config_t xi8088_config[] =
|
||||
};
|
||||
|
||||
|
||||
device_t xi8088_device =
|
||||
const device_t xi8088_device =
|
||||
{
|
||||
"Xi8088",
|
||||
0,
|
||||
@@ -116,13 +116,13 @@ device_t xi8088_device =
|
||||
xi8088_config
|
||||
};
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
xi8088_get_device(void)
|
||||
{
|
||||
return &xi8088_device;
|
||||
}
|
||||
|
||||
void machine_xt_xi8088_init(machine_t *model)
|
||||
void machine_xt_xi8088_init(const machine_t *model)
|
||||
{
|
||||
/* TODO: set UMBs? See if PCem always sets when we have > 640KB ram and avoids conflicts when a peripheral uses the same memory space */
|
||||
machine_common_init(model);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "../device.h"
|
||||
|
||||
extern device_t xi8088_device;
|
||||
extern const device_t xi8088_device;
|
||||
|
||||
uint8_t xi8088_turbo_get();
|
||||
void xi8088_turbo_set(uint8_t value);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the emulated machines.
|
||||
*
|
||||
* Version: @(#)machine.c 1.0.30 2018/03/15
|
||||
* Version: @(#)machine.c 1.0.31 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -65,7 +65,7 @@ machine_init(void)
|
||||
|
||||
|
||||
void
|
||||
machine_common_init(machine_t *model)
|
||||
machine_common_init(const machine_t *model)
|
||||
{
|
||||
/* System devices first. */
|
||||
dma_init();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handling of the emulated machines.
|
||||
*
|
||||
* Version: @(#)machine.h 1.0.21 2018/03/02
|
||||
* Version: @(#)machine.h 1.0.22 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -58,9 +58,9 @@ typedef struct _machine_ {
|
||||
int min_ram, max_ram;
|
||||
int ram_granularity;
|
||||
int nvrmask;
|
||||
void (*init)(struct _machine_ *);
|
||||
void (*init)(const struct _machine_ *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
device_t *(*get_device)(void);
|
||||
const device_t *(*get_device)(void);
|
||||
#else
|
||||
void *get_device;
|
||||
#endif
|
||||
@@ -69,7 +69,7 @@ typedef struct _machine_ {
|
||||
|
||||
|
||||
/* Global variables. */
|
||||
extern machine_t machines[];
|
||||
extern const machine_t machines[];
|
||||
extern int machine;
|
||||
extern int romset;
|
||||
extern int AT, PCI;
|
||||
@@ -84,7 +84,7 @@ extern char *machine_get_internal_name(void);
|
||||
extern int machine_get_machine_from_internal_name(char *s);
|
||||
extern void machine_init(void);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t *machine_getdevice(int machine);
|
||||
extern const device_t *machine_getdevice(int machine);
|
||||
#endif
|
||||
extern int machine_getromset_ex(int m);
|
||||
extern char *machine_get_internal_name_ex(int m);
|
||||
@@ -93,119 +93,119 @@ extern void machine_close(void);
|
||||
|
||||
|
||||
/* Initialization functions for boards and systems. */
|
||||
extern void machine_common_init(machine_t *);
|
||||
extern void machine_common_init(const machine_t *);
|
||||
|
||||
extern void machine_at_common_init(machine_t *);
|
||||
extern void machine_at_init(machine_t *);
|
||||
extern void machine_at_ps2_init(machine_t *);
|
||||
extern void machine_at_common_ide_init(machine_t *);
|
||||
extern void machine_at_ide_init(machine_t *);
|
||||
extern void machine_at_ps2_ide_init(machine_t *);
|
||||
extern void machine_at_top_remap_init(machine_t *);
|
||||
extern void machine_at_ide_top_remap_init(machine_t *);
|
||||
extern void machine_at_common_init(const machine_t *);
|
||||
extern void machine_at_init(const machine_t *);
|
||||
extern void machine_at_ps2_init(const machine_t *);
|
||||
extern void machine_at_common_ide_init(const machine_t *);
|
||||
extern void machine_at_ide_init(const machine_t *);
|
||||
extern void machine_at_ps2_ide_init(const machine_t *);
|
||||
extern void machine_at_top_remap_init(const machine_t *);
|
||||
extern void machine_at_ide_top_remap_init(const machine_t *);
|
||||
|
||||
extern void machine_at_ibm_init(machine_t *);
|
||||
extern void machine_at_ibm_init(const machine_t *);
|
||||
|
||||
extern void machine_at_t3100e_init(machine_t *);
|
||||
extern void machine_at_t3100e_init(const machine_t *);
|
||||
|
||||
extern void machine_at_p54tp4xe_init(machine_t *);
|
||||
extern void machine_at_endeavor_init(machine_t *);
|
||||
extern void machine_at_zappa_init(machine_t *);
|
||||
extern void machine_at_mb500n_init(machine_t *);
|
||||
extern void machine_at_president_init(machine_t *);
|
||||
extern void machine_at_thor_init(machine_t *);
|
||||
extern void machine_at_p54tp4xe_init(const machine_t *);
|
||||
extern void machine_at_endeavor_init(const machine_t *);
|
||||
extern void machine_at_zappa_init(const machine_t *);
|
||||
extern void machine_at_mb500n_init(const machine_t *);
|
||||
extern void machine_at_president_init(const machine_t *);
|
||||
extern void machine_at_thor_init(const machine_t *);
|
||||
|
||||
extern void machine_at_acerm3a_init(machine_t *);
|
||||
extern void machine_at_acerv35n_init(machine_t *);
|
||||
extern void machine_at_ap53_init(machine_t *);
|
||||
extern void machine_at_p55t2p4_init(machine_t *);
|
||||
extern void machine_at_p55t2s_init(machine_t *);
|
||||
extern void machine_at_acerm3a_init(const machine_t *);
|
||||
extern void machine_at_acerv35n_init(const machine_t *);
|
||||
extern void machine_at_ap53_init(const machine_t *);
|
||||
extern void machine_at_p55t2p4_init(const machine_t *);
|
||||
extern void machine_at_p55t2s_init(const machine_t *);
|
||||
|
||||
extern void machine_at_batman_init(machine_t *);
|
||||
extern void machine_at_plato_init(machine_t *);
|
||||
extern void machine_at_batman_init(const machine_t *);
|
||||
extern void machine_at_plato_init(const machine_t *);
|
||||
|
||||
extern void machine_at_p55tvp4_init(machine_t *);
|
||||
extern void machine_at_i430vx_init(machine_t *);
|
||||
extern void machine_at_p55va_init(machine_t *);
|
||||
extern void machine_at_p55tvp4_init(const machine_t *);
|
||||
extern void machine_at_i430vx_init(const machine_t *);
|
||||
extern void machine_at_p55va_init(const machine_t *);
|
||||
|
||||
#if defined(DEV_BRANCH) && defined(USE_I686)
|
||||
extern void machine_at_i440fx_init(machine_t *);
|
||||
extern void machine_at_s1668_init(machine_t *);
|
||||
extern void machine_at_i440fx_init(const machine_t *);
|
||||
extern void machine_at_s1668_init(const machine_t *);
|
||||
#endif
|
||||
extern void machine_at_ali1429_init(machine_t *);
|
||||
extern void machine_at_cmdpc_init(machine_t *);
|
||||
extern void machine_at_ali1429_init(const machine_t *);
|
||||
extern void machine_at_cmdpc_init(const machine_t *);
|
||||
|
||||
extern void machine_at_headland_init(machine_t *);
|
||||
extern void machine_at_neat_init(machine_t *);
|
||||
extern void machine_at_neat_ami_init(machine_t *);
|
||||
extern void machine_at_opti495_init(machine_t *);
|
||||
extern void machine_at_opti495_ami_init(machine_t *);
|
||||
extern void machine_at_scat_init(machine_t *);
|
||||
extern void machine_at_scatsx_init(machine_t *);
|
||||
extern void machine_at_compaq_init(machine_t *);
|
||||
extern void machine_at_headland_init(const machine_t *);
|
||||
extern void machine_at_neat_init(const machine_t *);
|
||||
extern void machine_at_neat_ami_init(const machine_t *);
|
||||
extern void machine_at_opti495_init(const machine_t *);
|
||||
extern void machine_at_opti495_ami_init(const machine_t *);
|
||||
extern void machine_at_scat_init(const machine_t *);
|
||||
extern void machine_at_scatsx_init(const machine_t *);
|
||||
extern void machine_at_compaq_init(const machine_t *);
|
||||
|
||||
extern void machine_at_dtk486_init(machine_t *);
|
||||
extern void machine_at_r418_init(machine_t *);
|
||||
extern void machine_at_dtk486_init(const machine_t *);
|
||||
extern void machine_at_r418_init(const machine_t *);
|
||||
|
||||
extern void machine_at_wd76c10_init(machine_t *);
|
||||
extern void machine_at_wd76c10_init(const machine_t *);
|
||||
|
||||
#if defined(DEV_BRANCH) && defined(USE_GREENB)
|
||||
extern void machine_at_4gpv31_init(machine_t *);
|
||||
extern void machine_at_4gpv31_init(const machine_t *);
|
||||
#endif
|
||||
|
||||
extern void machine_pcjr_init(machine_t *);
|
||||
extern void machine_pcjr_init(const 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_ps1_m2011_init(const machine_t *);
|
||||
extern void machine_ps1_m2121_init(const machine_t *);
|
||||
extern void machine_ps1_m2133_init(const 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_70_type3_init(machine_t *);
|
||||
extern void machine_ps2_model_70_type4_init(machine_t *);
|
||||
extern void machine_ps2_model_80_init(machine_t *);
|
||||
extern void machine_ps2_m30_286_init(const machine_t *);
|
||||
extern void machine_ps2_model_50_init(const machine_t *);
|
||||
extern void machine_ps2_model_55sx_init(const machine_t *);
|
||||
extern void machine_ps2_model_70_type3_init(const machine_t *);
|
||||
extern void machine_ps2_model_70_type4_init(const machine_t *);
|
||||
extern void machine_ps2_model_80_init(const machine_t *);
|
||||
#ifdef WALTJE
|
||||
extern void machine_ps2_model_80_486_init(machine_t *);
|
||||
extern void machine_ps2_model_80_486_init(const machine_t *);
|
||||
#endif
|
||||
|
||||
extern void machine_amstrad_init(machine_t *);
|
||||
extern void machine_amstrad_init(const machine_t *);
|
||||
|
||||
extern void machine_europc_init(machine_t *);
|
||||
extern void machine_europc_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t europc_device,
|
||||
extern const device_t europc_device,
|
||||
europc_hdc_device;
|
||||
#endif
|
||||
|
||||
extern void machine_olim24_init(machine_t *);
|
||||
extern void machine_olim24_init(const machine_t *);
|
||||
extern void machine_olim24_video_init(void);
|
||||
|
||||
extern void machine_tandy1k_init(machine_t *);
|
||||
extern void machine_tandy1k_init(const machine_t *);
|
||||
extern int tandy1k_eeprom_read(void);
|
||||
|
||||
extern void machine_xt_init(machine_t *);
|
||||
extern void machine_xt_compaq_init(machine_t *);
|
||||
extern void machine_xt_init(const machine_t *);
|
||||
extern void machine_xt_compaq_init(const machine_t *);
|
||||
#if defined(DEV_BRANCH) && defined(USE_LASERXT)
|
||||
extern void machine_xt_laserxt_init(machine_t *);
|
||||
extern void machine_xt_laserxt_init(const machine_t *);
|
||||
#endif
|
||||
|
||||
extern void machine_xt_t1000_init(machine_t *);
|
||||
extern void machine_xt_t1200_init(machine_t *);
|
||||
extern void machine_xt_t1000_init(const machine_t *);
|
||||
extern void machine_xt_t1200_init(const machine_t *);
|
||||
|
||||
extern void machine_xt_xi8088_init(machine_t *);
|
||||
extern void machine_xt_xi8088_init(const machine_t *);
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t *xi8088_get_device(void);
|
||||
extern const device_t *xi8088_get_device(void);
|
||||
|
||||
extern device_t *pcjr_get_device(void);
|
||||
extern const device_t *pcjr_get_device(void);
|
||||
|
||||
extern device_t *tandy1k_get_device(void);
|
||||
extern device_t *tandy1k_hx_get_device(void);
|
||||
extern const device_t *tandy1k_get_device(void);
|
||||
extern const device_t *tandy1k_hx_get_device(void);
|
||||
|
||||
extern device_t *t1000_get_device(void);
|
||||
extern device_t *t1200_get_device(void);
|
||||
extern const device_t *t1000_get_device(void);
|
||||
extern const device_t *t1200_get_device(void);
|
||||
|
||||
extern device_t *at_endeavor_get_device(void);
|
||||
extern const device_t *at_endeavor_get_device(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* NOTES: OpenAT wip for 286-class machine with open BIOS.
|
||||
* PS2_M80-486 wip, pending receipt of TRM's for machine.
|
||||
*
|
||||
* Version: @(#)machine_table.c 1.0.25 2018/03/13
|
||||
* Version: @(#)machine_table.c 1.0.26 2018/03/18
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "machine.h"
|
||||
|
||||
|
||||
machine_t machines[] = {
|
||||
const machine_t machines[] = {
|
||||
{ "[8088] AMI XT clone", ROM_AMIXT, "amixt", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA, 64, 640, 64, 0, machine_xt_init, NULL, NULL },
|
||||
{ "[8088] Compaq Portable", ROM_PORTABLE, "portable", {{"", cpus_8088}, {"", NULL}, {"", NULL}, {"", NULL}, {"", NULL}}, 0, MACHINE_ISA | MACHINE_VIDEO, 128, 640, 128, 0, machine_xt_compaq_init, NULL, 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, NULL },
|
||||
@@ -223,7 +223,7 @@ machine_getname(void)
|
||||
}
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
machine_getdevice(int machine)
|
||||
{
|
||||
if (machines[machine].get_device)
|
||||
|
||||
12
src/mouse.c
12
src/mouse.c
@@ -11,7 +11,7 @@
|
||||
* TODO: Add the Genius bus- and serial mouse.
|
||||
* Remove the '3-button' flag from mouse types.
|
||||
*
|
||||
* Version: @(#)mouse.c 1.0.22 2018/03/18
|
||||
* Version: @(#)mouse.c 1.0.23 2018/03/18
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
typedef struct {
|
||||
const char *internal_name;
|
||||
device_t *device;
|
||||
const device_t *device;
|
||||
} mouse_t;
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@ int mouse_x,
|
||||
mouse_buttons;
|
||||
|
||||
|
||||
static device_t mouse_none_device = {
|
||||
static const device_t mouse_none_device = {
|
||||
"None",
|
||||
0, MOUSE_TYPE_NONE,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
static device_t mouse_internal_device = {
|
||||
static const device_t mouse_internal_device = {
|
||||
"Internal Mouse",
|
||||
0, MOUSE_TYPE_INTERNAL,
|
||||
NULL, NULL, NULL,
|
||||
@@ -72,7 +72,7 @@ static mouse_t mouse_devices[] = {
|
||||
};
|
||||
|
||||
|
||||
static device_t *mouse_curr;
|
||||
static const device_t *mouse_curr;
|
||||
static void *mouse_priv;
|
||||
static int mouse_nbut;
|
||||
static int (*mouse_dev_poll)();
|
||||
@@ -211,7 +211,7 @@ mouse_has_config(int mouse)
|
||||
}
|
||||
|
||||
|
||||
device_t *
|
||||
const device_t *
|
||||
mouse_get_device(int mouse)
|
||||
{
|
||||
return(mouse_devices[mouse].device);
|
||||
|
||||
18
src/mouse.h
18
src/mouse.h
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Definitions for the mouse driver.
|
||||
*
|
||||
* Version: @(#)mouse.h 1.0.14 2018/01/29
|
||||
* Version: @(#)mouse.h 1.0.15 2018/03/18
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -44,17 +44,17 @@ extern int mouse_buttons;
|
||||
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern device_t *mouse_get_device(int mouse);
|
||||
extern void *mouse_ps2_init(device_t *);
|
||||
extern const device_t *mouse_get_device(int mouse);
|
||||
extern void *mouse_ps2_init(const device_t *);
|
||||
|
||||
extern device_t mouse_logibus_device;
|
||||
extern device_t mouse_msinport_device;
|
||||
extern const device_t mouse_logibus_device;
|
||||
extern const device_t mouse_msinport_device;
|
||||
#if 0
|
||||
extern device_t mouse_genibus_device;
|
||||
extern const device_t mouse_genibus_device;
|
||||
#endif
|
||||
extern device_t mouse_mssystems_device;
|
||||
extern device_t mouse_msserial_device;
|
||||
extern device_t mouse_ps2_device;
|
||||
extern const device_t mouse_mssystems_device;
|
||||
extern const device_t mouse_msserial_device;
|
||||
extern const device_t mouse_ps2_device;
|
||||
#endif
|
||||
|
||||
extern void mouse_init(void);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
*
|
||||
* Based on an early driver for MINIX 1.5.
|
||||
*
|
||||
* Version: @(#)mouse_bus.c 1.0.31 2018/02/01
|
||||
* Version: @(#)mouse_bus.c 1.0.32 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -669,7 +669,7 @@ bm_close(void *priv)
|
||||
|
||||
/* Initialize the device for use by the user. */
|
||||
static void *
|
||||
bm_init(device_t *info)
|
||||
bm_init(const device_t *info)
|
||||
{
|
||||
mouse_t *dev;
|
||||
int i;
|
||||
@@ -723,7 +723,7 @@ bm_init(device_t *info)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t bm_config[] = {
|
||||
static const device_config_t bm_config[] = {
|
||||
{
|
||||
"irq", "IRQ", CONFIG_SELECTION, "", MOUSE_IRQ, {
|
||||
{
|
||||
@@ -762,7 +762,7 @@ static device_config_t bm_config[] = {
|
||||
};
|
||||
|
||||
|
||||
device_t mouse_logibus_device = {
|
||||
const device_t mouse_logibus_device = {
|
||||
"Logitech Bus Mouse",
|
||||
DEVICE_ISA,
|
||||
MOUSE_TYPE_LOGIBUS,
|
||||
@@ -771,7 +771,7 @@ device_t mouse_logibus_device = {
|
||||
bm_config
|
||||
};
|
||||
|
||||
device_t mouse_msinport_device = {
|
||||
const device_t mouse_msinport_device = {
|
||||
"Microsoft Bus Mouse (InPort)",
|
||||
DEVICE_ISA,
|
||||
MOUSE_TYPE_INPORT,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implementation of PS/2 series Mouse devices.
|
||||
*
|
||||
* Version: @(#)mouse_ps2.c 1.0.5 2017/12/14
|
||||
* Version: @(#)mouse_ps2.c 1.0.6 2018/03/18
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -224,7 +224,7 @@ ps2_poll(int x, int y, int z, int b, void *priv)
|
||||
* We also get called from the various machines.
|
||||
*/
|
||||
void *
|
||||
mouse_ps2_init(device_t *info)
|
||||
mouse_ps2_init(const device_t *info)
|
||||
{
|
||||
mouse_t *dev;
|
||||
int i;
|
||||
@@ -264,7 +264,7 @@ ps2_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t ps2_config[] = {
|
||||
static const device_config_t ps2_config[] = {
|
||||
{
|
||||
"buttons", "Buttons", CONFIG_SELECTION, "", 2, {
|
||||
{
|
||||
@@ -287,7 +287,7 @@ static device_config_t ps2_config[] = {
|
||||
};
|
||||
|
||||
|
||||
device_t mouse_ps2_device = {
|
||||
const device_t mouse_ps2_device = {
|
||||
"Standard PS/2 Mouse",
|
||||
0,
|
||||
MOUSE_TYPE_PS2,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* TODO: Add the Genius Serial Mouse.
|
||||
*
|
||||
* Version: @(#)mouse_serial.c 1.0.20 2018/01/25
|
||||
* Version: @(#)mouse_serial.c 1.0.21 2018/03/18
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*/
|
||||
@@ -196,7 +196,7 @@ sermouse_close(void *priv)
|
||||
|
||||
/* Initialize the device for use by the user. */
|
||||
static void *
|
||||
sermouse_init(device_t *info)
|
||||
sermouse_init(const device_t *info)
|
||||
{
|
||||
mouse_t *dev;
|
||||
int i;
|
||||
@@ -247,7 +247,7 @@ sermouse_init(device_t *info)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t sermouse_config[] = {
|
||||
static const device_config_t sermouse_config[] = {
|
||||
{
|
||||
"port", "Serial Port", CONFIG_SELECTION, "", 0, {
|
||||
{
|
||||
@@ -283,7 +283,7 @@ static device_config_t sermouse_config[] = {
|
||||
};
|
||||
|
||||
|
||||
device_t mouse_mssystems_device = {
|
||||
const device_t mouse_mssystems_device = {
|
||||
"Mouse Systems Serial Mouse",
|
||||
0,
|
||||
MOUSE_TYPE_MSYSTEMS,
|
||||
@@ -292,7 +292,7 @@ device_t mouse_mssystems_device = {
|
||||
sermouse_config
|
||||
};
|
||||
|
||||
device_t mouse_msserial_device = {
|
||||
const device_t mouse_msserial_device = {
|
||||
"Microsoft/Logitech Serial Mouse",
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -1,6 +1,39 @@
|
||||
/* Copyright holders: neozeed
|
||||
see COPYING for more details
|
||||
*/
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Various definitions for portable byte-swapping.
|
||||
*
|
||||
* Version: @(#)bswap.h 1.0.2 2018/03/12
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* neozeed,
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 neozeed.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#ifndef BSWAP_H
|
||||
#define BSWAP_H
|
||||
|
||||
@@ -138,7 +171,7 @@ static __inline void cpu_to_le16wu(uint16_t *p, uint16_t v)
|
||||
{
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v;
|
||||
p1[0] = v & 0xff;
|
||||
p1[1] = v >> 8;
|
||||
}
|
||||
|
||||
@@ -169,7 +202,7 @@ static __inline void cpu_to_be16wu(uint16_t *p, uint16_t v)
|
||||
uint8_t *p1 = (uint8_t *)p;
|
||||
|
||||
p1[0] = v >> 8;
|
||||
p1[1] = v;
|
||||
p1[1] = v & 0xff;
|
||||
}
|
||||
|
||||
static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the following network controllers:
|
||||
* - Novell NE1000 (ISA 8-bit);
|
||||
@@ -12,21 +12,36 @@
|
||||
* - Realtek RTL8019AS (ISA 16-bit, PnP);
|
||||
* - Realtek RTL8029AS (PCI).
|
||||
*
|
||||
* NOTE: The file will also implement an NE1000 for 8-bit ISA systems.
|
||||
*
|
||||
* Version: @(#)net_ne2000.c 1.0.30 2018/02/09
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Peter Grehan, <grehan@iprg.nokia.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* SA1988
|
||||
* Version: @(#)net_ne2000.c 1.0.3 2018/03/15
|
||||
*
|
||||
* Based on @(#)ne2k.cc v1.56.2.1 2004/02/02 22:37:22 cbothamy
|
||||
*
|
||||
* Portions Copyright (C) 2002 MandrakeSoft S.A.
|
||||
* Portions Copyright (C) 2018 Sarah Walker.
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Peter Grehan, <grehan@iprg.nokia.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Portions Copyright (C) 2002 MandrakeSoft S.A.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the:
|
||||
*
|
||||
* Free Software Foundation, Inc.
|
||||
* 59 Temple Place - Suite 330
|
||||
* Boston, MA 02111-1307
|
||||
* USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -2362,7 +2377,7 @@ nic_rom_init(nic_t *dev, wchar_t *s)
|
||||
|
||||
|
||||
static void *
|
||||
nic_init(device_t *info)
|
||||
nic_init(const device_t *info)
|
||||
{
|
||||
uint32_t mac;
|
||||
wchar_t *rom;
|
||||
@@ -2370,9 +2385,9 @@ nic_init(device_t *info)
|
||||
#ifdef ENABLE_NIC_LOG
|
||||
int i;
|
||||
#endif
|
||||
int c;
|
||||
char *ansi_id = "REALTEK PLUG & PLAY ETHERNET CARD";
|
||||
uint64_t *eeprom_pnp_id;
|
||||
int c;
|
||||
char *ansi_id = "REALTEK PLUG & PLAY ETHERNET CARD";
|
||||
uint64_t *eeprom_pnp_id;
|
||||
|
||||
/* Get the desired debug level. */
|
||||
#ifdef ENABLE_NIC_LOG
|
||||
@@ -2388,6 +2403,8 @@ nic_init(device_t *info)
|
||||
switch(dev->board) {
|
||||
case NE2K_NE1000:
|
||||
dev->is_8bit = 1;
|
||||
/*FALLTHROUGH*/
|
||||
|
||||
case NE2K_NE2000:
|
||||
dev->maclocal[0] = 0x00; /* 00:00:D8 (Novell OID) */
|
||||
dev->maclocal[1] = 0x00;
|
||||
@@ -2430,8 +2447,11 @@ nic_init(device_t *info)
|
||||
/* See if we have a local MAC address configured. */
|
||||
mac = device_get_config_mac("mac", -1);
|
||||
|
||||
/* Make this device known to the I/O system. */
|
||||
if (dev->board < NE2K_RTL8019AS) /* PnP and PCI devices start with address spaces inactive. */
|
||||
/*
|
||||
* Make this device known to the I/O system.
|
||||
* PnP and PCI devices start with address spaces inactive.
|
||||
*/
|
||||
if (dev->board < NE2K_RTL8019AS)
|
||||
nic_ioset(dev, dev->base_address);
|
||||
|
||||
/* Set up our BIOS ROM space, if any. */
|
||||
@@ -2473,21 +2493,21 @@ nic_init(device_t *info)
|
||||
dev->pci_regs[0x02] = (PCI_DEVID&0xff);
|
||||
dev->pci_regs[0x03] = (PCI_DEVID>>8);
|
||||
|
||||
dev->pci_regs[0x04] = 0x03; /* IOEN */
|
||||
dev->pci_regs[0x04] = 0x03; /* IOEN */
|
||||
dev->pci_regs[0x05] = 0x00;
|
||||
dev->pci_regs[0x07] = 0x02; /* DST0, medium devsel */
|
||||
dev->pci_regs[0x07] = 0x02; /* DST0, medium devsel */
|
||||
|
||||
dev->pci_regs[0x09] = 0x00; /* PIFR */
|
||||
dev->pci_regs[0x09] = 0x00; /* PIFR */
|
||||
|
||||
dev->pci_regs[0x0B] = 0x02; /* BCR: Network Controller */
|
||||
dev->pci_regs[0x0A] = 0x00; /* SCR: Ethernet */
|
||||
dev->pci_regs[0x0B] = 0x02; /* BCR: Network Controller */
|
||||
dev->pci_regs[0x0A] = 0x00; /* SCR: Ethernet */
|
||||
|
||||
dev->pci_regs[0x2C] = (PCI_VENDID&0xff);
|
||||
dev->pci_regs[0x2D] = (PCI_VENDID>>8);
|
||||
dev->pci_regs[0x2E] = (PCI_DEVID&0xff);
|
||||
dev->pci_regs[0x2F] = (PCI_DEVID>>8);
|
||||
|
||||
dev->pci_regs[0x3D] = PCI_INTA; /* PCI_IPR */
|
||||
dev->pci_regs[0x3D] = PCI_INTA; /* PCI_IPR */
|
||||
|
||||
/* Enable our address space in PCI. */
|
||||
dev->pci_bar[0].addr_regs[0] = 0x01;
|
||||
@@ -2503,8 +2523,9 @@ nic_init(device_t *info)
|
||||
|
||||
mem_mapping_disable(&dev->bios_rom.mapping);
|
||||
|
||||
/* Insert this device onto the PCI bus, keep its slot number. */
|
||||
dev->card = pci_add_card(PCI_ADD_NORMAL, nic_pci_read, nic_pci_write, dev);
|
||||
/* Add device to the PCI bus, keep its slot number. */
|
||||
dev->card = pci_add_card(PCI_ADD_NORMAL,
|
||||
nic_pci_read, nic_pci_write, dev);
|
||||
} else {
|
||||
io_sethandler(0x0279, 1,
|
||||
NULL, NULL, NULL,
|
||||
@@ -2536,52 +2557,52 @@ nic_init(device_t *info)
|
||||
eeprom_pnp_id = (uint64_t *) &dev->eeprom[0x12];
|
||||
*eeprom_pnp_id = dev->pnp_id;
|
||||
|
||||
/* TAG: Plug and Play Version Number */
|
||||
dev->eeprom[0x1B] = 0x0A; /* Item byte */
|
||||
dev->eeprom[0x1C] = 0x10; /* PnP version */
|
||||
dev->eeprom[0x1D] = 0x10; /* Vendor version */
|
||||
/* TAG: Plug and Play Version Number. */
|
||||
dev->eeprom[0x1B] = 0x0A; /* Item byte */
|
||||
dev->eeprom[0x1C] = 0x10; /* PnP version */
|
||||
dev->eeprom[0x1D] = 0x10; /* Vendor version */
|
||||
|
||||
/* TAG: ANSI Identifier String */
|
||||
dev->eeprom[0x1E] = 0x82; /* Item byte */
|
||||
dev->eeprom[0x1F] = 0x22; /* Length bits 7-0 */
|
||||
dev->eeprom[0x20] = 0x00; /* Length bits 15-8 */
|
||||
memcpy(&dev->eeprom[0x21], ansi_id, 0x22); /* Identifier string */
|
||||
/* TAG: ANSI Identifier String. */
|
||||
dev->eeprom[0x1E] = 0x82; /* Item byte */
|
||||
dev->eeprom[0x1F] = 0x22; /* Length bits 7-0 */
|
||||
dev->eeprom[0x20] = 0x00; /* Length bits 15-8 */
|
||||
memcpy(&dev->eeprom[0x21], ansi_id, 0x22);
|
||||
|
||||
/* TAG: Logical Device ID */
|
||||
dev->eeprom[0x43] = 0x16; /* Item byte */
|
||||
dev->eeprom[0x44] = 0x4A; /* Logical device ID0 */
|
||||
dev->eeprom[0x45] = 0x8C; /* Logical device ID1 */
|
||||
dev->eeprom[0x46] = 0x80; /* Logical device ID2 */
|
||||
dev->eeprom[0x47] = 0x19; /* Logical device ID3 */
|
||||
dev->eeprom[0x48] = 0x02; /* Flag 0 (02 = BROM is disabled) */
|
||||
dev->eeprom[0x49] = 0x00; /* Flag 1 */
|
||||
/* TAG: Logical Device ID. */
|
||||
dev->eeprom[0x43] = 0x16; /* Item byte */
|
||||
dev->eeprom[0x44] = 0x4A; /* Logical device ID0 */
|
||||
dev->eeprom[0x45] = 0x8C; /* Logical device ID1 */
|
||||
dev->eeprom[0x46] = 0x80; /* Logical device ID2 */
|
||||
dev->eeprom[0x47] = 0x19; /* Logical device ID3 */
|
||||
dev->eeprom[0x48] = 0x02; /* Flag0 (02=BROM/disabled) */
|
||||
dev->eeprom[0x49] = 0x00; /* Flag 1 */
|
||||
|
||||
/* TAG: Compatible Device ID (NE2000) */
|
||||
dev->eeprom[0x4A] = 0x1C; /* Item byte */
|
||||
dev->eeprom[0x4B] = 0x41; /* Compatible ID0 */
|
||||
dev->eeprom[0x4C] = 0xD0; /* Compatible ID1 */
|
||||
dev->eeprom[0x4D] = 0x80; /* Compatible ID2 */
|
||||
dev->eeprom[0x4E] = 0xD6; /* Compatible ID3 */
|
||||
/* TAG: Compatible Device ID (NE2000) */
|
||||
dev->eeprom[0x4A] = 0x1C; /* Item byte */
|
||||
dev->eeprom[0x4B] = 0x41; /* Compatible ID0 */
|
||||
dev->eeprom[0x4C] = 0xD0; /* Compatible ID1 */
|
||||
dev->eeprom[0x4D] = 0x80; /* Compatible ID2 */
|
||||
dev->eeprom[0x4E] = 0xD6; /* Compatible ID3 */
|
||||
|
||||
/* TAG: I/O Format */
|
||||
dev->eeprom[0x4F] = 0x47; /* Item byte */
|
||||
dev->eeprom[0x50] = 0x00; /* I/O information */
|
||||
dev->eeprom[0x51] = 0x20; /* Min. I/O base bits 7-0 */
|
||||
dev->eeprom[0x52] = 0x02; /* Min. I/O base bits 15-8 */
|
||||
dev->eeprom[0x53] = 0x80; /* Max. I/O base bits 7-0 */
|
||||
dev->eeprom[0x54] = 0x03; /* Max. I/O base bits 15-8 */
|
||||
dev->eeprom[0x55] = 0x20; /* Base alignment */
|
||||
dev->eeprom[0x56] = 0x20; /* Range length */
|
||||
/* TAG: I/O Format */
|
||||
dev->eeprom[0x4F] = 0x47; /* Item byte */
|
||||
dev->eeprom[0x50] = 0x00; /* I/O information */
|
||||
dev->eeprom[0x51] = 0x20; /* Min. I/O base bits 7-0 */
|
||||
dev->eeprom[0x52] = 0x02; /* Min. I/O base bits 15-8 */
|
||||
dev->eeprom[0x53] = 0x80; /* Max. I/O base bits 7-0 */
|
||||
dev->eeprom[0x54] = 0x03; /* Max. I/O base bits 15-8 */
|
||||
dev->eeprom[0x55] = 0x20; /* Base alignment */
|
||||
dev->eeprom[0x56] = 0x20; /* Range length */
|
||||
|
||||
/* TAG: IRQ Format */
|
||||
dev->eeprom[0x57] = 0x23; /* Item byte */
|
||||
dev->eeprom[0x58] = 0x38; /* IRQ mask bits 7-0 */
|
||||
dev->eeprom[0x59] = 0x9E; /* IRQ mask bits 15-8 */
|
||||
dev->eeprom[0x5A] = 0x01; /* IRQ information */
|
||||
/* TAG: IRQ Format. */
|
||||
dev->eeprom[0x57] = 0x23; /* Item byte */
|
||||
dev->eeprom[0x58] = 0x38; /* IRQ mask bits 7-0 */
|
||||
dev->eeprom[0x59] = 0x9E; /* IRQ mask bits 15-8 */
|
||||
dev->eeprom[0x5A] = 0x01; /* IRQ information */
|
||||
|
||||
/* TAG: END Tag */
|
||||
dev->eeprom[0x5B] = 0x79; /* Item byte */
|
||||
for (c = 0x1B; c < 0x5C; c++) /* Checksum (2's complement) */
|
||||
/* TAG: END Tag */
|
||||
dev->eeprom[0x5B] = 0x79; /* Item byte */
|
||||
for (c = 0x1b; c < 0x5c; c++) /* Checksum (2's compl) */
|
||||
dev->eeprom[0x5C] += dev->eeprom[c];
|
||||
dev->eeprom[0x5C] = -dev->eeprom[0x5C];
|
||||
|
||||
@@ -2620,7 +2641,7 @@ nic_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
static device_config_t ne1000_config[] =
|
||||
static const device_config_t ne1000_config[] =
|
||||
{
|
||||
{
|
||||
"base", "Address", CONFIG_HEX16, "", 0x300,
|
||||
@@ -2679,7 +2700,7 @@ static device_config_t ne1000_config[] =
|
||||
}
|
||||
};
|
||||
|
||||
static device_config_t ne2000_config[] =
|
||||
static const device_config_t ne2000_config[] =
|
||||
{
|
||||
{
|
||||
"base", "Address", CONFIG_HEX16, "", 0x300,
|
||||
@@ -2764,7 +2785,7 @@ static device_config_t ne2000_config[] =
|
||||
}
|
||||
};
|
||||
|
||||
static device_config_t rtl8019as_config[] =
|
||||
static const device_config_t rtl8019as_config[] =
|
||||
{
|
||||
{
|
||||
"mac", "MAC Address", CONFIG_MAC, "", -1
|
||||
@@ -2774,7 +2795,7 @@ static device_config_t rtl8019as_config[] =
|
||||
}
|
||||
};
|
||||
|
||||
static device_config_t rtl8029as_config[] =
|
||||
static const device_config_t rtl8029as_config[] =
|
||||
{
|
||||
{
|
||||
"bios", "Enable BIOS", CONFIG_BINARY, "", 0
|
||||
@@ -2788,7 +2809,7 @@ static device_config_t rtl8029as_config[] =
|
||||
};
|
||||
|
||||
|
||||
device_t ne1000_device = {
|
||||
const device_t ne1000_device = {
|
||||
"Novell NE1000",
|
||||
DEVICE_ISA,
|
||||
NE2K_NE1000,
|
||||
@@ -2797,7 +2818,7 @@ device_t ne1000_device = {
|
||||
ne1000_config
|
||||
};
|
||||
|
||||
device_t ne2000_device = {
|
||||
const device_t ne2000_device = {
|
||||
"Novell NE2000",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
NE2K_NE2000,
|
||||
@@ -2806,7 +2827,7 @@ device_t ne2000_device = {
|
||||
ne2000_config
|
||||
};
|
||||
|
||||
device_t rtl8019as_device = {
|
||||
const device_t rtl8019as_device = {
|
||||
"Realtek RTL8019AS",
|
||||
DEVICE_ISA | DEVICE_AT,
|
||||
NE2K_RTL8019AS,
|
||||
@@ -2815,7 +2836,7 @@ device_t rtl8019as_device = {
|
||||
rtl8019as_config
|
||||
};
|
||||
|
||||
device_t rtl8029as_device = {
|
||||
const device_t rtl8029as_device = {
|
||||
"Realtek RTL8029AS",
|
||||
DEVICE_PCI,
|
||||
NE2K_RTL8029AS,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user