OSDN Git Service

[VM][General] Merge Upstream 2021-05-06. Some variants of PC-6001 are temporally...
[csp-qt/common_source_project-fm7.git] / source / src / vm / bx1 / floppy.cpp
1 /*
2         CANON BX-1 Emulator 'eBX-1'
3
4         Author : Takeda.Toshiya
5         Date   : 2021.02.14-
6
7         [ floppy ]
8 */
9
10 #include "floppy.h"
11 #include "../mc6843.h"
12
13 namespace BX1 {
14 uint32_t FLOPPY::read_io8(uint32_t addr)
15 {
16         uint32_t value = 0xff;
17         
18         switch(addr & 0xffff) {
19         case 0xe189:
20                 value  = d_fdc->is_disk_inserted(0) && d_fdc->is_disk_protected(0) ? 1 : 0;
21                 value |= d_fdc->is_disk_inserted(1) && d_fdc->is_disk_protected(1) ? 2 : 0;
22                 break;
23         default:
24                 break;
25         }
26         return value;
27 }
28
29 void FLOPPY::write_io8(uint32_t addr, uint32_t data)
30 {
31         switch(addr & 0xffff) {
32         case 0xe18a:
33                 // drive reg
34                 switch(data & 0x0f) {
35                 case 0x01:
36                         d_fdc->write_signal(SIG_MC6843_DRIVEREG, 0, 3);
37                         break;
38                 case 0x02:
39                         d_fdc->write_signal(SIG_MC6843_DRIVEREG, 1, 3);
40                         break;
41                 case 0x04:
42                         d_fdc->write_signal(SIG_MC6843_DRIVEREG, 2, 3);
43                         break;
44                 case 0x08:
45 //                      d_fdc->write_signal(SIG_MC6843_DRIVEREG, 3, 3);
46                         break;
47                 }
48                 break;
49         case 0xe18c:
50                 // ??? only clear
51                 break;
52         default:
53                 break;
54         }
55 }
56
57 }