forked from mikechambers84/XTulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid2102.h
118 lines (95 loc) · 3.7 KB
/
grid2102.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// license:BSD-3-Clause
// copyright-holders:usernameak
/**********************************************************************
GRiD 2102 Portable Floppy emulation
**********************************************************************/
#ifndef MAME_BUS_IEEE488_GRID2102_H
#define MAME_BUS_IEEE488_GRID2102_H
#pragma once
#include "ieee488.h"
#include <queue>
#include <vector>
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> grid210x_device
class grid210x_device : public device_t,
public device_ieee488_interface,
public device_image_interface
{
public:
// construction/destruction
grid210x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int bus_addr, uint8_t *identify_response, attotime read_delay = attotime::from_msec(5));
protected:
// device-level overrides
virtual void device_start() override;
// device_ieee488_interface overrides
virtual void ieee488_eoi(int state) override;
virtual void ieee488_dav(int state) override;
virtual void ieee488_nrfd(int state) override;
virtual void ieee488_ndac(int state) override;
virtual void ieee488_ifc(int state) override;
virtual void ieee488_srq(int state) override;
virtual void ieee488_atn(int state) override;
virtual void ieee488_ren(int state) override;
// image-level overrides
virtual bool is_readable() const noexcept override { return true; }
virtual bool is_writeable() const noexcept override { return true; }
virtual bool is_creatable() const noexcept override { return false; }
virtual bool is_reset_on_load() const noexcept override { return false; }
virtual const char *file_extensions() const noexcept override { return "img"; }
virtual const char *image_type_name() const noexcept override { return "floppydisk"; }
virtual const char *image_brief_type_name() const noexcept override { return "flop"; }
void accept_transfer();
void update_ndac(int atn);
private:
TIMER_CALLBACK_MEMBER(delay_tick);
int m_gpib_loop_state;
int m_floppy_loop_state;
uint8_t m_last_recv_byte;
int m_last_recv_eoi;
int m_last_recv_atn;
uint8_t m_byte_to_send;
int m_send_eoi;
bool listening, talking, serial_polling;
bool has_srq;
uint8_t serial_poll_byte;
uint32_t floppy_sector_number;
int bus_addr;
uint8_t *identify_response_ptr;
std::vector<uint8_t> m_data_buffer;
std::queue<uint8_t> m_output_data_buffer;
uint16_t io_size;
emu_timer *m_delay_timer;
protected:
attotime read_delay;
};
class grid2102_device : public grid210x_device {
public:
// construction/destruction
grid2102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
static uint8_t identify_response[];
};
class grid2101_floppy_device : public grid210x_device {
public:
// construction/destruction
grid2101_floppy_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
static uint8_t identify_response[];
};
class grid2101_hdd_device : public grid210x_device {
public:
// construction/destruction
grid2101_hdd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// image-level overrides
virtual const char *image_type_name() const noexcept override { return "harddisk"; }
virtual const char *image_brief_type_name() const noexcept override { return "hard"; }
private:
static uint8_t identify_response[];
};
// device type definition
DECLARE_DEVICE_TYPE(GRID2102, grid2102_device)
DECLARE_DEVICE_TYPE(GRID2101_FLOPPY, grid2101_floppy_device)
DECLARE_DEVICE_TYPE(GRID2101_HDD, grid2101_hdd_device)
#endif // MAME_BUS_IEEE488_GRID2102_H