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
119
|
/*********************************************************************
wozfdc.h
Apple Disk II floppy disk controller
*********************************************************************/
#pragma once
#ifndef __WOZFDC_H__
#define __WOZFDC_H__
#include "emu.h"
#include "imagedev/floppy.h"
#include "formats/flopimg.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class wozfdc_device:
public device_t
{
friend class diskii_fdc;
friend class appleiii_fdc;
public:
// construction/destruction
wozfdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
// optional information overrides
virtual const rom_entry *device_rom_region() const;
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
protected:
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
floppy_connector *floppy0, *floppy1, *floppy2, *floppy3;
floppy_image_device *floppy;
private:
enum {
MODE_IDLE, MODE_ACTIVE, MODE_DELAY
};
struct lss {
attotime tm;
UINT64 cycles;
UINT8 data_reg, address;
attotime write_start_time;
attotime write_buffer[32];
int write_position;
bool write_line_active;
};
const UINT8 *m_rom_p6;
UINT8 current_cyl, last_6502_write;
bool mode_write, mode_load;
int active;
UINT8 phases;
emu_timer *timer, *delay_timer;
bool external_drive_select;
lss cur_lss, predicted_lss;
int drvsel;
int enable1;
void control(int offset);
void phase(int ph, bool on);
UINT64 time_to_cycles(attotime tm);
attotime cycles_to_time(UINT64 cycles);
void a3_update_drive_sel();
void lss_start();
void lss_delay(UINT64 cycles, attotime tm, UINT8 data_reg, UINT8 address, bool write_line_active);
void lss_delay(UINT64 cycles, UINT8 data_reg, UINT8 address, bool write_line_active);
void lss_sync();
void lss_predict(attotime limit = attotime::never);
void commit_predicted();
};
class diskii_fdc : public wozfdc_device
{
public:
diskii_fdc(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void device_reset();
void set_floppies(floppy_connector *f0, floppy_connector *f1);
};
class appleiii_fdc : public wozfdc_device
{
public:
appleiii_fdc(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void device_reset();
void set_floppies_4(floppy_connector *f0, floppy_connector *f1, floppy_connector *f2, floppy_connector *f3);
DECLARE_READ8_MEMBER(read_c0dx);
DECLARE_WRITE8_MEMBER(write_c0dx);
private:
void control_dx(int offset);
};
// device type definition
extern const device_type DISKII_FDC;
extern const device_type APPLEIII_FDC;
#endif /* __WOZFDC_H__ */
|