diff --git a/src/floppy/CMakeLists.txt b/src/floppy/CMakeLists.txt index a3039ddd5..75e7b5947 100644 --- a/src/floppy/CMakeLists.txt +++ b/src/floppy/CMakeLists.txt @@ -13,5 +13,5 @@ # Copyright 2020,2021 David Hrdlička. # -add_library(fdd OBJECT fdd.c fdc.c fdc_pii15xb.c fdi2raw.c fdd_common.c +add_library(fdd OBJECT fdd.c fdc.c fdc_magitronic.c fdc_pii15xb.c fdi2raw.c fdd_common.c fdd_86f.c fdd_fdi.c fdd_imd.c fdd_img.c fdd_json.c fdd_mfm.c fdd_td0.c) \ No newline at end of file diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 8194d35f4..459370724 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -109,6 +109,7 @@ typedef const struct { /* All emulated machines have at least one integrated FDC controller */ static fdc_cards_t fdc_cards[] = { { "internal", NULL }, + { "b215", &fdc_b215_device }, { "dtk_pii151b", &fdc_pii151b_device }, { "dtk_pii158b", &fdc_pii158b_device }, { "", NULL }, diff --git a/src/floppy/fdc_magitronic.c b/src/floppy/fdc_magitronic.c new file mode 100644 index 000000000..3b7ceb64d --- /dev/null +++ b/src/floppy/fdc_magitronic.c @@ -0,0 +1,99 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the Magitronic B215 XT-FDC Controller. + * + * Authors: Tiseno100 + * + * Copyright 2021 Tiseno100 + * + */ + +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/timer.h> +#include <86box/io.h> +#include <86box/device.h> +#include <86box/mem.h> +#include <86box/rom.h> +#include <86box/fdd.h> +#include <86box/fdc.h> +#include <86box/fdc_ext.h> + +#define ROM_B215 L"roms/floppy/magitronic/Magitronic B215 - BIOS ROM.bin" +#define ROM_ADDR (uint32_t)(device_get_config_hex20("bios_addr") & 0x000fffff) + +typedef struct +{ + fdc_t *fdc_controller; + rom_t rom; +} b215_t; + +static void +b215_close(void *priv) +{ + b215_t *dev = (b215_t *)priv; + + free(dev); +} + +static void * +b215_init(const device_t *info) +{ + b215_t *dev = (b215_t *)malloc(sizeof(b215_t)); + memset(dev, 0, sizeof(b215_t)); + + rom_init(&dev->rom, ROM_B215, ROM_ADDR, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL); + + device_add(&fdc_at_device); + + return dev; +} + +static int b215_available(void) +{ + return rom_present(ROM_B215); +} + +static const device_config_t b215_config[] = { + { + "bios_addr", "BIOS Address:", CONFIG_HEX20, "", 0xca000, "", { 0 }, + { + { + "CA00H", 0xca000 + }, + { + "CC00H", 0xcc000 + }, + { + "" + } + } + }, + { + "", "", -1 + } +}; + +const device_t fdc_b215_device = { + "Magitronic B215", + DEVICE_ISA, + 0, + b215_init, + b215_close, + NULL, + {b215_available}, + NULL, + NULL, + b215_config}; diff --git a/src/include/86box/fdc_ext.h b/src/include/86box/fdc_ext.h index a9aa000f3..c87786dc0 100644 --- a/src/include/86box/fdc_ext.h +++ b/src/include/86box/fdc_ext.h @@ -27,6 +27,7 @@ extern int fdc_type; /* Controller types. */ #define FDC_INTERNAL 0 +extern const device_t fdc_b215_device; extern const device_t fdc_pii151b_device; extern const device_t fdc_pii158b_device; diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 7b2488060..b4aaa599d 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -658,7 +658,7 @@ SIOOBJ := sio_acc3221.o \ sio_um8669f.o \ sio_vt82c686.o -FDDOBJ := fdd.o fdc.o fdc_pii15xb.o \ +FDDOBJ := fdd.o fdc.o fdc_magitronic.o fdc_pii15xb.o \ fdi2raw.o \ fdd_common.o fdd_86f.o \ fdd_fdi.o fdd_imd.o fdd_img.o fdd_json.o \