hp9845: call_display and a different approach to stopping tape added to TACO driver.

This commit is contained in:
fulivi 2016-03-06 16:29:43 +01:00
parent b1f5519497
commit fec7ca2075
2 changed files with 597 additions and 551 deletions

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,7 @@ public:
virtual bool call_load() override; virtual bool call_load() override;
virtual bool call_create(int format_type, option_resolution *format_options) override; virtual bool call_create(int format_type, option_resolution *format_options) override;
virtual void call_unload() override; virtual void call_unload() override;
virtual void call_display() override;
virtual iodevice_t image_type() const override { return IO_MAGTAPE; } virtual iodevice_t image_type() const override { return IO_MAGTAPE; }
virtual bool is_readable() const override { return true; } virtual bool is_readable() const override { return true; }
virtual bool is_writeable() const override { return true; } virtual bool is_writeable() const override { return true; }
@ -71,96 +72,96 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private: private:
// Storage of tracks: mapping from a tape position to word stored there // Storage of tracks: mapping from a tape position to word stored there
typedef std::map<tape_pos_t , tape_word_t> tape_track_t; typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
devcb_write_line m_irq_handler; devcb_write_line m_irq_handler;
devcb_write_line m_flg_handler; devcb_write_line m_flg_handler;
devcb_write_line m_sts_handler; devcb_write_line m_sts_handler;
// Registers // Registers
UINT16 m_data_reg; UINT16 m_data_reg;
bool m_data_reg_full; bool m_data_reg_full;
UINT16 m_cmd_reg; UINT16 m_cmd_reg;
UINT16 m_status_reg; UINT16 m_status_reg;
UINT16 m_tach_reg; UINT16 m_tach_reg;
UINT16 m_checksum_reg; UINT16 m_checksum_reg;
UINT16 m_timing_reg; UINT16 m_timing_reg;
// State // State
bool m_irq; bool m_irq;
bool m_flg; bool m_flg;
bool m_sts; bool m_sts;
UINT8 m_cmd_state; UINT8 m_cmd_state;
// Tape position & motion // Tape position & motion
tape_pos_t m_tape_pos; tape_pos_t m_tape_pos;
attotime m_start_time; // Tape moving if != never attotime m_start_time; // Tape moving if != never
bool m_tape_fwd; bool m_tape_fwd;
bool m_tape_fast; bool m_tape_fast;
bool m_tape_stopping;
// Timers // Timers
emu_timer *m_tape_timer; emu_timer *m_tape_timer;
emu_timer *m_hole_timer; emu_timer *m_hole_timer;
// Content of tape tracks // Content of tape tracks
tape_track_t m_tracks[ 2 ]; tape_track_t m_tracks[ 2 ];
bool m_image_dirty; bool m_image_dirty;
// Reading & writing // Reading & writing
bool m_tape_wr; bool m_tape_wr;
tape_pos_t m_rw_pos; tape_pos_t m_rw_pos;
UINT16 m_next_word; UINT16 m_next_word;
tape_track_t::iterator m_rd_it; tape_track_t::iterator m_rd_it;
bool m_rd_it_valid; bool m_rd_it_valid;
// Gap detection // Gap detection
tape_pos_t m_gap_detect_start; tape_pos_t m_gap_detect_start;
typedef enum { typedef enum {
ADV_NO_MORE_DATA, ADV_NO_MORE_DATA,
ADV_CONT_DATA, ADV_CONT_DATA,
ADV_DISCONT_DATA ADV_DISCONT_DATA
} adv_res_t; } adv_res_t;
void clear_state(void); void clear_state(void);
void irq_w(bool state); void irq_w(bool state);
void set_error(bool state); void set_error(bool state);
unsigned speed_to_tick_freq(void) const; unsigned speed_to_tick_freq(void) const;
bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const; bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
void move_tape_pos(tape_pos_t delta_pos); tape_pos_t current_tape_pos(void) const;
void update_tape_pos(void); void update_tape_pos(void);
static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b); static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b);
static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b); static bool any_hole(tape_pos_t tape_pos_a , tape_pos_t tape_pos_b);
tape_pos_t next_hole(void) const; tape_pos_t next_hole(void) const;
attotime time_to_distance(tape_pos_t distance) const; attotime time_to_distance(tape_pos_t distance) const;
attotime time_to_target(tape_pos_t target) const; attotime time_to_target(tape_pos_t target) const;
bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0); bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0);
void start_tape(UINT16 cmd_reg); void stop_tape(void);
void stop_tape(void); tape_track_t& current_track(void);
tape_track_t& current_track(void); static tape_pos_t word_length(tape_word_t w);
static tape_pos_t word_length(tape_word_t w); static tape_pos_t word_end_pos(const tape_track_t::iterator& it);
static tape_pos_t word_end_pos(const tape_track_t::iterator& it); static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos);
static void adjust_it(tape_track_t& track , tape_track_t::iterator& it , tape_pos_t pos); void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length);
void write_word(tape_pos_t start , tape_word_t word , tape_pos_t& length); void write_gap(tape_pos_t a , tape_pos_t b);
void write_gap(tape_pos_t a , tape_pos_t b); bool just_gap(tape_pos_t a , tape_pos_t b);
bool just_gap(tape_pos_t a , tape_pos_t b); tape_pos_t farthest_end(const tape_track_t::iterator& it) const;
tape_pos_t farthest_end(const tape_track_t::iterator& it) const; bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive);
bool next_data(tape_track_t::iterator& it , tape_pos_t pos , bool inclusive); adv_res_t adv_it(tape_track_t::iterator& it);
adv_res_t adv_it(tape_track_t::iterator& it); attotime fetch_next_wr_word(void);
attotime fetch_next_wr_word(void); attotime time_to_rd_next_word(tape_pos_t& word_rd_pos);
attotime time_to_rd_next_word(tape_pos_t& word_rd_pos); bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap);
bool next_n_gap(tape_pos_t& pos , tape_track_t::iterator it , unsigned n_gaps , tape_pos_t min_gap); bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap);
bool next_n_gap(tape_pos_t& pos , unsigned n_gaps , tape_pos_t min_gap); void clear_tape(void);
void clear_tape(void); void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words); void save_tape(void);
void save_tape(void); bool load_track(tape_track_t& track);
bool load_track(tape_track_t& track); bool load_tape(void);
bool load_tape(void); void set_tape_present(bool present);
void set_tape_present(bool present); attotime time_to_next_hole(void) const;
attotime time_to_next_hole(void) const; attotime time_to_tach_pulses(void) const;
attotime time_to_tach_pulses(void) const; void start_cmd_exec(UINT16 new_cmd_reg);
void start_cmd_exec(UINT16 new_cmd_reg);
}; };
// device type definition // device type definition