mirror of
https://github.com/holub/mame
synced 2025-06-04 11:56:28 +03:00
nec/pc9801.cpp: implement DMA r/w 1MB mask
This commit is contained in:
parent
13192c588e
commit
0e4b21121f
@ -1538,6 +1538,63 @@ void pc9801_state::dma_write_byte(offs_t offset, uint8_t data)
|
||||
program.write_byte(addr, data);
|
||||
}
|
||||
|
||||
uint8_t pc9801vm_state::dma_read_byte(offs_t offset)
|
||||
{
|
||||
address_space &program = m_maincpu->space(AS_PROGRAM);
|
||||
offs_t addr = (m_dma_offset[m_dack] << 16) | offset;
|
||||
|
||||
if (BIT(m_dma_access_ctrl, 2))
|
||||
addr &= 0xfffff;
|
||||
|
||||
if(offset == 0xffff)
|
||||
{
|
||||
switch(m_dma_autoinc[m_dack])
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
uint8_t page = m_dma_offset[m_dack];
|
||||
m_dma_offset[m_dack] = ((page + 1) & 0xf) | (page & 0xf0);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
m_dma_offset[m_dack]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// logerror("%08x %02x\n",addr, m_dma_access_ctrl);
|
||||
return program.read_byte(addr);
|
||||
}
|
||||
|
||||
|
||||
void pc9801vm_state::dma_write_byte(offs_t offset, uint8_t data)
|
||||
{
|
||||
address_space &program = m_maincpu->space(AS_PROGRAM);
|
||||
offs_t addr = (m_dma_offset[m_dack] << 16) | offset;
|
||||
|
||||
if (BIT(m_dma_access_ctrl, 2))
|
||||
addr &= 0xfffff;
|
||||
|
||||
if(offset == 0xffff)
|
||||
{
|
||||
switch(m_dma_autoinc[m_dack])
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
uint8_t page = m_dma_offset[m_dack];
|
||||
m_dma_offset[m_dack] = ((page + 1) & 0xf) | (page & 0xf0);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
m_dma_offset[m_dack]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// logerror("%08x %02x %02x\n",addr,data, m_dma_access_ctrl);
|
||||
|
||||
program.write_byte(addr, data);
|
||||
}
|
||||
|
||||
void pc9801_state::set_dma_channel(int channel, int state)
|
||||
{
|
||||
if (!state) m_dack = channel;
|
||||
|
@ -259,6 +259,9 @@ protected:
|
||||
uint8_t m_dma_autoinc[4];
|
||||
int m_dack;
|
||||
|
||||
virtual uint8_t dma_read_byte(offs_t offset);
|
||||
virtual void dma_write_byte(offs_t offset, uint8_t data);
|
||||
|
||||
private:
|
||||
void dmapg4_w(offs_t offset, uint8_t data);
|
||||
|
||||
@ -266,8 +269,7 @@ private:
|
||||
|
||||
void dma_hrq_changed(int state);
|
||||
void tc_w(int state);
|
||||
uint8_t dma_read_byte(offs_t offset);
|
||||
void dma_write_byte(offs_t offset, uint8_t data);
|
||||
|
||||
void dack0_w(int state);
|
||||
void dack1_w(int state);
|
||||
void dack2_w(int state);
|
||||
@ -423,6 +425,9 @@ protected:
|
||||
u8 m_dma_access_ctrl = 0;
|
||||
u8 m_ide_sel = 0;
|
||||
|
||||
virtual uint8_t dma_read_byte(offs_t offset) override;
|
||||
virtual void dma_write_byte(offs_t offset, uint8_t data) override;
|
||||
|
||||
// starting from PC9801VF/U buzzer is substituted with a DAC1BIT
|
||||
bool m_dac1bit_disable;
|
||||
|
||||
|
@ -21,6 +21,10 @@ public:
|
||||
{}
|
||||
|
||||
void pc_h98s(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_MACHINE_START(pc_h98);
|
||||
DECLARE_MACHINE_RESET(pc_h98);
|
||||
};
|
||||
|
||||
// TODO: backported from pc9801_epson.cpp, needs mods
|
||||
@ -123,6 +127,19 @@ static INPUT_PORTS_START( pc_h98 )
|
||||
PORT_CONFSETTING( 0x04, DEF_STR( No ) )
|
||||
INPUT_PORTS_END
|
||||
|
||||
MACHINE_START_MEMBER(pc_hyper98_state,pc_h98)
|
||||
{
|
||||
MACHINE_START_CALL_MEMBER(pc9801bx2);
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(pc_hyper98_state,pc_h98)
|
||||
{
|
||||
MACHINE_RESET_CALL_MEMBER(pc9801bx2);
|
||||
|
||||
// boots with DMA > 1MB on.
|
||||
m_dma_access_ctrl = 0xfb;
|
||||
}
|
||||
|
||||
void pc_hyper98_state::pc_h98s(machine_config &config)
|
||||
{
|
||||
pc9801bx2(config);
|
||||
@ -132,8 +149,8 @@ void pc_hyper98_state::pc_h98s(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_IO, &pc_hyper98_state::pc9801bx2_io);
|
||||
m_maincpu->set_irq_acknowledge_callback("pic8259_master", FUNC(pic8259_device::inta_cb));
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(pc_hyper98_state, pc9801bx2)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(pc_hyper98_state, pc9801bx2)
|
||||
MCFG_MACHINE_START_OVERRIDE(pc_hyper98_state, pc_h98)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(pc_hyper98_state, pc_h98)
|
||||
|
||||
m_ram->set_default_size("14M");
|
||||
// TODO: extra options, 1.6MB up to 45.6MB
|
||||
|
Loading…
Reference in New Issue
Block a user