From 288e2ce1d2f46a5e6e0c93a2086823407b0fc5d9 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 13 Mar 2022 09:38:53 -0400 Subject: [PATCH] src/floppy --- src/floppy/fdc.c | 277 +++++++++++++++++++++--------------- src/floppy/fdc_magitronic.c | 24 ++-- src/floppy/fdc_pii15xb.c | 46 +++--- 3 files changed, 198 insertions(+), 149 deletions(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 485b8925c..171a77fa7 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -102,12 +102,17 @@ fdc_log(const char *fmt, ...) const device_t fdc_internal_device = { - "Internal", - "internal", - 0, 0, - NULL, NULL, NULL, - { NULL }, NULL, NULL, - NULL + .name = "Internal", + .internal_name = "internal", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; @@ -117,11 +122,13 @@ typedef const struct { /* All emulated machines have at least one integrated FDC controller */ static fdc_cards_t fdc_cards[] = { - { &fdc_internal_device }, - { &fdc_b215_device }, - { &fdc_pii151b_device }, - { &fdc_pii158b_device }, - { NULL } +// clang-format off + { &fdc_internal_device }, + { &fdc_b215_device }, + { &fdc_pii151b_device }, + { &fdc_pii158b_device }, + { NULL } +// clang-format on }; @@ -2382,145 +2389,183 @@ fdc_3f1_enable(fdc_t *fdc, int enable) } const device_t fdc_xt_device = { - "PC/XT Floppy Drive Controller", - "fdc_xt", - 0, - 0, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller", + .internal_name = "fdc_xt", + .flags = 0, + .local = 0, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_t1x00_device = { - "PC/XT Floppy Drive Controller (Toshiba)", - "fdc_xt_t1x00", - 0, - FDC_FLAG_TOSHIBA, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Toshiba)", + .internal_name = "fdc_xt_t1x00", + .flags = 0, + .local = FDC_FLAG_TOSHIBA, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_amstrad_device = { - "PC/XT Floppy Drive Controller (Amstrad)", - "fdc_xt_amstrad", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AMSTRAD, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Amstrad)", + .internal_name = "fdc_xt_amstrad", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AMSTRAD, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_xt_tandy_device = { - "PC/XT Floppy Drive Controller (Tandy)", - "fdc_xt_tandy", - 0, - FDC_FLAG_AMSTRAD, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/XT Floppy Drive Controller (Tandy)", + .internal_name = "fdc_xt_tandy", + .flags = 0, + .local = FDC_FLAG_AMSTRAD, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; - const device_t fdc_pcjr_device = { - "PCjr Floppy Drive Controller", - "fdc_pcjr", - 0, - FDC_FLAG_PCJR, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PCjr Floppy Drive Controller", + .internal_name = "fdc_pcjr", + .flags = 0, + .local = FDC_FLAG_PCJR, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_device = { - "PC/AT Floppy Drive Controller", - "fdc_at", - 0, - FDC_FLAG_AT, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller", + .internal_name = "fdc_at", + .flags = 0, + .local = FDC_FLAG_AT, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_actlow_device = { - "PC/AT Floppy Drive Controller (Active low)", - "fdc_at_actlow", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (Active low)", + .internal_name = "fdc_at_actlow", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_ps1_device = { - "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)", - "fdc_at_ps1", - 0, - FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)", + .internal_name = "fdc_at_ps1", + .flags = 0, + .local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_smc_device = { - "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)", - "fdc_at_smc", - 0, - FDC_FLAG_AT | FDC_FLAG_SUPERIO, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)", + .internal_name = "fdc_at_smc", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_SUPERIO, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_winbond_device = { - "PC/AT Floppy Drive Controller (Winbond W83x77F)", - "fdc_at_winbond", - 0, - FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (Winbond W83x77F)", + .internal_name = "fdc_at_winbond", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_at_nsc_device = { - "PC/AT Floppy Drive Controller (NSC PC8730x)", - "fdc_at_nsc", - 0, - FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "PC/AT Floppy Drive Controller (NSC PC8730x)", + .internal_name = "fdc_at_nsc", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_dp8473_device = { - "NS DP8473 Floppy Drive Controller", - "fdc_dp8473", - 0, - FDC_FLAG_AT | FDC_FLAG_NSC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "NS DP8473 Floppy Drive Controller", + .internal_name = "fdc_dp8473", + .flags = 0, + .local = FDC_FLAG_AT | FDC_FLAG_NSC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; const device_t fdc_um8398_device = { - "UMC UM8398 Floppy Drive Controller", - "fdc_um8398", - 0, - FDC_FLAG_UMC, - fdc_init, - fdc_close, - fdc_reset, - { NULL }, NULL, NULL + .name = "UMC UM8398 Floppy Drive Controller", + .internal_name = "fdc_um8398", + .flags = 0, + .local = FDC_FLAG_UMC, + .init = fdc_init, + .close = fdc_close, + .reset = fdc_reset, + { .available = NULL }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL }; diff --git a/src/floppy/fdc_magitronic.c b/src/floppy/fdc_magitronic.c index 58679a5aa..a27e19748 100644 --- a/src/floppy/fdc_magitronic.c +++ b/src/floppy/fdc_magitronic.c @@ -126,14 +126,16 @@ static const device_config_t b215_config[] = { }; const device_t fdc_b215_device = { - "Magitronic B215", - "b215", - DEVICE_ISA, - 0, - b215_init, - b215_close, - NULL, - {b215_available}, - NULL, - NULL, - b215_config}; + .name = "Magitronic B215", + .internal_name = "b215", + .flags = DEVICE_ISA, + .local = 0, + .init = b215_init, + .close = b215_close, + .reset = NULL, + { .available = b215_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = b215_config +}; + diff --git a/src/floppy/fdc_pii15xb.c b/src/floppy/fdc_pii15xb.c index 6ac6786c9..2e865ec56 100644 --- a/src/floppy/fdc_pii15xb.c +++ b/src/floppy/fdc_pii15xb.c @@ -138,27 +138,29 @@ static const device_config_t pii_config[] = { }; const device_t fdc_pii151b_device = { - "DTK PII-151B (MiniMicro) Floppy Drive Controller", - "dtk_pii151b", - DEVICE_ISA, - 151, - pii_init, - pii_close, - NULL, - {pii_151b_available}, - NULL, - NULL, - pii_config}; + .name = "DTK PII-151B (MiniMicro) Floppy Drive Controller", + .internal_name = "dtk_pii151b", + .flags = DEVICE_ISA, + .local = 151, + .init = pii_init, + .close = pii_close, + .reset = NULL, + { .available = pii_151b_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pii_config +}; const device_t fdc_pii158b_device = { - "DTK PII-158B (MiniMicro4) Floppy Drive Controller", - "dtk_pii158b", - DEVICE_ISA, - 158, - pii_init, - pii_close, - NULL, - {pii_158_available}, - NULL, - NULL, - pii_config}; + .name = "DTK PII-158B (MiniMicro4) Floppy Drive Controller", + .internal_name = "dtk_pii158b", + .flags = DEVICE_ISA, + .local = 158, + .init = pii_init, + .close = pii_close, + .reset = NULL, + { .available = pii_158_available }, + .speed_changed = NULL, + .force_redraw = NULL, + .config = pii_config +};