void UPD71071::initialize()
{
DEVICE::initialize();
+ _SINGLE_MODE_DMA = osd->check_feature(_T("SINGLE_MODE_DMA"));
+
for(int i = 0; i < 4; i++) {
dma[i].areg = dma[i].bareg = 0;
dma[i].creg = dma[i].bcreg = 0;
dma[selch].mode = data;
break;
case 0x0e:
- if((sreq = data) != 0) {
-#ifndef SINGLE_MODE_DMA
+ if(((sreq = data) != 0) && !(_SINGLE_MODE_DMA)) {
+//#ifndef SINGLE_MODE_DMA
do_dma();
-#endif
+//#endif
}
break;
case 0x0f:
if(data & mask) {
if(!(req & bit)) {
req |= bit;
-#ifndef SINGLE_MODE_DMA
- do_dma();
-#endif
+//#ifndef SINGLE_MODE_DMA
+ if(!_SINGLE_MODE_DMA) do_dma();
+//#endif
}
} else {
req &= ~bit;
/*
if((dma[c].mode & 0x01) == 1) {
// 16bit transfer mode
- if((dma[c].mode & 0x0c) == 4) {
- // io -> memory
+ if((dma[c].mode & 0x0c) == 0x00) {
+ // verify
uint32_t val = dma[c].dev->read_dma_io16(0);
+ // update temporary register
+ tmp = val;
+ } else if((dma[c].mode & 0x0c) == 0x04) {
+ // io -> memory
+ uint32_t val;
+ if(dma[c].dev != NULL) {
+ val = dma[c].dev->read_dma_io16(0);
+ } else {
+ val = 0xffff;
+ }
d_mem->write_dma_data16(dma[c].areg, val);
// update temporary register
tmp = val;
- } else if((dma[c].mode & 0x0c) == 8) {
+ } else if((dma[c].mode & 0x0c) == 0x08) {
// memory -> io
uint32_t val = d_mem->read_dma_data16(dma[c].areg);
- dma[c].dev->write_dma_io16(0, val);
+ if(dma[c].dev != NULL) dma[c].dev->write_dma_io16(0, val);
// update temporary register
tmp = val;
}
*/
{
// 8bit transfer mode
- if((dma[c].mode & 0x0c) == 4) {
- // io -> memory
+ if((dma[c].mode & 0x0c) == 0x00) {
+ // verify
uint32_t val = dma[c].dev->read_dma_io8(0);
+ // update temporary register
+ tmp = (tmp >> 8) | (val << 8);
+ } else if((dma[c].mode & 0x0c) == 0x04) {
+ // io -> memory
+ uint32_t val;
+ 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) {
+ } else if((dma[c].mode & 0x0c) == 0x08) {
// memory -> io
uint32_t val = d_mem->read_dma_data8(dma[c].areg);
dma[c].dev->write_dma_io8(0, val);
tc |= bit;
write_signals(&outputs_tc, 0xffffffff);
-#ifdef SINGLE_MODE_DMA
- } else if((dma[c].mode & 0xc0) == 0x40) {
- // single mode
- break;
-#endif
+//#ifdef SINGLE_MODE_DMA
+ } else if(_SINGLE_MODE_DMA) {
+ if((dma[c].mode & 0xc0) == 0x40) {
+ // single mode
+ break;
+ }
+//#endif
}
}
}
}
-#ifdef SINGLE_MODE_DMA
- if(d_dma) {
- d_dma->do_dma();
+//#ifdef SINGLE_MODE_DMA
+ if(_SINGLE_MODE_DMA) {
+ if(d_dma) {
+ d_dma->do_dma();
+ }
}
-#endif
+//#endif
}
#define STATE_VERSION 1
-void UPD71071::save_state(FILEIO* state_fio)
-{
- state_fio->FputUint32(STATE_VERSION);
- state_fio->FputInt32(this_device_id);
-
- for(int i = 0; i < 4; i++) {
- state_fio->FputUint32(dma[i].areg);
- state_fio->FputUint32(dma[i].bareg);
- state_fio->FputUint16(dma[i].creg);
- state_fio->FputUint16(dma[i].bcreg);
- state_fio->FputUint8(dma[i].mode);
- }
- state_fio->FputUint8(b16);
- state_fio->FputUint8(selch);
- state_fio->FputUint8(base);
- state_fio->FputUint16(cmd);
- state_fio->FputUint16(tmp);
- state_fio->FputUint8(req);
- state_fio->FputUint8(sreq);
- state_fio->FputUint8(mask);
- state_fio->FputUint8(tc);
-}
-
-bool UPD71071::load_state(FILEIO* state_fio)
+bool UPD71071::process_state(FILEIO* state_fio, bool loading)
{
- if(state_fio->FgetUint32() != STATE_VERSION) {
- return false;
- }
- if(state_fio->FgetInt32() != this_device_id) {
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+ return false;
+ }
+ if(!state_fio->StateCheckInt32(this_device_id)) {
return false;
}
for(int i = 0; i < 4; i++) {
- dma[i].areg = state_fio->FgetUint32();
- dma[i].bareg = state_fio->FgetUint32();
- dma[i].creg = state_fio->FgetUint16();
- dma[i].bcreg = state_fio->FgetUint16();
- dma[i].mode = state_fio->FgetUint8();
+ state_fio->StateUint32(dma[i].areg);
+ state_fio->StateUint32(dma[i].bareg);
+ state_fio->StateUint16(dma[i].creg);
+ state_fio->StateUint16(dma[i].bcreg);
+ state_fio->StateUint8(dma[i].mode);
}
- b16 = state_fio->FgetUint8();
- selch = state_fio->FgetUint8();
- base = state_fio->FgetUint8();
- cmd = state_fio->FgetUint16();
- tmp = state_fio->FgetUint16();
- req = state_fio->FgetUint8();
- sreq = state_fio->FgetUint8();
- mask = state_fio->FgetUint8();
- tc = state_fio->FgetUint8();
+ state_fio->StateUint8(b16);
+ state_fio->StateUint8(selch);
+ state_fio->StateUint8(base);
+ state_fio->StateUint16(cmd);
+ state_fio->StateUint16(tmp);
+ state_fio->StateUint8(req);
+ state_fio->StateUint8(sreq);
+ state_fio->StateUint8(mask);
+ state_fio->StateUint8(tc);
return true;
}