summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6502/xavix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/m6502/xavix.cpp')
-rw-r--r--src/devices/cpu/m6502/xavix.cpp175
1 files changed, 57 insertions, 118 deletions
diff --git a/src/devices/cpu/m6502/xavix.cpp b/src/devices/cpu/m6502/xavix.cpp
index 901e1c0c975..1cb4323586e 100644
--- a/src/devices/cpu/m6502/xavix.cpp
+++ b/src/devices/cpu/m6502/xavix.cpp
@@ -18,9 +18,12 @@
0x0000-0x7fff seems to be a 'low bus' area, it is always the same regardless
of banking
0x8000-0xffff is a banked area with individual code and data banks
- 0x00ff contains the DATA bank, set manually in code
- 0x00fe appears to be the current CODE bank, set with either the
- custom opcodes, or manually (if running from lowbus only?)
+
+ Zero Page notes:
+
+ 0x00ff contains the DATA bank, set manually in code
+ 0x00fe appears to be the current CODE bank, set with either the
+ custom opcodes, or manually (if running from lowbus only?)
***************************************************************************/
@@ -111,22 +114,7 @@ void xavix_device::device_reset()
m6502_device::device_reset();
}
-// used by the xalda_idy ( lda ($**), y )opcodes where databank value is used for high address bits
-inline uint8_t xavix_device::read_special(uint16_t adr)
-{
- return read_full_data_sp(m_databank, adr);
-}
-
-// used by DMA and video operations (and custom new opcodes) where full address is specified
-uint8_t xavix_device::read_full_data_sp(uint32_t adr)
-{
- return read_full_data_sp((adr&0xff0000)>>16, adr&0xffff);
-}
-void xavix_device::write_full_data_sp(uint32_t adr, uint8_t val)
-{
- write_full_data_sp((adr&0xff0000)>>16, adr&0xffff, val);
-}
xavix_device::mi_xavix_normal::mi_xavix_normal(xavix_device *_base)
{
@@ -155,7 +143,7 @@ uint8_t xavix_device::read_special_stack()
-inline uint8_t xavix_device::read_full_data(uint32_t addr)
+uint8_t xavix_device::read_full_data(uint32_t addr)
{
return read_full_data((addr & 0xff0000)>>16, addr & 0xffff);
}
@@ -172,58 +160,8 @@ inline uint8_t xavix_device::read_full_data(uint8_t databank, uint16_t adr)
}
else if (adr == 0xff)
{
- return databank;
- }
-
- return m_lowbus_space->read_byte(adr);
- }
- else
- {
- return m_extbus_space->read_byte((databank << 16) | adr);
- }
- }
- else
- {
- if (adr < 0x8000)
- {
- if (adr == 0xfe)
- {
- //logerror("%02x%04x returning codebank\n", m_codebank, PC);
- return m_codebank;
- }
- else if (adr == 0xff)
- {
- //logerror("%02x%04x returning databank\n", m_codebank, PC);
- return databank;
- }
-
- if ((adr & 0x7fff) >= 0x200)
- {
- return m_extbus_space->read_byte((databank << 16) | adr);
- }
- else
- {
- //logerror("%02x%04x returning lowbus %04x\n", m_codebank, PC, adr); // useful for debugging opcodes which must ignore lowbus (all indirect ones?)
- return m_lowbus_space->read_byte(adr);
- }
- }
- else
- {
- return m_extbus_space->read_byte((databank << 16) | adr);
- }
- }
-}
-
-inline uint8_t xavix_device::read_full_data_sp(uint8_t databank, uint16_t adr)
-{
- if (databank < 0x80)
- {
- if (adr < 0x8000)
- {
- if (adr == 0xfe)
- return m_codebank;
- else if (adr == 0xff)
return m_databank;
+ }
return m_lowbus_space->read_byte(adr);
}
@@ -238,7 +176,6 @@ inline uint8_t xavix_device::read_full_data_sp(uint8_t databank, uint16_t adr)
}
}
-
// data reads
inline uint8_t xavix_device::mi_xavix_normal::read(uint16_t adr)
{
@@ -264,32 +201,59 @@ void xavix_device::write_full_data(uint32_t addr, uint8_t val)
write_full_data((addr & 0xff0000)>>16, addr & 0xffff, val);
}
-// data writes
-inline void xavix_device::write_full_data(uint8_t databank, uint16_t adr, uint8_t val)
+uint8_t xavix_device::read_stack(uint32_t addr)
{
- if (databank < 0x80)
+ // address is always 0x100-0x1ff
+ return m_lowbus_space->read_byte((addr & 0xff)+0x100);
+}
+
+void xavix_device::write_stack(uint32_t addr, uint8_t val)
+{
+ // address is always 0x100-0x1ff
+ m_lowbus_space->write_byte((addr & 0xff)+0x100, val);
+}
+
+uint8_t xavix_device::read_zeropage(uint32_t addr)
+{
+ // address is always 0x00-0xff
+ addr &= 0xff;
+
+ if (addr == 0xfe)
{
- if (adr < 0x8000)
- {
- if (adr == 0xfe)
- {
- m_codebank = val;
- return;
- }
- else if (adr == 0xff)
- {
- m_databank = val;
- return;
- }
+ return m_codebank;
+ }
+ else if (addr == 0xff)
+ {
+ return m_databank;
+ }
- m_lowbus_space->write_byte(adr, val);
- }
- else
- {
- m_extbus_space->write_byte((databank << 16) | adr, val);
- }
+ return m_lowbus_space->read_byte(addr);
+}
+
+void xavix_device::write_zeropage(uint32_t addr, uint8_t val)
+{
+ // address is always 0x00-0xff
+ addr &= 0xff;
+
+ if (addr == 0xfe)
+ {
+ m_codebank = val;
+ return;
}
- else
+ else if (addr == 0xff)
+ {
+ m_databank = val;
+ return;
+ }
+
+ m_lowbus_space->write_byte(addr, val);
+}
+
+
+// data writes
+inline void xavix_device::write_full_data(uint8_t databank, uint16_t adr, uint8_t val)
+{
+ if (databank < 0x80)
{
if (adr < 0x8000)
{
@@ -304,31 +268,6 @@ inline void xavix_device::write_full_data(uint8_t databank, uint16_t adr, uint8_
return;
}
- // actually it is more likely that all zero page and stack operations should go through their own handlers, and never reach here
- // there is code that explicitly uses pull/push opcodes when in the high banks indicating that the stack area likely isn't
- // mapped normally
- if ((adr & 0x7fff) >= 0x200)
- {
- m_extbus_space->write_byte((databank << 16) | adr, val);
- }
- else
- {
- m_lowbus_space->write_byte(adr, val);
- }
- }
- else
- {
- m_extbus_space->write_byte((databank << 16) | adr, val);
- }
- }
-}
-
-inline void xavix_device::write_full_data_sp(uint8_t databank, uint16_t adr, uint8_t val)
-{
- if (databank < 0x80)
- {
- if (adr < 0x8000)
- {
m_lowbus_space->write_byte(adr, val);
}
else