summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/apple2e.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/apple2e.cpp')
-rw-r--r--src/mame/drivers/apple2e.cpp81
1 files changed, 33 insertions, 48 deletions
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index d66013ff744..e051656cc5a 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -370,6 +370,7 @@ private:
bool m_altzp;
bool m_ramrd, m_ramwrt;
bool m_lcram, m_lcram2, m_lcwriteenable;
+ int m_last_offset, m_last_access;
bool m_ioudis;
bool m_romswitch;
bool m_mockingboard4c;
@@ -396,12 +397,11 @@ private:
uint8_t m_exp_regs[0x10];
uint8_t *m_exp_ram;
int m_exp_wptr, m_exp_liveptr;
- int m_wrtcount;
void do_io(address_space &space, int offset, bool is_iic);
uint8_t read_floatingbus();
void update_slotrom_banks();
- void lc_update(int offset, bool write);
+ void lc_update(int offset, int access);
uint8_t read_slot_rom(address_space &space, int slotbias, int offset);
void write_slot_rom(address_space &space, int slotbias, int offset, uint8_t data);
uint8_t read_int_rom(address_space &space, int slotbias, int offset);
@@ -702,8 +702,9 @@ void apple2e_state::machine_start()
save_item(NAME(m_lcram));
save_item(NAME(m_lcram2));
save_item(NAME(m_lcwriteenable));
+ save_item(NAME(m_last_offset));
+ save_item(NAME(m_last_access));
save_item(NAME(m_mockingboard4c));
- save_item(NAME(m_wrtcount));
}
void apple2e_state::machine_reset()
@@ -757,9 +758,8 @@ void apple2e_state::machine_reset()
m_lcram = false;
m_lcram2 = true;
m_lcwriteenable = true;
- m_wrtcount = 2;
- // set bank device to read ROM, write enabled
- m_lcbank->set_bank(0);
+ m_last_offset = -1;
+ m_last_access = 0;
m_exp_bankhior = 0xf0;
@@ -1009,62 +1009,48 @@ void apple2e_state::update_slotrom_banks()
}
}
-void apple2e_state::lc_update(int offset, bool write)
+void apple2e_state::lc_update(int offset, int access)
{
- bool m_last_lcram = m_lcram;
+ int old_lcram = m_lcram;
m_lcram = false;
- m_lcram2 = false;
+ m_lcwriteenable = false;
- switch (offset)
+ switch (offset & 3)
{
- case 0x0: case 0x8: case 0x4: case 0xc:
- m_wrtcount = 0;
- m_lcwriteenable = false;
+ case 0:
+ {
m_lcram = true;
break;
-
- case 0x1: case 0x9: case 0x5: case 0xd:
- if (write)
- {
- m_wrtcount = 0;
- }
- else
- {
- m_wrtcount++;
- }
- break;
+ }
- case 0x2: case 0xa: case 0x6: case 0xe:
- m_wrtcount = 0;
- m_lcwriteenable = false;
- break;
-
- case 0x3: case 0xb: case 0x7: case 0xf:
- if (write)
+ case 3:
+ {
+ m_lcram = true;
+ } //fall through
+
+ case 1:
+ {
+ //if accessed twice, then write-enable
+ if (((m_last_offset & 1) == 1) && (access == m_last_access))
{
- m_wrtcount = 0;
+ m_lcwriteenable = true;
}
- else
- {
- m_wrtcount++;
- }
- m_lcram = true;
+
break;
+ }
}
-
- if (m_wrtcount >= 2)
- {
- m_lcwriteenable = true;
- m_wrtcount = 2;
- }
+
+ m_last_offset = offset;
+ m_last_access = access;
+ m_lcram2 = false;
if (!(offset & 8))
{
m_lcram2 = true;
}
- if (m_lcram != m_last_lcram)
+ if (m_lcram != old_lcram)
{
if (m_lcram)
{
@@ -1084,10 +1070,9 @@ void apple2e_state::lc_update(int offset, bool write)
}
#if 0
- printf("LC: new state %c%c (%d) dxxx=%04x altzp=%d\n",
+ printf("LC: new state %c%c dxxx=%04x altzp=%d\n",
m_lcram ? 'R' : 'x',
m_lcwriteenable ? 'W' : 'x',
- m_wrtcount,
m_lcram2 ? 0x1000 : 0x0000,
m_altzp);
#endif
@@ -1877,7 +1862,7 @@ READ8_MEMBER(apple2e_state::c080_r)
if (slot == 0)
{
- lc_update(offset & 0xf, false);
+ lc_update(offset & 0xf, 0);
}
else
{
@@ -1900,7 +1885,7 @@ WRITE8_MEMBER(apple2e_state::c080_w)
if (slot == 0)
{
- lc_update(offset & 0xf, true);
+ lc_update(offset & 0xf, 1);
}
else
{