2 // PC-6001/6601 disk I/O
3 // This file is based on a disk I/O program in C++
4 // by Mr. Yumitaro and translated into C for Cocoa iP6
5 // by Koichi NISHIDA 2006
9 NEC PC-6601 Emulator 'yaPC-6601'
10 NEC PC-6601SR Emulator 'yaPC-6801'
15 [ internal floppy drive ]
22 #include "../../emu.h"
23 #include "../device.h"
25 #if defined(_USE_QT) || defined(_USE_AGAR)
31 class FLOPPY : public DEVICE
44 int Seek88(int drvno, int trackno, int sectno);
45 unsigned char Getc88(int drvno);
46 int Putc88(int drvno, unsigned char dat);
48 // data buffer (256BytesX4)
49 unsigned char Data[4][256];
53 unsigned char Data[10];
57 CmdBuffer CmdIn; // command buffer
58 CmdBuffer CmdOut; // status buffer
59 unsigned char SeekST0; // ST0 when SEEK
60 unsigned char LastCylinder; // last read cylinder
61 int SeekEnd; // complete seek flag
62 unsigned char SendSectors; // amount(100H unit)
63 int DIO; // data direction TRUE: Buffer->CPU FALSE: CPU->Buffer
64 unsigned char Status; // FDC status register
66 void Push(int part, unsigned char data);
67 unsigned char Pop(int part);
71 void PushStatus(int data);
72 unsigned char PopStatus();
73 void OutFDC(unsigned char data);
74 unsigned char InFDC();
78 void SenseInterruptStatus(void);
81 void OutB1H_66(unsigned char data);
82 void OutB2H_66(unsigned char data);
83 void OutB3H_66(unsigned char data);
84 void OutD0H_66(unsigned char data);
85 void OutD1H_66(unsigned char data);
86 void OutD2H_66(unsigned char data);
87 void OutD3H_66(unsigned char data);
88 void OutD6H_66(unsigned char data);
89 void OutD8H_66(unsigned char data);
90 void OutDAH_66(unsigned char data);
91 void OutDDH_66(unsigned char data);
92 void OutDEH_66(unsigned char data);
94 unsigned char InB2H_66();
95 unsigned char InD0H_66();
96 unsigned char InD1H_66();
97 unsigned char InD2H_66();
98 unsigned char InD3H_66();
99 unsigned char InD4H_66();
100 unsigned char InDCH_66();
101 unsigned char InDDH_66();
104 FLOPPY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
111 void write_io8(uint32 addr, uint32 data);
112 uint32 read_io8(uint32 addr);
113 uint32 read_signal(int ch);
114 void save_state(FILEIO* state_fio);
115 bool load_state(FILEIO* state_fio);
118 void set_context_ext(DEVICE* device)
122 DISK* get_disk_handler(int drv)
126 void open_disk(int drv, _TCHAR* file_path, int bank);
127 void close_disk(int drv);
128 bool disk_inserted(int drv);
129 #if defined(USE_DISK_WRITE_PROTECT)
130 bool is_write_protect_fd(int drv) {
131 if(drv < 2) return disk[drv]->write_protected;
134 void write_protect_fd(int drv, bool flag) {
135 if(drv < 2) disk[drv]->write_protected = flag;