{
vm = parent_vm;
emu = parent_emu;
- osd = NULL;
+ //osd = NULL;
+ osd = emu->get_osd();
+ //this->out_debug_log("OSD is %08x", osd);
strncpy(this_device_name, "Base Device", 128);
prev_device = vm->last_device;
next_device = NULL;
//~DEVICE(void);
virtual ~DEVICE() {}
- virtual void initialize() { osd = emu->get_osd(); }
+ virtual void initialize() { /* osd = emu->get_osd(); */}
virtual void release() {}
virtual void update_config() {}
if(priority_ctrl_reg & (1 << ch)) {
if(dma[ch].byte_count_reg.w.l != 0) {
if(dma[ch].channel_ctrl_reg & 0x01) {
- uint8_t data = 0xff;
- if(d_memory != NULL) data = d_memory->read_dma_data8(dma[ch].address_reg.w.l);
- if(dma[ch].device != NULL) dma[ch].device->write_dma_io8(0, data);
+ uint8_t data;
+ data = d_memory->read_dma_data8(dma[ch].address_reg.w.l);
+ dma[ch].device->write_dma_io8(0, data);
} else {
- uint8_t data = 0xff;
- if(dma[ch].device != NULL) dma[ch].device->read_dma_io8(0);
- if(d_memory != NULL) d_memory->write_dma_data8(dma[ch].address_reg.w.l, data);
+ uint8_t data;
+ data = dma[ch].device->read_dma_io8(0);
+ d_memory->write_dma_data8(dma[ch].address_reg.w.l, data);
}
if(dma[ch].channel_ctrl_reg & 0x08) {
dma[ch].address_reg.d--;
public:
MC6844(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
+ // TIP: if((DEVICE::prev_device == NULL) || (DEVICE::this_device_id == 0)) DEVICE must be DUMMY.
+ // And, at this device, should not be FIRST DEVICE. 20170613 Ohta.
+ DEVICE *__dev = this;
+ while((__dev->prev_device != NULL) && (__dev->this_device_id > 0)) {
+ __dev = __dev->prev_device;
+ }
+
// for(int i = 0; i < 4; i++) {
// dma[i].device = vm->dummy;
// }
// d_memory = vm->dummy;
for(int i = 0; i < 4; i++) {
- dma[i].device = NULL;
+ dma[i].device = __dev;
}
- d_memory = NULL;
+ d_memory = __dev;
initialize_output_signals(&outputs_irq);
set_device_name(_T("MC6844 DMAC"));
}
if((dma[c].mode & 0x0c) == 4) {
// io -> memory
uint32_t val;
- if(dma[c].dev != NULL) {
- val = dma[c].dev->read_dma_io8(0);
- } else {
- val = 0xff;
- }
+ val = dma[c].dev->read_dma_io8(0);
d_mem->write_dma_data8(dma[c].areg, val);
// update temporary register
tmp = (tmp >> 8) | (val << 8);
} else if((dma[c].mode & 0x0c) == 8) {
// memory -> io
uint32_t val = d_mem->read_dma_data8(dma[c].areg);
- if(dma[c].dev != NULL) {
- dma[c].dev->write_dma_io8(0, val);
- }
+ dma[c].dev->write_dma_io8(0, val);
// update temporary register
tmp = (tmp >> 8) | (val << 8);
}
public:
UPD71071(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
+ // TIP: if((DEVICE::prev_device == NULL) || (DEVICE::this_device_id == 0)) DEVICE must be DUMMY.
+ // And, at this device, should not be FIRST DEVICE. 20170613 Ohta.
+ DEVICE *__dev = this;
+ while((__dev->prev_device != NULL) && (__dev->this_device_id > 0)) {
+ __dev = __dev->prev_device;
+ }
for(int i = 0; i < 4; i++) {
//dma[i].dev = vm->dummy;
- dma[i].dev = NULL;
+ dma[i].dev = __dev;
}
+ d_mem = __dev;
//#ifdef SINGLE_MODE_DMA
d_dma = NULL;
//#endif