mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
* Initial spindle emulation working for windows atleast * Spingle motor spin-up, spin-down implemented with smooth transitions to motor-on loop. * Moved fdd audio emulation to a separate file * Multiple drives sound emulation * Single sector movement sound emulations implemented * Rename project to Immersive86Box and update details Updated README to reflect the new project name and added details about the Immersive86Box features and future plans. * Revise contribution guidelines in CONTRIBUTING.md * Update vulnerability reporting instructions * System fan-sound next feature after basic fdd sound emulation is ready * v0.5 multitrack audio seek sfx * Removed unnecessary stuff * no .vs folder for git * Added currently used fdd sound effects and readme.txt for source of the files and intallation instructions * Add audio emulation installation instructions Added instructions for audio emulation installation. * Code and audio samples merged * Simplify audio emulation installation instructions * FDC seeking fixed, not instant anymore drive is set to busy during the operation and when it's finished at call fdc to set the appropriate fdc flags. Also added time logic to fdd to calculate seek duration and a callback function for it. * FDD sound samples volume control * Menu options to enable / disable fdd sound for all drives. DISABLE_FDD_AUDIO definition added, to disable the feature via cmake/build. * Revert readme etc. changes * Revert "Revise contribution guidelines in CONTRIBUTING.md" This reverts commit98a0478225. * Revert "Update vulnerability reporting instructions" This reverts commit7d32cb659b. * Fixed merge issue * Removed excess files * Fixed PCJr seeking not to break the FDC implementation. Now seeking will take the "correct" amount of time for each system and the seek time is based on the track count. E.g. 40 track FDD system causes 40 track seek time to be 80/40 * 6ms * 40 tracks + 50ms = 480ms + 50ms -> 530ms. 80 track system full seek is 80/80 * 6ms * 80 + 50ms = 530ms, 40 track seek would take 240 + 50 = 290ms. * Fixed PS/1, PS/2 and PS/55 FDD issues. * FDD_AUDIO: Updating samples looked in executablePath/samples and if now found there, looks in the executable directory * Updated installation instructions * Removed samples path strcat use * fdd_audio 5.25 samples and support added * FDD audio timing/volume tunings * Timing fixes for authentity and special longer timings for PCJr * Fixed second drive motor keeps running when first drive is only accessed. * Fixed PCJr random failure issue, timings * CodeQL fix for load_wav-function. Check the filename to be proper filename * Revert "Fixed second drive motor keeps running when first drive is only accessed." This reverts commit307b173ae7. * Teac 5.25" drive samples added. Added per drive audio selection to FDD settings. * Fixed merge issue * Fixed readme to include only Mitsumi samples under CC-BY license * Fixes merge problem * Fixes #6220: OS/2 Warp 3.0 install disk issue and NT 3.1 floppy disk issues. Changed the fdc->stat bit to 0x10 which states fdc busy. Previous implementation with seek time 0, set the ready flag 0x80 immediadely - which was correct for that time, but now as the drive is busy during seek, the value should 0x10. Implemented a backup for fdd commands during fdd seek to be processes after the seek is completed. * Fixed FDD reset * Floppy disk audio now gets settings from fdd_audio_profiles.cfg stored in roms/floppy -directory. Floppy settings audio seledtions are also populated by the settings from this config. * Changed samples per track, not seek_duration_per_track * Removed commented code. Returned total_track in configration * Fixed CodeQL errors --------- Co-authored-by: Toni Riikonen <domppari@hotmail.com>
200 lines
6.1 KiB
C
200 lines
6.1 KiB
C
/*
|
|
* 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.
|
|
*
|
|
* Definitions for the floppy drive emulation.
|
|
*
|
|
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
|
* Miran Grca, <mgrca8@gmail.com>
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
* Toni Riikonen, <riikonen.toni@gmail.com>
|
|
*
|
|
* Copyright 2008-2025 Sarah Walker.
|
|
* Copyright 2016-2025 Miran Grca.
|
|
* Copyright 2018-2025 Fred N. van Kempen.
|
|
* Copyright 2025 Toni Riikonen.
|
|
*/
|
|
#ifndef EMU_FDD_H
|
|
#define EMU_FDD_H
|
|
|
|
#define FDD_NUM 4
|
|
#define FLOPPY_IMAGE_HISTORY 10
|
|
#define SEEK_RECALIBRATE -999
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern int fdd_swap;
|
|
|
|
extern void fdd_set_motor_enable(int drive, int motor_enable);
|
|
extern void fdd_do_seek(int drive, int track);
|
|
extern void fdd_forced_seek(int drive, int track_diff);
|
|
extern void fdd_seek(int drive, int track_diff);
|
|
extern int fdd_track0(int drive);
|
|
extern int fdd_getrpm(int drive);
|
|
extern void fdd_set_densel(int densel);
|
|
extern int fdd_can_read_medium(int drive);
|
|
extern int fdd_doublestep_40(int drive);
|
|
extern int fdd_is_525(int drive);
|
|
extern int fdd_is_dd(int drive);
|
|
extern int fdd_is_hd(int drive);
|
|
extern int fdd_is_ed(int drive);
|
|
extern int fdd_is_double_sided(int drive);
|
|
extern void fdd_set_head(int drive, int head);
|
|
extern int fdd_get_head(int drive);
|
|
extern void fdd_set_turbo(int drive, int turbo);
|
|
extern int fdd_get_turbo(int drive);
|
|
extern void fdd_set_check_bpb(int drive, int check_bpb);
|
|
extern int fdd_get_check_bpb(int drive);
|
|
|
|
extern void fdd_set_type(int drive, int type);
|
|
extern int fdd_get_type(int drive);
|
|
|
|
/* New audio profile accessors */
|
|
extern void fdd_set_audio_profile(int drive, int profile);
|
|
extern int fdd_get_audio_profile(int drive);
|
|
|
|
extern int fdd_get_flags(int drive);
|
|
extern int fdd_get_densel(int drive);
|
|
|
|
extern char *fdd_getname(int type);
|
|
|
|
extern char *fdd_get_internal_name(int type);
|
|
extern int fdd_get_from_internal_name(char *s);
|
|
|
|
extern int fdd_current_track(int drive);
|
|
|
|
typedef struct DRIVE {
|
|
int id;
|
|
|
|
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);
|
|
uint64_t (*byteperiod)(int drive);
|
|
void (*stop)(int drive);
|
|
void (*poll)(int drive);
|
|
} DRIVE;
|
|
|
|
extern DRIVE drives[FDD_NUM];
|
|
extern char floppyfns[FDD_NUM][512];
|
|
extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY];
|
|
extern pc_timer_t fdd_poll_time[FDD_NUM];
|
|
extern int ui_writeprot[FDD_NUM];
|
|
|
|
extern int curdrive;
|
|
|
|
extern int fdd_time;
|
|
extern int64_t floppytime;
|
|
|
|
extern void fdd_load(int drive, char *fn);
|
|
extern void fdd_new(int drive, char *fn);
|
|
extern void fdd_close(int drive);
|
|
extern void fdd_init(void);
|
|
extern void fdd_reset(void);
|
|
extern void fdd_seek(int drive, int track);
|
|
extern void fdd_readsector(int drive, int sector, int track,
|
|
int side, int density, int sector_size);
|
|
extern void fdd_writesector(int drive, int sector, int track,
|
|
int side, int density, int sector_size);
|
|
extern void fdd_comparesector(int drive, int sector, int track,
|
|
int side, int density, int sector_size);
|
|
extern void fdd_readaddress(int drive, int side, int density);
|
|
extern void fdd_format(int drive, int side, int density, uint8_t fill);
|
|
extern int fdd_hole(int drive);
|
|
extern void fdd_stop(int drive);
|
|
extern void fdd_do_writeback(int drive);
|
|
|
|
extern int motorspin;
|
|
extern uint64_t motoron[FDD_NUM];
|
|
|
|
extern int swwp;
|
|
extern int disable_write;
|
|
|
|
extern int defaultwriteprot;
|
|
|
|
extern int writeprot[FDD_NUM];
|
|
extern int fwriteprot[FDD_NUM];
|
|
extern int fdd_changed[FDD_NUM];
|
|
extern int drive_empty[FDD_NUM];
|
|
|
|
/*Used in the Read A Track command. Only valid for fdd_readsector(). */
|
|
#define SECTOR_FIRST -2
|
|
#define SECTOR_NEXT -1
|
|
|
|
typedef struct d86f_handler_t {
|
|
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;
|
|
|
|
extern const int gap3_sizes[5][8][48];
|
|
|
|
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];
|
|
|
|
typedef struct xdf_id_t {
|
|
uint8_t h;
|
|
uint8_t r;
|
|
} xdf_id_t;
|
|
|
|
typedef union {
|
|
uint16_t word;
|
|
xdf_id_t id;
|
|
} xdf_sector_t;
|
|
|
|
extern const xdf_sector_t xdf_img_layout[2][2][46];
|
|
extern const xdf_sector_t xdf_disk_layout[2][2][38];
|
|
|
|
typedef struct sector_id_fields_t {
|
|
uint8_t c;
|
|
uint8_t h;
|
|
uint8_t r;
|
|
uint8_t n;
|
|
} sector_id_fields_t;
|
|
|
|
typedef union sector_id_t {
|
|
uint32_t dword;
|
|
uint8_t byte_array[4];
|
|
sector_id_fields_t id;
|
|
} sector_id_t;
|
|
|
|
void d86f_set_fdc(void *fdc);
|
|
void fdi_set_fdc(void *fdc);
|
|
void fdd_set_fdc(void *fdc);
|
|
void imd_set_fdc(void *fdc);
|
|
void img_set_fdc(void *fdc);
|
|
void mfm_set_fdc(void *fdc);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /*EMU_FDD_H*/
|