mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
i8271: modernize [Carl]
This commit is contained in:
parent
f73fe4cda8
commit
c400248728
@ -165,6 +165,8 @@ project "formats"
|
||||
MAME_DIR .. "src/lib/formats/asst128_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/atari_dsk.c",
|
||||
MAME_DIR .. "src/lib/formats/atari_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/atom_dsk.c",
|
||||
MAME_DIR .. "src/lib/formats/atom_dsk.h",
|
||||
MAME_DIR .. "src/lib/formats/atom_tap.c",
|
||||
MAME_DIR .. "src/lib/formats/atom_tap.h",
|
||||
MAME_DIR .. "src/lib/formats/bbc_dsk.c",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,23 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Kevin Thacker
|
||||
/*****************************************************************************
|
||||
*
|
||||
* machine/i8271.h
|
||||
*
|
||||
****************************************************************************/
|
||||
// copyright-holders:Carl,Olivier Galibert
|
||||
#ifndef I8271N_H_
|
||||
#define I8271N_H_
|
||||
|
||||
#ifndef I8271_H_
|
||||
#define I8271_H_
|
||||
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "emu.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "fdc_pll.h"
|
||||
|
||||
#define MCFG_I8271_IRQ_CALLBACK(_write) \
|
||||
devcb = &i8271_device::set_irq_wr_callback(*device, DEVCB_##_write);
|
||||
devcb = &i8271_device::set_intrq_wr_callback(*device, DEVCB_##_write);
|
||||
|
||||
#define MCFG_I8271_DRQ_CALLBACK(_write) \
|
||||
devcb = &i8271_device::set_drq_wr_callback(*device, DEVCB_##_write);
|
||||
|
||||
#define MCFG_I8271_FLOPPIES(_tag1, _tag2) \
|
||||
i8271_device::set_floppy_tags(*device, _tag1, _tag2);
|
||||
#define MCFG_I8271_HDL_CALLBACK(_write) \
|
||||
devcb = &i8271_device::set_hdl_wr_callback(*device, DEVCB_##_write);
|
||||
|
||||
#define MCFG_I8271_OPT_CALLBACK(_write) \
|
||||
devcb = &i8271_device::set_opt_wr_callback(*device, DEVCB_##_write);
|
||||
|
||||
/***************************************************************************
|
||||
MACROS
|
||||
@ -30,136 +29,268 @@ public:
|
||||
i8271_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
~i8271_device() {}
|
||||
|
||||
template<class _Object> static devcb_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).m_write_irq.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).m_write_drq.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_intrq_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).intrq_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).drq_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_hdl_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).hdl_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_opt_wr_callback(device_t &device, _Object object) { return downcast<i8271_device &>(device).opt_cb.set_callback(object); }
|
||||
|
||||
static void set_floppy_tags(device_t &device, const char *tag1, const char *tag2)
|
||||
{
|
||||
i8271_device &dev = downcast<i8271_device &>(device);
|
||||
dev.m_floppy_tag1 = tag1;
|
||||
dev.m_floppy_tag2 = tag2;
|
||||
}
|
||||
|
||||
DECLARE_READ8_MEMBER(read);
|
||||
DECLARE_WRITE8_MEMBER(write);
|
||||
|
||||
DECLARE_READ8_MEMBER(dack_r);
|
||||
DECLARE_WRITE8_MEMBER(dack_w);
|
||||
|
||||
DECLARE_READ8_MEMBER(data_r);
|
||||
DECLARE_READ8_MEMBER (sr_r);
|
||||
DECLARE_READ8_MEMBER (rr_r);
|
||||
DECLARE_WRITE8_MEMBER(reset_w) { if(data == 1) soft_reset(); }
|
||||
DECLARE_WRITE8_MEMBER(cmd_w);
|
||||
DECLARE_WRITE8_MEMBER(param_w);
|
||||
DECLARE_READ8_MEMBER (data_r);
|
||||
DECLARE_WRITE8_MEMBER(data_w);
|
||||
DECLARE_ADDRESS_MAP(map, 8);
|
||||
|
||||
void ready_w(bool val);
|
||||
|
||||
void set_rate(int rate); // rate in bps, to be used when the fdc is externally frequency-controlled
|
||||
|
||||
void set_ready_line_connected(bool ready);
|
||||
void set_select_lines_connected(bool select);
|
||||
void set_floppy(floppy_image_device *image);
|
||||
void soft_reset();
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
// internal state
|
||||
enum
|
||||
{
|
||||
TIMER_DATA_CALLBACK,
|
||||
TIMER_TIMED_COMMAND_COMPLETE
|
||||
enum {
|
||||
PHASE_IDLE, PHASE_CMD, PHASE_EXEC, PHASE_RESULT
|
||||
};
|
||||
|
||||
devcb_write_line m_write_irq;
|
||||
devcb_write_line m_write_drq;
|
||||
enum {
|
||||
RR_DEL = 0x20,
|
||||
RR_CT = 0x18,
|
||||
RR_CC = 0x06,
|
||||
|
||||
const char *m_floppy_tag1, *m_floppy_tag2;
|
||||
legacy_floppy_image_device *m_floppy[2];
|
||||
SR_BSY = 0x80,
|
||||
SR_CF = 0x40,
|
||||
SR_PF = 0x20,
|
||||
SR_RF = 0x10,
|
||||
SR_IRQ = 0x08,
|
||||
SR_DRQ = 0x04
|
||||
};
|
||||
|
||||
int m_flags;
|
||||
int m_state;
|
||||
unsigned char m_Command;
|
||||
unsigned char m_StatusRegister;
|
||||
unsigned char m_CommandRegister;
|
||||
unsigned char m_ResultRegister;
|
||||
unsigned char m_ParameterRegister;
|
||||
unsigned char m_ResetRegister;
|
||||
unsigned char m_data;
|
||||
enum {
|
||||
ERR_NONE = 0x00,
|
||||
ERR_SMEQ = 0x02,
|
||||
ERR_SMNE = 0x04,
|
||||
ERR_CLK = 0x08,
|
||||
ERR_DMA = 0x0a,
|
||||
ERR_ICRC = 0x0c,
|
||||
ERR_DCRC = 0x0e,
|
||||
ERR_NR = 0x10,
|
||||
ERR_WP = 0x12,
|
||||
ERR_T0NF = 0x14,
|
||||
ERR_WF = 0x16,
|
||||
ERR_NF = 0x18
|
||||
};
|
||||
|
||||
/* number of parameters required after command is specified */
|
||||
unsigned long m_ParameterCount;
|
||||
/* number of parameters written so far */
|
||||
unsigned long m_ParameterCountWritten;
|
||||
enum {
|
||||
// General "doing nothing" state
|
||||
IDLE,
|
||||
|
||||
unsigned char m_CommandParameters[8];
|
||||
// Main states
|
||||
RECALIBRATE,
|
||||
SEEK,
|
||||
READ_DATA,
|
||||
WRITE_DATA,
|
||||
FORMAT_TRACK,
|
||||
READ_ID,
|
||||
SCAN_DATA,
|
||||
VERIFY_DATA,
|
||||
|
||||
/* current track for each drive */
|
||||
unsigned long m_CurrentTrack[2];
|
||||
// Sub-states
|
||||
COMMAND_DONE,
|
||||
|
||||
/* 2 bad tracks for drive 0, followed by 2 bad tracks for drive 1 */
|
||||
unsigned long m_BadTracks[4];
|
||||
SEEK_MOVE,
|
||||
SEEK_WAIT_STEP_SIGNAL_TIME,
|
||||
SEEK_WAIT_STEP_SIGNAL_TIME_DONE,
|
||||
SEEK_WAIT_STEP_TIME,
|
||||
SEEK_WAIT_STEP_TIME_DONE,
|
||||
SEEK_DONE,
|
||||
|
||||
/* mode special register */
|
||||
unsigned long m_Mode;
|
||||
HEAD_LOAD_DONE,
|
||||
|
||||
WAIT_INDEX,
|
||||
WAIT_INDEX_DONE,
|
||||
|
||||
/* drive outputs */
|
||||
int m_drive;
|
||||
int m_side;
|
||||
SCAN_ID,
|
||||
SCAN_ID_FAILED,
|
||||
|
||||
/* drive control output special register */
|
||||
int m_drive_control_output;
|
||||
/* drive control input special register */
|
||||
int m_drive_control_input;
|
||||
SECTOR_READ,
|
||||
SECTOR_WRITTEN,
|
||||
TC_DONE,
|
||||
|
||||
unsigned long m_StepRate;
|
||||
unsigned long m_HeadSettlingTime;
|
||||
unsigned long m_IndexCountBeforeHeadUnload;
|
||||
unsigned long m_HeadLoadTime;
|
||||
TRACK_DONE,
|
||||
|
||||
/* id on disc to find */
|
||||
//int m_ID_C;
|
||||
//int m_ID_H;
|
||||
int m_ID_R;
|
||||
int m_ID_N;
|
||||
// Live states
|
||||
SEARCH_ADDRESS_MARK_HEADER,
|
||||
READ_ID_BLOCK,
|
||||
SEARCH_ADDRESS_MARK_DATA,
|
||||
SEARCH_ADDRESS_MARK_DATA_FAILED,
|
||||
READ_SECTOR_DATA,
|
||||
READ_SECTOR_DATA_BYTE,
|
||||
SCAN_SECTOR_DATA_BYTE,
|
||||
VERIFY_SECTOR_DATA_BYTE,
|
||||
|
||||
/* id of data for read/write */
|
||||
int m_data_id;
|
||||
WRITE_SECTOR_SKIP_GAP2,
|
||||
WRITE_SECTOR_SKIP_GAP2_BYTE,
|
||||
WRITE_SECTOR_DATA,
|
||||
WRITE_SECTOR_DATA_BYTE,
|
||||
|
||||
int m_ExecutionPhaseTransferCount;
|
||||
char *m_pExecutionPhaseData;
|
||||
int m_ExecutionPhaseCount;
|
||||
WRITE_TRACK_PRE_SECTORS,
|
||||
WRITE_TRACK_PRE_SECTORS_BYTE,
|
||||
|
||||
/* sector counter and id counter */
|
||||
int m_Counter;
|
||||
WRITE_TRACK_SECTOR,
|
||||
WRITE_TRACK_SECTOR_BYTE,
|
||||
|
||||
/* ==0, to cpu, !=0 =from cpu */
|
||||
//int m_data_direction;
|
||||
WRITE_TRACK_POST_SECTORS,
|
||||
WRITE_TRACK_POST_SECTORS_BYTE
|
||||
};
|
||||
|
||||
emu_timer *m_data_timer;
|
||||
emu_timer *m_command_complete_timer;
|
||||
struct pll_t {
|
||||
attotime ctime, period, min_period, max_period, period_adjust_base, phase_adjust;
|
||||
|
||||
void seek_to_track(int track);
|
||||
void load_bad_tracks(int surface);
|
||||
void write_bad_track(int surface, int track, int data);
|
||||
void write_current_track(int surface, int track);
|
||||
int read_current_track(int surface);
|
||||
int read_bad_track(int surface, int track);
|
||||
void get_drive();
|
||||
void check_all_parameters_written();
|
||||
void update_state();
|
||||
void initialise_execution_phase_read(int transfer_size);
|
||||
void initialise_execution_phase_write(int transfer_size);
|
||||
void command_execute();
|
||||
void command_continue();
|
||||
void command_complete(int result, int int_rq);
|
||||
void timed_command_complete();
|
||||
void data_request();
|
||||
void clear_data_request();
|
||||
void timed_data_request();
|
||||
/* locate sector for read/write operation */
|
||||
int find_sector();
|
||||
/* do a read operation */
|
||||
void do_read();
|
||||
void do_write();
|
||||
void do_read_id();
|
||||
void set_irq_state(int);
|
||||
void set_dma_drq();
|
||||
attotime write_start_time;
|
||||
attotime write_buffer[32];
|
||||
int write_position;
|
||||
int freq_hist;
|
||||
|
||||
void set_clock(const attotime &period);
|
||||
void reset(const attotime &when);
|
||||
int get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit);
|
||||
bool write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
|
||||
void start_writing(const attotime &tm);
|
||||
void commit(floppy_image_device *floppy, const attotime &tm);
|
||||
void stop_writing(floppy_image_device *floppy, const attotime &tm);
|
||||
};
|
||||
|
||||
struct floppy_info {
|
||||
enum { IRQ_NONE, IRQ_POLLED, IRQ_SEEK, IRQ_DONE };
|
||||
emu_timer *tm;
|
||||
floppy_image_device *dev;
|
||||
int id;
|
||||
int main_state, sub_state;
|
||||
int dir, counter;
|
||||
UINT8 pcn, badtrack[2];
|
||||
bool live, index, ready;
|
||||
};
|
||||
|
||||
struct live_info {
|
||||
enum { PT_NONE, PT_CRC_1, PT_CRC_2 };
|
||||
|
||||
attotime tm;
|
||||
int state, next_state;
|
||||
floppy_info *fi;
|
||||
UINT16 shift_reg;
|
||||
UINT16 crc;
|
||||
int bit_counter, byte_counter, previous_type;
|
||||
bool data_separator_phase, data_bit_context;
|
||||
UINT8 data_reg;
|
||||
UINT8 idbuf[6];
|
||||
fdc_pll_t pll;
|
||||
};
|
||||
|
||||
bool ready_connected, select_connected;
|
||||
|
||||
bool external_ready;
|
||||
|
||||
int mode;
|
||||
int main_phase;
|
||||
|
||||
live_info cur_live, checkpoint_live;
|
||||
devcb_write_line intrq_cb, drq_cb, hdl_cb, opt_cb;
|
||||
bool irq, drq, scan_done, scan_match;
|
||||
floppy_info flopi[2];
|
||||
|
||||
int command_pos, sectors_read, scan_len;
|
||||
UINT8 command[6], dma_data;
|
||||
UINT8 rr, scan_sec, moder;
|
||||
UINT8 precomp, perpmode, scan_cnt[2];
|
||||
UINT8 srate, hset, icnt, hload;
|
||||
int sector_size;
|
||||
int cur_rate;
|
||||
|
||||
static std::string tts(attotime t);
|
||||
std::string ttsn();
|
||||
|
||||
enum {
|
||||
C_FORMAT_TRACK,
|
||||
C_READ_DATA_SINGLE,
|
||||
C_READ_DATA_MULTI,
|
||||
C_VERIFY_DATA_SINGLE,
|
||||
C_VERIFY_DATA_MULTI,
|
||||
C_WRITE_DATA_SINGLE,
|
||||
C_WRITE_DATA_MULTI,
|
||||
C_READ_ID,
|
||||
C_SEEK,
|
||||
C_READ_DRIVE_STATUS,
|
||||
C_SPECIFY,
|
||||
C_SCAN,
|
||||
C_WRITE_SPECIAL_REGISTER,
|
||||
C_READ_SPECIAL_REGISTER,
|
||||
|
||||
C_INVALID,
|
||||
C_INCOMPLETE
|
||||
};
|
||||
|
||||
void delay_cycles(emu_timer *tm, int cycles);
|
||||
void set_drq(bool state);
|
||||
void set_irq(bool state);
|
||||
bool get_ready(int fid);
|
||||
|
||||
void enable_transfer();
|
||||
void disable_transfer();
|
||||
int calc_sector_size(UINT8 size);
|
||||
|
||||
int check_command();
|
||||
void start_command(int cmd);
|
||||
void command_end(floppy_info &fi, bool data_completion);
|
||||
|
||||
void recalibrate_start(floppy_info &fi);
|
||||
void seek_start(floppy_info &fi);
|
||||
void seek_continue(floppy_info &fi);
|
||||
|
||||
void read_data_start(floppy_info &fi);
|
||||
void read_data_continue(floppy_info &fi);
|
||||
|
||||
void write_data_start(floppy_info &fi);
|
||||
void write_data_continue(floppy_info &fi);
|
||||
|
||||
void format_track_start(floppy_info &fi);
|
||||
void format_track_continue(floppy_info &fi);
|
||||
|
||||
void read_id_start(floppy_info &fi);
|
||||
void read_id_continue(floppy_info &fi);
|
||||
|
||||
void scan_start(floppy_info &fi);
|
||||
void verify_data_start(floppy_info &fi);
|
||||
|
||||
void general_continue(floppy_info &fi);
|
||||
void index_callback(floppy_image_device *floppy, int state);
|
||||
bool sector_matches() const;
|
||||
|
||||
void live_start(floppy_info &fi, int live_state);
|
||||
void live_abort();
|
||||
void checkpoint();
|
||||
void rollback();
|
||||
void live_delay(int state);
|
||||
void live_sync();
|
||||
void live_run(attotime limit = attotime::never);
|
||||
void live_write_raw(UINT16 raw);
|
||||
void live_write_fm(UINT8 fm);
|
||||
|
||||
bool read_one_bit(const attotime &limit);
|
||||
bool write_one_bit(const attotime &limit);
|
||||
bool set_output(UINT8 data);
|
||||
bool get_input(UINT8 *data);
|
||||
};
|
||||
|
||||
extern const device_type I8271;
|
||||
|
||||
#endif /* I8271_H_ */
|
||||
#endif
|
||||
|
31
src/lib/formats/atom_dsk.c
Normal file
31
src/lib/formats/atom_dsk.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include "atom_dsk.h"
|
||||
|
||||
atom_format::atom_format() : wd177x_format(formats)
|
||||
{
|
||||
}
|
||||
|
||||
const char *atom_format::name() const
|
||||
{
|
||||
return "atom";
|
||||
}
|
||||
|
||||
const char *atom_format::description() const
|
||||
{
|
||||
return "Acorn Atom disk image";
|
||||
}
|
||||
|
||||
const char *atom_format::extensions() const
|
||||
{
|
||||
return "40t,dsk";
|
||||
}
|
||||
|
||||
const atom_format::format atom_format::formats[] =
|
||||
{
|
||||
{ // 100k 40 track single sided single density
|
||||
floppy_image::FF_525, floppy_image::SSSD, floppy_image::FM,
|
||||
4000, 10, 40, 1, 256, {}, 0, {}, 40, 10, 10
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
const floppy_format_type FLOPPY_ATOM_FORMAT = &floppy_image_format_creator<atom_format>;
|
22
src/lib/formats/atom_dsk.h
Normal file
22
src/lib/formats/atom_dsk.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __ATOM_DSK_H__
|
||||
#define __ATOM_DSK_H__
|
||||
|
||||
#include "flopimg.h"
|
||||
#include "wd177x_dsk.h"
|
||||
|
||||
class atom_format : public wd177x_format
|
||||
{
|
||||
public:
|
||||
atom_format();
|
||||
|
||||
virtual const char *name() const;
|
||||
virtual const char *description() const;
|
||||
virtual const char *extensions() const;
|
||||
|
||||
private:
|
||||
static const format formats[];
|
||||
};
|
||||
|
||||
extern const floppy_format_type FLOPPY_ATOM_FORMAT;
|
||||
|
||||
#endif
|
@ -247,7 +247,7 @@ READ8_MEMBER( atomeb_state::dos_r )
|
||||
|
||||
static ADDRESS_MAP_START( atom_mem, AS_PROGRAM, 8, atom_state )
|
||||
AM_RANGE(0x0000, 0x09ff) AM_RAM
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_MIRROR(0x1f8) AM_DEVREADWRITE(I8271_TAG, i8271_device, read, write)
|
||||
AM_RANGE(0x0a00, 0x0a03) AM_MIRROR(0x1f8) AM_DEVICE(I8271_TAG, i8271_device, map)
|
||||
AM_RANGE(0x0a04, 0x0a04) AM_MIRROR(0x1f8) AM_DEVREADWRITE(I8271_TAG, i8271_device, data_r, data_w)
|
||||
AM_RANGE(0x0a05, 0x7fff) AM_RAM
|
||||
AM_RANGE(0x8000, 0x97ff) AM_RAM AM_SHARE("video_ram")
|
||||
@ -583,30 +583,11 @@ WRITE_LINE_MEMBER( atom_state::atom_8271_interrupt_callback )
|
||||
m_previous_i8271_int_state = state;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
LEGACY_FLOPPY_OPTIONS( atom )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static LEGACY_FLOPPY_OPTIONS_START( atom )
|
||||
LEGACY_FLOPPY_OPTION(atom, "dsk,40t", "Atom disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
|
||||
HEADS([1])
|
||||
TRACKS([40])
|
||||
SECTORS([10])
|
||||
SECTOR_LENGTH([256])
|
||||
FIRST_SECTOR_ID([0]))
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
|
||||
/*-------------------------------------------------
|
||||
floppy_interface atom_floppy_interface
|
||||
-------------------------------------------------*/
|
||||
|
||||
static const floppy_interface atom_floppy_interface =
|
||||
WRITE_LINE_MEMBER( atom_state::motor_w )
|
||||
{
|
||||
FLOPPY_STANDARD_5_25_SSDD_40,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(atom),
|
||||
"floppy_5_25"
|
||||
};
|
||||
|
||||
m_fdc->subdevice<floppy_connector>("0")->get_device()->mon_w(!state);
|
||||
m_fdc->subdevice<floppy_connector>("1")->get_device()->mon_w(!state);
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(atom_state::cassette_output_tick)
|
||||
{
|
||||
@ -687,6 +668,13 @@ int atom_state::load_cart(device_image_interface &image, generic_slot_device *sl
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
static SLOT_INTERFACE_START(atom_floppies)
|
||||
SLOT_INTERFACE("525sssd", FLOPPY_525_SSSD)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
FLOPPY_FORMATS_MEMBER(atom_state::floppy_formats)
|
||||
FLOPPY_ATOM_FORMAT
|
||||
FLOPPY_FORMATS_END
|
||||
|
||||
/*-------------------------------------------------
|
||||
MACHINE_DRIVER( atom )
|
||||
@ -722,10 +710,11 @@ static MACHINE_CONFIG_START( atom, atom_state )
|
||||
MCFG_I8255_IN_PORTC_CB(READ8(atom_state, ppi_pc_r))
|
||||
MCFG_I8255_OUT_PORTC_CB(WRITE8(atom_state, ppi_pc_w))
|
||||
|
||||
MCFG_DEVICE_ADD(I8271_TAG, I8271, 0)
|
||||
MCFG_DEVICE_ADD(I8271_TAG, I8271 , 0)
|
||||
MCFG_I8271_IRQ_CALLBACK(WRITELINE(atom_state, atom_8271_interrupt_callback))
|
||||
MCFG_I8271_FLOPPIES(FLOPPY_0, FLOPPY_1)
|
||||
MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(atom_floppy_interface)
|
||||
MCFG_I8271_HDL_CALLBACK(WRITELINE(atom_state, motor_w))
|
||||
MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":0", atom_floppies, "525sssd", atom_state::floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD(I8271_TAG ":1", atom_floppies, "525sssd", atom_state::floppy_formats)
|
||||
|
||||
MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_devices, "printer")
|
||||
MCFG_CENTRONICS_ACK_HANDLER(DEVWRITELINE(R6522_TAG, via6522_device, write_ca1))
|
||||
|
@ -194,8 +194,8 @@ static ADDRESS_MAP_START( bbcb_mem, AS_PROGRAM, 8, bbc_state )
|
||||
AM_RANGE(0x8000, 0xbfff) AM_READ_BANK("bank4") AM_WRITE(bbc_memoryb4_w) /* 8000-bfff Paged ROM */
|
||||
AM_RANGE(0xfe30, 0xfe3f) AM_READWRITE(bbc_fe_r, bbc_page_selectb_w) /* R: fe30-fe3f NC Not Connected */
|
||||
/* W: fe30-fe3f 84LS161 Paged ROM selector */
|
||||
AM_RANGE(0xfe80, 0xfe83) AM_DEVREADWRITE("i8271", i8271_device, read, write) /* fe80-fe9f 8271 FDC Floppy disc controller */
|
||||
AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("i8271", i8271_device, dack_r, dack_w) /* fe80-fe9f 8271 FDC Floppy disc controller */
|
||||
AM_RANGE(0xfe80, 0xfe83) AM_DEVICE("i8271" , i8271_device, map) /* fe80-fe9f 8271 FDC Floppy disc controller */
|
||||
AM_RANGE(0xfe84, 0xfe9f) AM_DEVREADWRITE("i8271", i8271_device, data_r, data_w) /* fe80-fe9f 8271 FDC Floppy disc controller */
|
||||
AM_IMPORT_FROM(bbc_base)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -635,13 +635,6 @@ WRITE_LINE_MEMBER(bbc_state::bbcb_acia6850_irq_w)
|
||||
}
|
||||
|
||||
|
||||
static const floppy_interface bbc_floppy_interface =
|
||||
{
|
||||
FLOPPY_STANDARD_5_25_DSDD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(bbc),
|
||||
"floppy_5_25"
|
||||
};
|
||||
|
||||
FLOPPY_FORMATS_MEMBER( bbc_state::floppy_formats_525sd )
|
||||
FLOPPY_BBC_SSD_525_FORMAT,
|
||||
FLOPPY_BBC_DSD_525_FORMAT
|
||||
@ -824,11 +817,11 @@ static MACHINE_CONFIG_DERIVED( bbcb, bbca )
|
||||
MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
|
||||
|
||||
/* fdc */
|
||||
MCFG_DEVICE_ADD("i8271", I8271, 0)
|
||||
MCFG_DEVICE_ADD("i8271" , I8271 , 0)
|
||||
MCFG_I8271_IRQ_CALLBACK(WRITELINE(bbc_state, bbc_i8271_interrupt))
|
||||
MCFG_I8271_FLOPPIES(FLOPPY_0, FLOPPY_1)
|
||||
|
||||
MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(bbc_floppy_interface)
|
||||
MCFG_I8271_HDL_CALLBACK(WRITELINE(bbc_state, motor_w))
|
||||
MCFG_FLOPPY_DRIVE_ADD("i8271:0", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd)
|
||||
MCFG_FLOPPY_DRIVE_ADD("i8271:1", bbc_floppies_525, "qd", bbc_state::floppy_formats_525sd)
|
||||
|
||||
/* software lists */
|
||||
MCFG_DEVICE_REMOVE("cass_ls_a")
|
||||
@ -844,8 +837,6 @@ static MACHINE_CONFIG_DERIVED(bbcb1770, bbcb)
|
||||
|
||||
/* fdc */
|
||||
MCFG_DEVICE_REMOVE("i8271")
|
||||
MCFG_DEVICE_REMOVE(FLOPPY_0)
|
||||
MCFG_DEVICE_REMOVE(FLOPPY_1)
|
||||
|
||||
MCFG_WD1770_ADD("wd1770", XTAL_16MHz / 2)
|
||||
MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(bbc_state, bbc_wd177x_intrq_w))
|
||||
|
@ -140,7 +140,7 @@ static ADDRESS_MAP_START(ioc_io_map , AS_IO , 8 , imds2_state)
|
||||
AM_RANGE(0x90 , 0x9f) AM_READ(imds2_kb_read)
|
||||
AM_RANGE(0xa0 , 0xaf) AM_READ(imds2_ioc_status_r)
|
||||
AM_RANGE(0xb0 , 0xbf) AM_READ(imds2_ioc_dbbin_r)
|
||||
AM_RANGE(0xc0 , 0xcf) AM_DEVREADWRITE("iocfdc" , i8271_device , read , write)
|
||||
AM_RANGE(0xc0 , 0xcf) AM_DEVICE("iocfdc" , i8271_device, map)
|
||||
AM_RANGE(0xd0 , 0xdf) AM_DEVREADWRITE("ioccrtc" , i8275_device , read , write)
|
||||
AM_RANGE(0xe0 , 0xef) AM_DEVREADWRITE("ioctimer" , pit8253_device , read , write);
|
||||
// DMA controller range doesn't extend to 0xff because register 0xfd needs to be read as 0xff
|
||||
@ -171,11 +171,12 @@ imds2_state::imds2_state(const machine_config &mconfig, device_type type, const
|
||||
m_iocbeep(*this , "iocbeep"),
|
||||
m_ioctimer(*this , "ioctimer"),
|
||||
m_iocfdc(*this , "iocfdc"),
|
||||
m_flop0(*this, "iocfdc:0"),
|
||||
m_flop1(*this, "iocfdc:1"),
|
||||
m_iocpio(*this , "iocpio"),
|
||||
m_kbcpu(*this , "kbcpu"),
|
||||
m_palette(*this , "palette"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_floppy0(*this , FLOPPY_0),
|
||||
m_centronics(*this , "centronics"),
|
||||
m_io_key0(*this , "KEY0"),
|
||||
m_io_key1(*this , "KEY1"),
|
||||
@ -551,6 +552,17 @@ I8275_DRAW_CHARACTER_MEMBER(imds2_state::crtc_display_pixels)
|
||||
}
|
||||
}
|
||||
|
||||
int imds2_state::floppy_load(floppy_image_device *dev)
|
||||
{
|
||||
dev->mon_w(0);
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
|
||||
void imds2_state::floppy_unload(floppy_image_device *dev)
|
||||
{
|
||||
dev->mon_w(1);
|
||||
}
|
||||
|
||||
void imds2_state::driver_start()
|
||||
{
|
||||
// Allocate 64k for IPC RAM
|
||||
@ -566,8 +578,11 @@ void imds2_state::driver_start()
|
||||
|
||||
void imds2_state::machine_start()
|
||||
{
|
||||
m_floppy0->floppy_mon_w(0);
|
||||
m_floppy0->floppy_drive_set_ready_state(1 , 0);
|
||||
// As far as I can tell from the schmatic, there's no software motor control
|
||||
m_flop0->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this));
|
||||
m_flop0->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this));
|
||||
m_flop1->get_device()->setup_load_cb(floppy_image_device::load_cb(FUNC(imds2_state::floppy_load), this));
|
||||
m_flop1->get_device()->setup_unload_cb(floppy_image_device::unload_cb(FUNC(imds2_state::floppy_unload), this));
|
||||
}
|
||||
|
||||
void imds2_state::video_start()
|
||||
@ -580,6 +595,10 @@ void imds2_state::machine_reset()
|
||||
m_iocbeep->set_frequency(IOC_BEEP_FREQ);
|
||||
m_ipc_control = 0x00;
|
||||
m_ipc_ioc_status = 0x0f;
|
||||
m_flop0->get_device()->mon_w(!m_flop0->get_device()->exists());
|
||||
m_flop1->get_device()->mon_w(!m_flop1->get_device()->exists());
|
||||
|
||||
m_iocfdc->set_rate(500000); // The IMD images show a rate of 500kbps
|
||||
}
|
||||
|
||||
bool imds2_state::imds2_in_ipc_rom(offs_t offset) const
|
||||
@ -737,15 +756,9 @@ static GFXDECODE_START(imds2)
|
||||
GFXDECODE_ENTRY("gfx1" , 0x0000 , imds2_charlayout , 0 , 1)
|
||||
GFXDECODE_END
|
||||
|
||||
static LEGACY_FLOPPY_OPTIONS_START(imds2)
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
|
||||
static const floppy_interface imds2_floppy_interface =
|
||||
{
|
||||
FLOPPY_STANDARD_8_SSSD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(imds2),
|
||||
"floppy_8"
|
||||
};
|
||||
static SLOT_INTERFACE_START( imds2_floppies )
|
||||
SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD )
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static MACHINE_CONFIG_START(imds2 , imds2_state)
|
||||
MCFG_CPU_ADD("ipccpu" , I8085A , IPC_XTAL_Y2 / 2) // 4 MHz
|
||||
@ -805,8 +818,8 @@ static MACHINE_CONFIG_START(imds2 , imds2_state)
|
||||
MCFG_I8257_OUT_HRQ_CB(WRITELINE(imds2_state, imds2_hrq_w))
|
||||
MCFG_I8257_IN_MEMR_CB(READ8(imds2_state , imds2_ioc_mem_r))
|
||||
MCFG_I8257_OUT_MEMW_CB(WRITE8(imds2_state , imds2_ioc_mem_w))
|
||||
MCFG_I8257_IN_IOR_1_CB(DEVREAD8("iocfdc" , i8271_device , dack_r))
|
||||
MCFG_I8257_OUT_IOW_1_CB(DEVWRITE8("iocfdc" , i8271_device , dack_w))
|
||||
MCFG_I8257_IN_IOR_1_CB(DEVREAD8("iocfdc" , i8271_device , data_r))
|
||||
MCFG_I8257_OUT_IOW_1_CB(DEVWRITE8("iocfdc" , i8271_device , data_w))
|
||||
MCFG_I8257_OUT_IOW_2_CB(DEVWRITE8("ioccrtc" , i8275_device , dack_w))
|
||||
|
||||
MCFG_DEVICE_ADD("ioctimer" , PIT8253 , 0)
|
||||
@ -816,9 +829,8 @@ static MACHINE_CONFIG_START(imds2 , imds2_state)
|
||||
|
||||
MCFG_DEVICE_ADD("iocfdc" , I8271 , IOC_XTAL_Y1 / 2)
|
||||
MCFG_I8271_DRQ_CALLBACK(DEVWRITELINE("iocdma" , i8257_device , dreq1_w))
|
||||
MCFG_I8271_FLOPPIES(FLOPPY_0 , FLOPPY_1)
|
||||
|
||||
MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, imds2_floppy_interface)
|
||||
MCFG_FLOPPY_DRIVE_ADD("iocfdc:0", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("iocfdc:1", imds2_floppies, "8sssd", floppy_image_device::default_floppy_formats)
|
||||
|
||||
MCFG_CPU_ADD("iocpio" , I8041 , IOC_XTAL_Y3)
|
||||
MCFG_CPU_IO_MAP(pio_io_map)
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "machine/ram.h"
|
||||
#include "imagedev/snapquik.h"
|
||||
#include "formats/atom_tap.h"
|
||||
#include "formats/basicdsk.h"
|
||||
#include "formats/atom_dsk.h"
|
||||
#include "formats/uef_cas.h"
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "machine/6522via.h"
|
||||
@ -46,6 +46,7 @@ public:
|
||||
m_maincpu(*this, SY6502_TAG),
|
||||
m_vdg(*this, MC6847_TAG),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_fdc(*this, I8271_TAG),
|
||||
m_centronics(*this, CENTRONICS_TAG),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_cart(*this, "cartslot"),
|
||||
@ -67,6 +68,7 @@ public:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<mc6847_base_device> m_vdg;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
optional_device<i8271_device> m_fdc;
|
||||
required_device<centronics_device> m_centronics;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
optional_device<generic_slot_device> m_cart;
|
||||
@ -95,6 +97,7 @@ public:
|
||||
DECLARE_READ8_MEMBER( vdg_videoram_r );
|
||||
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
|
||||
DECLARE_WRITE_LINE_MEMBER( atom_8271_interrupt_callback );
|
||||
DECLARE_WRITE_LINE_MEMBER( motor_w );
|
||||
|
||||
/* video state */
|
||||
required_shared_ptr<UINT8> m_video_ram;
|
||||
@ -109,6 +112,7 @@ public:
|
||||
|
||||
/* devices */
|
||||
int m_previous_i8271_int_state;
|
||||
DECLARE_FLOPPY_FORMATS(floppy_formats);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(cassette_output_tick);
|
||||
|
||||
int load_cart(device_image_interface &image, generic_slot_device *slot);
|
||||
|
@ -167,6 +167,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(write_cts_serial);
|
||||
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
|
||||
DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt);
|
||||
DECLARE_WRITE_LINE_MEMBER(motor_w);
|
||||
|
||||
UPD7002_GET_ANALOGUE(BBC_get_analogue_input);
|
||||
UPD7002_EOC(BBC_uPD7002_EOC);
|
||||
|
@ -79,11 +79,12 @@ class imds2_state : public driver_device
|
||||
required_device<beep_device> m_iocbeep;
|
||||
required_device<pit8253_device> m_ioctimer;
|
||||
required_device<i8271_device> m_iocfdc;
|
||||
required_device<floppy_connector> m_flop0;
|
||||
required_device<floppy_connector> m_flop1;
|
||||
required_device<i8041_device> m_iocpio;
|
||||
required_device<i8741_device> m_kbcpu;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<legacy_floppy_image_device> m_floppy0;
|
||||
required_device<centronics_device> m_centronics;
|
||||
required_ioport m_io_key0;
|
||||
required_ioport m_io_key1;
|
||||
@ -101,6 +102,8 @@ class imds2_state : public driver_device
|
||||
|
||||
void imds2_update_beeper(void);
|
||||
void imds2_update_printer(void);
|
||||
int floppy_load(floppy_image_device *dev);
|
||||
void floppy_unload(floppy_image_device *dev);
|
||||
|
||||
// IPC control port
|
||||
UINT8 m_ipc_control;
|
||||
|
@ -1439,6 +1439,12 @@ WRITE_LINE_MEMBER(bbc_state::bbc_i8271_interrupt)
|
||||
m_previous_i8271_int_state = state;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(bbc_state::motor_w)
|
||||
{
|
||||
m_i8271->subdevice<floppy_connector>("0")->get_device()->mon_w(!state);
|
||||
m_i8271->subdevice<floppy_connector>("1")->get_device()->mon_w(!state);
|
||||
}
|
||||
|
||||
|
||||
/**************************************
|
||||
WD1770 disc control function
|
||||
|
Loading…
Reference in New Issue
Block a user