summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/ti99/990_dk.h
blob: 31c0ca4f6ca52f3e04a32b0ec5db6dd64d6357f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// license:???
// copyright-holders:???
/*
    990_dk.h: include file for 990_dk.c
*/

#ifndef __990_DK__
#define __990_DK__

#include "imagedev/flopdrv.h"

extern const device_type FD800;

#define MAX_FLOPPIES 4

class fd800_legacy_device : public device_t
{
public:
	fd800_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	DECLARE_READ8_MEMBER( cru_r );
	DECLARE_WRITE8_MEMBER( cru_w );
	template<class _Object> static devcb_base &static_set_int_callback(device_t &device, _Object object)
	{
		return downcast<fd800_legacy_device &>(device).m_int_line.set_callback(object);
	}

private:
	void device_start(void);
	void device_reset(void);
	void set_interrupt_line();

	int     read_id(int unit, int head, int *cylinder_id, int *sector_id);
	int     find_sector(int unit, int head, int sector, int *data_id);
	int     do_seek(int unit, int cylinder, int head);
	int     do_restore(int unit);
	void    do_read(void);
	void    do_write(void);
	void    do_cmd(void);

	UINT16 m_recv_buf;
	UINT16 m_stat_reg;
	UINT16 m_xmit_buf;
	UINT16 m_cmd_reg;

	int m_interrupt_f_f;
	devcb_write_line m_int_line;

	enum buf_mode_t {
		bm_off, bm_read, bm_write
	};

	UINT8 m_buf[128];
	int m_buf_pos;
	buf_mode_t m_buf_mode;
	int m_unit;
	int m_head;
	int m_sector;
	/*int m_non_seq_mode;*/
	int m_ddam;

	struct
	{
		legacy_floppy_image_device *img;
		int phys_cylinder;
		int log_cylinder[2];
		int seclen;
	} m_drv[MAX_FLOPPIES];
};

LEGACY_FLOPPY_OPTIONS_EXTERN(fd800);

#define MCFG_FD800_INT_HANDLER( _intcallb ) \
	devcb = &fd800_legacy_device::static_set_int_callback( *device, DEVCB_##_intcallb );

#endif