• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revisão5708de74be76da59630b2be33d2be7fcf3188dce (tree)
Hora2020-03-25 17:15:58
AutorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Mensagem de Log

[VM][FMTOWNS][SCSI] Add I/O:READ:0034h. This indicates enable to use 16bit width DMA transfer.

Mudança Sumário

Diff

--- a/source/src/vm/fmtowns/fmtowns.cpp
+++ b/source/src/vm/fmtowns/fmtowns.cpp
@@ -341,6 +341,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
341341 memory->set_context_cpu(cpu);
342342 memory->set_context_dmac(dma);
343343 memory->set_context_vram(vram);
344+ memory->set_context_crtc(crtc);
344345 memory->set_context_system_rom(sysrom);
345346 memory->set_context_msdos(msdosrom);
346347 memory->set_context_dictionary(dictionary);
@@ -348,8 +349,6 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
348349 memory->set_context_beep(beep);
349350 memory->set_context_serial_rom(serialrom);
350351 memory->set_context_sprite(sprite);
351- memory->set_machine_id(machine_id);
352- memory->set_cpu_id(cpu_id);
353352
354353 cdrom->scsi_id = 0;
355354 cdrom->set_context_interface(cdc_scsi);
@@ -441,9 +440,11 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
441440
442441 io->set_iomap_range_rw (0x0020, 0x0025, memory);
443442 io->set_iomap_range_rw (0x0026, 0x0027, timer); // Freerun counter
443+ io->set_iomap_single_rw(0x0028, memory);
444444
445445 io->set_iomap_range_r (0x0030, 0x0031, memory); // cpu id / machine id
446446 io->set_iomap_single_rw(0x0032, memory); // serial rom (routed from memory)
447+ io->set_iomap_single_r (0x0034, scsi); // ENABLE/ UNABLE to WORD DMA for SCSI
447448
448449 io->set_iomap_alias_rw(0x0040, pit0, 0);
449450 io->set_iomap_alias_rw(0x0042, pit0, 1);
@@ -543,7 +544,9 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
543544
544545
545546 io->set_iomap_range_rw(0x3000, 0x3fff, dictionary); // CMOS
546- io->set_iomap_range_rw(0xfd90, 0xfda0, crtc); // Palette and CRTC
547+
548+ io->set_iomap_range_rw(0xfd90, 0xfda2, crtc); // Palette and CRTC
549+ io->set_iomap_single_rw(0xfda4, memory); // memory
547550 io->set_iomap_range_rw(0xff80, 0xffff, vram); // MMIO
548551
549552 // Vram allocation may be before initialize().
@@ -624,10 +627,18 @@ void VM::set_machine_type(uint16_t machine_id, uint16_t cpu_id)
624627 memory->set_cpu_id(cpu_id);
625628 memory->set_machine_id(machine_id);
626629 }
630+ if(crtc != NULL) {
631+ crtc->set_cpu_id(cpu_id);
632+ crtc->set_machine_id(machine_id);
633+ }
627634 if(timer != NULL) {
628635 timer->set_cpu_id(cpu_id);
629636 timer->set_machine_id(machine_id);
630637 }
638+ if(scsi != NULL) {
639+ scsi->set_cpu_id(cpu_id);
640+ scsi->set_machine_id(machine_id);
641+ }
631642 #if defined(HAS_20PIX_FONTS)
632643 if(fontrom_20pix != NULL) {
633644 fontrom_20pix->set_cpu_id(cpu_id);
--- a/source/src/vm/fmtowns/scsi.cpp
+++ b/source/src/vm/fmtowns/scsi.cpp
@@ -37,6 +37,8 @@ void SCSI::reset()
3737 ctrl_reg = CTRL_IMSK;
3838 irq_status = false;
3939 irq_status_bak = false;
40+ exirq_status = false;
41+ ex_int_enable = false;
4042 }
4143
4244 void SCSI::write_io8(uint32_t addr, uint32_t data)
@@ -61,6 +63,10 @@ void SCSI::write_io8(uint32_t addr, uint32_t data)
6163 this->out_debug_log(_T("[SCSI] out %04X %02X\n"), addr, data);
6264 #endif
6365 ctrl_reg = data;
66+ if((machine_id >= 0x0300) & ((machine_id & 0xff00) != 0x0400)) { // After UX
67+ ex_int_enable = ((data & 0x20) != 0) ? true : false;
68+ // Set host to 16bit bus width. BIT3 ,= '1'.
69+ }
6470 if(ctrl_reg & CTRL_WEN) {
6571 d_host->write_signal(SIG_SCSI_RST, data, CTRL_RST);
6672 d_host->write_signal(SIG_SCSI_ATN, data, CTRL_ATN);
@@ -76,6 +82,13 @@ uint32_t SCSI::read_io8(uint32_t addr)
7682 uint32_t value = 0;
7783
7884 switch(addr & 0xffff) {
85+ case 0x0034:
86+ if(machine_id >= 0x0600) { // After UG
87+ value = 0x7f; // Ready to transfer 16bit width DMA, excepts CX/UX.
88+ } else {
89+ value = 0xff;
90+ }
91+ break;
7992 case 0x0c30:
8093 // data register
8194 // d_host->write_signal(SIG_SCSI_REQ, 0, 0);
@@ -96,6 +109,11 @@ uint32_t SCSI::read_io8(uint32_t addr)
96109 (d_host->read_signal(SIG_SCSI_CD ) ? STATUS_CD : 0) |
97110 (d_host->read_signal(SIG_SCSI_BSY) ? STATUS_BSY : 0) |
98111 (irq_status ? STATUS_INT : 0);
112+ if((machine_id >= 0x0300) & ((machine_id & 0xff00) != 0x0400)) { // After UX
113+ value = value | 0x00;
114+ } else {
115+ value = value | 0x04; // Disable EX-Int.
116+ }
99117 #ifdef _SCSI_DEBUG_LOG
100118 this->out_debug_log(_T("[SCSI] in %04X %02X\n"), addr, value);
101119 #endif
@@ -123,19 +141,37 @@ void SCSI::write_signal(int id, uint32_t data, uint32_t mask)
123141 // }
124142 irq_status_bak = ((data & mask) != 0);
125143 }
126- irq_status = ((data & mask) != 0);
144+ if((machine_id >= 0x0300) & ((machine_id & 0xff00) != 0x0400)) { // After UX
145+ if(!(exirq_status)) {
146+ irq_status = ((data & mask) != 0);
147+ } else {
148+ irq_status = true;
149+ }
150+ } else {
151+ irq_status = ((data & mask) != 0);
152+ }
127153 break;
128154
129155 case SIG_SCSI_DRQ:
130156 if(ctrl_reg & CTRL_DMAE) {
131157 d_dma->write_signal(SIG_UPD71071_CH1, data, mask);
132158 }
159+ if((machine_id >= 0x0300) & ((machine_id & 0xff00) != 0x0400)) { // After UX
160+ if(ex_int_enable) {
161+ d_pic->write_signal(SIG_I8259_CHIP1 | SIG_I8259_IR0, data, mask);
162+ exirq_status = ((data & mask) != 0);
163+ if(exirq_status) {
164+ irq_status = true;
165+ } else if(!(irq_status_bak)) {
166+ irq_status = false;
167+ }
168+ }
169+ }
133170 break;
134171 }
135172 }
136173
137-#define STATE_VERSION 2
138-
174+#define STATE_VERSION 3
139175
140176 bool SCSI::process_state(FILEIO* state_fio, bool loading)
141177 {
@@ -145,9 +181,17 @@ bool SCSI::process_state(FILEIO* state_fio, bool loading)
145181 if(!state_fio->StateCheckInt32(this_device_id)) {
146182 return false;
147183 }
184+ state_fio->StateValue(machine_id);
185+ state_fio->StateValue(cpu_id);
186+
148187 state_fio->StateValue(ctrl_reg);
149188 state_fio->StateValue(irq_status);
150189 state_fio->StateValue(irq_status_bak);
190+
191+ if((machine_id >= 0x0300) & ((machine_id & 0xff00) != 0x0400)) { // After UX
192+ state_fio->StateValue(ex_int_enable);
193+ state_fio->StateValue(exirq_status);
194+ }
151195 return true;
152196 }
153197 }
--- a/source/src/vm/fmtowns/scsi.h
+++ b/source/src/vm/fmtowns/scsi.h
@@ -28,6 +28,10 @@ private:
2828 uint8_t ctrl_reg;
2929 bool irq_status;
3030 bool irq_status_bak;
31+ bool exirq_status;
32+ bool ex_int_enable;
33+ uint16_t machine_id;
34+ uint8_t cpu_id;
3135
3236 public:
3337 SCSI(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {
@@ -54,6 +58,14 @@ public:
5458 {
5559 d_host = device;
5660 }
61+ void set_machine_id(uint16_t val)
62+ {
63+ machine_id = val & 0xfff8;
64+ }
65+ void set_cpu_id(uint16_t val)
66+ {
67+ cpu_id = val & 0x07;
68+ }
5769 bool process_state(FILEIO* state_fio, bool loading);
5870 };
5971 }
Show on old repository browser