mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Merge pull request #792 from fulivi/hp9845_dev
Improvements to tape driver of hp9845b [F.Ulivi]
This commit is contained in:
commit
6b545d47e8
@ -1459,7 +1459,7 @@ UINT32 hp_5061_3001_cpu_device::add_mae(aec_cases_t aec_case , UINT16 addr)
|
||||
bool top_half = BIT(addr , 15) != 0;
|
||||
|
||||
// Detect accesses to top half of base page
|
||||
if (aec_case == AEC_CASE_C && (addr & 0xfe00) == 0xfe00) {
|
||||
if ((aec_case == AEC_CASE_C || aec_case == AEC_CASE_I) && (addr & 0xfe00) == 0xfe00) {
|
||||
aec_case = AEC_CASE_B;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,6 +47,7 @@ public:
|
||||
virtual bool call_load() override;
|
||||
virtual bool call_create(int format_type, option_resolution *format_options) override;
|
||||
virtual void call_unload() override;
|
||||
virtual void call_display() override;
|
||||
virtual iodevice_t image_type() const override { return IO_MAGTAPE; }
|
||||
virtual bool is_readable() const override { return true; }
|
||||
virtual bool is_writeable() const override { return true; }
|
||||
@ -71,96 +72,116 @@ protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
// Storage of tracks: mapping from a tape position to word stored there
|
||||
typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
|
||||
// Storage of tracks: mapping from a tape position to word stored there
|
||||
typedef std::map<tape_pos_t , tape_word_t> tape_track_t;
|
||||
|
||||
devcb_write_line m_irq_handler;
|
||||
devcb_write_line m_flg_handler;
|
||||
devcb_write_line m_sts_handler;
|
||||
devcb_write_line m_irq_handler;
|
||||
devcb_write_line m_flg_handler;
|
||||
devcb_write_line m_sts_handler;
|
||||
|
||||
// Registers
|
||||
UINT16 m_data_reg;
|
||||
bool m_data_reg_full;
|
||||
UINT16 m_cmd_reg;
|
||||
UINT16 m_status_reg;
|
||||
UINT16 m_tach_reg;
|
||||
UINT16 m_checksum_reg;
|
||||
UINT16 m_timing_reg;
|
||||
// Registers
|
||||
UINT16 m_data_reg;
|
||||
bool m_data_reg_full;
|
||||
UINT16 m_cmd_reg;
|
||||
UINT16 m_status_reg;
|
||||
UINT16 m_tach_reg;
|
||||
tape_pos_t m_tach_reg_ref;
|
||||
bool m_tach_reg_frozen;
|
||||
UINT16 m_checksum_reg;
|
||||
bool m_clear_checksum_reg;
|
||||
UINT16 m_timing_reg;
|
||||
|
||||
// State
|
||||
bool m_irq;
|
||||
bool m_flg;
|
||||
bool m_sts;
|
||||
UINT8 m_cmd_state;
|
||||
// State
|
||||
bool m_irq;
|
||||
bool m_flg;
|
||||
bool m_sts;
|
||||
|
||||
// Tape position & motion
|
||||
tape_pos_t m_tape_pos;
|
||||
attotime m_start_time; // Tape moving if != never
|
||||
bool m_tape_fwd;
|
||||
bool m_tape_fast;
|
||||
// Command FSM state
|
||||
typedef enum {
|
||||
CMD_IDLE,
|
||||
CMD_INVERTING,
|
||||
CMD_PH0,
|
||||
CMD_PH1,
|
||||
CMD_PH2,
|
||||
CMD_PH3,
|
||||
CMD_END,
|
||||
CMD_STOPPING
|
||||
} cmd_state_t;
|
||||
cmd_state_t m_cmd_state;
|
||||
|
||||
// Timers
|
||||
emu_timer *m_tape_timer;
|
||||
emu_timer *m_hole_timer;
|
||||
// Tape position & motion
|
||||
tape_pos_t m_tape_pos;
|
||||
attotime m_start_time; // Tape moving if != never
|
||||
bool m_tape_fwd;
|
||||
bool m_tape_fast;
|
||||
|
||||
// Content of tape tracks
|
||||
tape_track_t m_tracks[ 2 ];
|
||||
bool m_image_dirty;
|
||||
// Timers
|
||||
emu_timer *m_tape_timer;
|
||||
emu_timer *m_hole_timer;
|
||||
|
||||
// Reading & writing
|
||||
bool m_tape_wr;
|
||||
tape_pos_t m_rw_pos;
|
||||
UINT16 m_next_word;
|
||||
tape_track_t::iterator m_rd_it;
|
||||
bool m_rd_it_valid;
|
||||
// Content of tape tracks
|
||||
tape_track_t m_tracks[ 2 ];
|
||||
bool m_image_dirty;
|
||||
|
||||
// Gap detection
|
||||
tape_pos_t m_gap_detect_start;
|
||||
// Reading & writing
|
||||
bool m_tape_wr;
|
||||
tape_pos_t m_rw_pos;
|
||||
UINT16 m_next_word;
|
||||
tape_track_t::iterator m_rd_it;
|
||||
bool m_rd_it_valid;
|
||||
|
||||
typedef enum {
|
||||
ADV_NO_MORE_DATA,
|
||||
ADV_CONT_DATA,
|
||||
ADV_DISCONT_DATA
|
||||
} adv_res_t;
|
||||
// Gap detection
|
||||
tape_pos_t m_gap_detect_start;
|
||||
|
||||
void clear_state(void);
|
||||
void irq_w(bool state);
|
||||
void set_error(bool state);
|
||||
unsigned speed_to_tick_freq(void) const;
|
||||
bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
|
||||
void move_tape_pos(tape_pos_t delta_pos);
|
||||
void update_tape_pos(void);
|
||||
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);
|
||||
tape_pos_t next_hole(void) const;
|
||||
attotime time_to_distance(tape_pos_t distance) 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);
|
||||
void start_tape(UINT16 cmd_reg);
|
||||
void stop_tape(void);
|
||||
tape_track_t& current_track(void);
|
||||
static tape_pos_t word_length(tape_word_t w);
|
||||
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);
|
||||
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);
|
||||
bool just_gap(tape_pos_t a , tape_pos_t b);
|
||||
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);
|
||||
adv_res_t adv_it(tape_track_t::iterator& it);
|
||||
attotime fetch_next_wr_word(void);
|
||||
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 , unsigned n_gaps , tape_pos_t min_gap);
|
||||
void clear_tape(void);
|
||||
void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
|
||||
void save_tape(void);
|
||||
bool load_track(tape_track_t& track);
|
||||
bool load_tape(void);
|
||||
void set_tape_present(bool present);
|
||||
attotime time_to_next_hole(void) const;
|
||||
attotime time_to_tach_pulses(void) const;
|
||||
void start_cmd_exec(UINT16 new_cmd_reg);
|
||||
typedef enum {
|
||||
ADV_NO_MORE_DATA,
|
||||
ADV_CONT_DATA,
|
||||
ADV_DISCONT_DATA
|
||||
} adv_res_t;
|
||||
|
||||
void clear_state(void);
|
||||
void irq_w(bool state);
|
||||
void set_error(bool state);
|
||||
bool is_braking(void) const;
|
||||
unsigned speed_to_tick_freq(void) const;
|
||||
bool pos_offset(tape_pos_t& pos , tape_pos_t offset) const;
|
||||
tape_pos_t current_tape_pos(void) const;
|
||||
void update_tape_pos(void);
|
||||
void update_tach_reg(void);
|
||||
void freeze_tach_reg(bool freeze);
|
||||
static void ensure_a_lt_b(tape_pos_t& a , tape_pos_t& b);
|
||||
tape_pos_t next_hole(void) const;
|
||||
attotime time_to_distance(tape_pos_t distance) const;
|
||||
attotime time_to_target(tape_pos_t target) const;
|
||||
attotime time_to_stopping_pos(void) const;
|
||||
bool start_tape_cmd(UINT16 cmd_reg , UINT16 must_be_1 , UINT16 must_be_0);
|
||||
void stop_tape(void);
|
||||
tape_track_t& current_track(void);
|
||||
static tape_pos_t word_length(tape_word_t w);
|
||||
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);
|
||||
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);
|
||||
bool just_gap(tape_pos_t a , tape_pos_t b);
|
||||
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);
|
||||
adv_res_t adv_it(tape_track_t::iterator& it);
|
||||
attotime fetch_next_wr_word(void);
|
||||
attotime time_to_rd_next_word(tape_pos_t& word_rd_pos);
|
||||
tape_pos_t min_gap_size(void) const;
|
||||
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);
|
||||
void clear_tape(void);
|
||||
void dump_sequence(tape_track_t::const_iterator it_start , unsigned n_words);
|
||||
void save_tape(void);
|
||||
bool load_track(tape_track_t& track);
|
||||
bool load_tape(void);
|
||||
void set_tape_present(bool present);
|
||||
attotime time_to_next_hole(void) const;
|
||||
attotime time_to_tach_pulses(void) const;
|
||||
void terminate_cmd_now(void);
|
||||
void cmd_fsm(void);
|
||||
void start_cmd_exec(UINT16 new_cmd_reg);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -44,7 +44,10 @@
|
||||
// Base address of video buffer
|
||||
#define VIDEO_BUFFER_BASE 0x17000
|
||||
|
||||
#define MAX_WORD_PER_ROW 600
|
||||
// For test "B" of alpha video to succeed this must be < 234
|
||||
// Basically "B" test is designed to intentionally prevent line buffer to be filled so that display is blanked
|
||||
// from 2nd row on. This in turn prevents "BAD" text to be visible on screen.
|
||||
#define MAX_WORD_PER_ROW 220
|
||||
|
||||
#define VIDEO_CHAR_WIDTH 9
|
||||
#define VIDEO_CHAR_HEIGHT 15
|
||||
@ -412,10 +415,14 @@ void hp9845b_state::video_render_buff(unsigned line_in_row, bool buff_idx)
|
||||
m_video_blanked = true;
|
||||
}
|
||||
|
||||
if (m_video_blanked) {
|
||||
// TODO: blank scanline
|
||||
} else {
|
||||
const rgb_t *palette = m_palette->palette()->entry_list_raw();
|
||||
|
||||
if (m_video_blanked) {
|
||||
// Blank scanline
|
||||
for (unsigned i = 0; i < (80 * 9); i++) {
|
||||
m_bitmap.pix32(m_video_scanline , i) = palette[ 0 ];
|
||||
}
|
||||
} else {
|
||||
bool cursor_line = line_in_row == 12;
|
||||
bool ul_line = line_in_row == 14;
|
||||
bool cursor_blink = BIT(m_video_frame , 3);
|
||||
|
Loading…
Reference in New Issue
Block a user