summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/floppy.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/floppy.h')
-rw-r--r--src/devices/imagedev/floppy.h184
1 files changed, 82 insertions, 102 deletions
diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h
index 2086020f9f6..2e7b0de3b50 100644
--- a/src/devices/imagedev/floppy.h
+++ b/src/devices/imagedev/floppy.h
@@ -6,14 +6,14 @@
*********************************************************************/
-#ifndef MAME_DEVICES_IMAGEDEV_FLOPPY_H
-#define MAME_DEVICES_IMAGEDEV_FLOPPY_H
+#ifndef MAME_IMAGEDEV_FLOPPY_H
+#define MAME_IMAGEDEV_FLOPPY_H
#pragma once
#include "sound/samples.h"
-#include "screen.h"
+// forward declarations
class floppy_image;
class floppy_image_format_t;
@@ -90,6 +90,8 @@ public:
const floppy_image_format_t *get_load_format() const;
std::pair<std::error_condition, const floppy_image_format_t *> identify(std::string_view filename);
void set_rpm(float rpm);
+ void set_sectoring_type(uint32_t sectoring_type);
+ uint32_t get_sectoring_type();
void init_fs(const fs_info *fs, const fs::meta_data &meta);
@@ -103,7 +105,7 @@ public:
virtual bool is_writeable() const noexcept override { return true; }
virtual bool is_creatable() const noexcept override { return true; }
virtual bool is_reset_on_load() const noexcept override { return false; }
- virtual const char *file_extensions() const noexcept override { return extension_list; }
+ virtual const char *file_extensions() const noexcept override { return m_extension_list; }
virtual const char *image_type_name() const noexcept override { return "floppydisk"; }
virtual const char *image_brief_type_name() const noexcept override { return "flop"; }
void setup_write(const floppy_image_format_t *output_format);
@@ -115,39 +117,39 @@ public:
void setup_wpt_cb(wpt_cb cb);
void setup_led_cb(led_cb cb);
- std::vector<uint32_t> &get_buffer();
- int get_cyl() const { return cyl; }
- bool on_track() const { return !subcyl; }
+ int get_cyl() const { return m_cyl; }
+ bool on_track() const { return !m_subcyl; }
virtual void mon_w(int state);
bool ready_r();
void set_ready(bool state);
- double get_pos();
virtual void tfsel_w(int state) { } // 35SEL line for Apple Sony drives
virtual bool wpt_r(); // Mac sony drives using this for various reporting
- int dskchg_r() { return dskchg; }
- bool trk00_r() { return (has_trk00_sensor ? (cyl != 0) : 1); }
- int idx_r() { return idx; }
- int mon_r() { return mon; }
- bool ss_r() { return ss; }
+ int dskchg_r() { return m_dskchg; }
+ bool trk00_r() { return (m_has_trk00_sensor ? (m_cyl != 0) : 1); }
+ int idx_r() { return m_idx; }
+ int mon_r() { return m_mon; }
+ bool ss_r() { return m_ss; }
bool twosid_r();
+ bool floppy_is_hd();
+ bool floppy_is_ed();
virtual bool writing_disabled() const;
virtual void seek_phase_w(int phases);
void stp_w(int state);
- void dir_w(int state) { dir = state; }
- void ss_w(int state) { actual_ss = state; if (sides > 1) ss = state; }
+ void dir_w(int state) { m_dir = state; }
+ void ss_w(int state) { m_actual_ss = state; if (m_sides > 1) m_ss = state; }
void inuse_w(int state) { }
- void dskchg_w(int state) { if (dskchg_writable) dskchg = state; }
- void ds_w(int state) { ds = state; check_led(); }
+ void dskchg_w(int state) { if (m_dskchg_writable) m_dskchg = state; }
+ void ds_w(int state) { m_ds = state; check_led(); }
attotime time_next_index();
attotime get_next_transition(const attotime &from_when);
void write_flux(const attotime &start, const attotime &end, int transition_count, const attotime *transitions);
void set_write_splice(const attotime &when);
- int get_sides() { return sides; }
+ int get_sides() { return m_sides; }
uint32_t get_form_factor() const;
uint32_t get_variant() const;
@@ -164,10 +166,10 @@ protected:
floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device_t implementation
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
virtual void device_config_complete() override;
- virtual void device_add_mconfig(machine_config &config) override;
+ virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
// device_image_interface implementation
virtual const software_list_loader &get_software_list_loader() const override;
@@ -179,68 +181,69 @@ protected:
void init_floppy_load(bool write_supported);
- std::function<void (format_registration &fr)> format_registration_cb;
- const floppy_image_format_t *input_format;
- const floppy_image_format_t *output_format;
- std::vector<uint32_t> variants;
- std::unique_ptr<floppy_image> image;
- char extension_list[256];
- std::vector<const floppy_image_format_t *> fif_list;
+ std::function<void (format_registration &fr)> m_format_registration_cb;
+ const floppy_image_format_t *m_input_format;
+ const floppy_image_format_t *m_output_format;
+ std::vector<uint32_t> m_variants;
+ std::unique_ptr<floppy_image> m_image;
+ char m_extension_list[256];
+ std::vector<const floppy_image_format_t *> m_fif_list;
std::vector<fs_info> m_fs;
std::vector<const fs::manager_t *> m_fs_managers;
- emu_timer *index_timer;
+ emu_timer *m_index_timer;
/* Physical characteristics, filled by setup_characteristics */
- int tracks; /* addressable tracks */
- int sides; /* number of heads */
- uint32_t form_factor; /* 3"5, 5"25, etc */
- bool motor_always_on;
- bool dskchg_writable;
- bool has_trk00_sensor;
+ int m_tracks; /* addressable tracks */
+ int m_sides; /* number of heads */
+ uint32_t m_form_factor; /* 3"5, 5"25, etc */
+ uint32_t m_sectoring_type; /* SOFT, Hard 10/16/32 */
+ bool m_motor_always_on;
+ bool m_dskchg_writable;
+ bool m_has_trk00_sensor;
- int drive_index;
+ int m_drive_index;
/* state of input lines */
- int dir; /* direction */
- int stp; /* step */
- int wtg; /* write gate */
- int mon; /* motor on */
- int ss, actual_ss; /* side select (forced to 0 if single-sided drive / actual value) */
- int ds; /* drive select */
+ int m_dir; /* direction */
+ int m_stp; /* step */
+ int m_wtg; /* write gate */
+ int m_mon; /* motor on */
+ int m_ss, m_actual_ss; /* side select (forced to 0 if single-sided drive / actual value) */
+ int m_ds; /* drive select */
- int phases; /* phases lines, when they exist */
+ int m_phases; /* phases lines, when they exist */
/* state of output lines */
- int idx; /* index pulse */
- int wpt; /* write protect */
- int rdy; /* ready */
- int dskchg; /* disk changed */
- bool ready;
+ int m_idx; /* index pulse */
+ int m_wpt; /* write protect */
+ int m_rdy; /* ready */
+ int m_dskchg; /* disk changed */
+ bool m_ready;
/* rotation per minute => gives index pulse frequency */
- float rpm;
+ float m_rpm;
/* angular speed, where a full circle is 2e8 */
- double angular_speed;
+ double m_angular_speed;
- attotime revolution_start_time, rev_time;
- uint32_t revolution_count;
- int cyl, subcyl;
+ attotime m_revolution_start_time, m_rev_time;
+ uint32_t m_revolution_count;
+ int m_cyl, m_subcyl;
/* Current floppy zone cache */
- attotime cache_start_time, cache_end_time, cache_weak_start;
- attotime amplifier_freakout_time;
- int cache_index;
- u32 cache_entry;
- bool cache_weak;
+ attotime m_cache_start_time, m_cache_end_time, m_cache_weak_start;
+ attotime m_amplifier_freakout_time;
+ int m_cache_index;
+ u32 m_cache_entry;
+ bool m_cache_weak;
- bool image_dirty, track_dirty;
- int ready_counter;
+ bool m_image_dirty, m_track_dirty;
+ int m_ready_counter;
- load_cb cur_load_cb;
- unload_cb cur_unload_cb;
- index_pulse_cb cur_index_pulse_cb;
- ready_cb cur_ready_cb;
- wpt_cb cur_wpt_cb;
- led_cb cur_led_cb;
+ load_cb m_cur_load_cb;
+ unload_cb m_cur_unload_cb;
+ index_pulse_cb m_cur_index_pulse_cb;
+ ready_cb m_cur_ready_cb;
+ wpt_cb m_cur_wpt_cb;
+ led_cb m_cur_led_cb;
// Temporary structure storing a write span
@@ -255,9 +258,10 @@ protected:
void register_formats();
+ void add_variant(uint32_t variant);
+
void check_led();
uint32_t find_position(attotime &base, const attotime &when);
- int find_index(uint32_t position, const std::vector<uint32_t> &buf) const;
attotime position_to_time(const attotime &base, int position) const;
void commit_image();
@@ -272,35 +276,6 @@ protected:
// Sound
bool m_make_sound;
floppy_sound_device* m_sound_out;
-
- // Flux visualization
- struct flux_per_pixel_info {
- uint32_t m_position; // 0-199999999 Angular position in the track, 0xffffffff if not in the floppy image
- uint16_t m_r; // Distance from the center
- uint8_t m_combined_track; // No need to store head, it's y >= flux_screen_sy/2
- uint8_t m_color; // Computed gray level from the flux counts
- };
-
- struct flux_per_combined_track_info {
- std::vector<flux_per_pixel_info *> m_pixels[2];
- uint32_t m_span;
- uint8_t m_track;
- uint8_t m_subtrack;
- };
-
- std::vector<flux_per_pixel_info> m_flux_per_pixel_infos;
- std::vector<flux_per_combined_track_info> m_flux_per_combined_track_infos;
-
- optional_device<screen_device> m_flux_screen;
-
- static constexpr int flux_screen_sx = 501;
- static constexpr int flux_screen_sy = 1002;
- static constexpr int flux_min_r = 100;
- static constexpr int flux_max_r = 245;
-
- void flux_image_prepare();
- void flux_image_compute_for_track(int track, int head);
- uint32_t flux_screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
#define DECLARE_FLOPPY_IMAGE_DEVICE(Type, Name, Interface) \
@@ -314,8 +289,11 @@ protected:
}; \
DECLARE_DEVICE_TYPE(Type, Name)
+DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_3_SSSD, floppy_3_sssd, "floppy_3")
+DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_3_DSSD, floppy_3_dssd, "floppy_3")
DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_3_SSDD, floppy_3_ssdd, "floppy_3")
DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_3_DSDD, floppy_3_dsdd, "floppy_3")
+DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_3_DSQD, floppy_3_dsqd, "floppy_3")
DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_35_SSDD, floppy_35_ssdd, "floppy_3_5")
DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_35_DD, floppy_35_dd, "floppy_3_5")
DECLARE_FLOPPY_IMAGE_DEVICE(FLOPPY_35_HD, floppy_35_hd, "floppy_3_5")
@@ -370,8 +348,8 @@ protected:
mac_floppy_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- virtual void device_start() override;
- virtual void device_reset() override;
+ virtual void device_start() override ATTR_COLD;
+ virtual void device_reset() override ATTR_COLD;
virtual void track_changed() override;
virtual bool is_2m() const = 0;
@@ -431,11 +409,11 @@ public:
void register_for_save_states();
protected:
- void device_start() override;
+ void device_start() override ATTR_COLD;
private:
// device_sound_interface overrides
- virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
+ virtual void sound_stream_update(sound_stream &stream) override;
sound_stream* m_sound;
int m_step_base;
@@ -489,16 +467,18 @@ public:
template <typename T> void set_formats(T &&_formats) { formats = std::forward<T>(_formats); }
void enable_sound(bool doit) { m_enable_sound = doit; }
+ void set_sectoring_type(uint32_t sectoring_type) { m_sectoring_type = sectoring_type; }
floppy_image_device *get_device();
protected:
- virtual void device_start() override;
+ virtual void device_start() override ATTR_COLD;
virtual void device_config_complete() override;
private:
std::function<void (format_registration &fr)> formats;
bool m_enable_sound;
+ uint32_t m_sectoring_type;
};
@@ -508,4 +488,4 @@ DECLARE_DEVICE_TYPE(FLOPPY_CONNECTOR, floppy_connector)
extern template class device_finder<floppy_connector, false>;
extern template class device_finder<floppy_connector, true>;
-#endif // MAME_DEVICES_IMAGEDEV_FLOPPY_H
+#endif // MAME_IMAGEDEV_FLOPPY_H