Skip to content

Commit 3025ae6

Browse files
author
David Haywood
committed
temporary debug code for creating rearranged ROMs
1 parent 16c6684 commit 3025ae6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/mame/epoch/cassvisn.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ the linked 'design note' contains a large amount of useful information
1515
#include "bus/generic/slot.h"
1616
#include "bus/generic/carts.h"
1717
#include "cpu/upd777/upd777.h"
18+
#include "cpu/upd777/upd777dasm.h"
1819

1920
#include "softlist_dev.h"
2021

@@ -38,6 +39,8 @@ class cassvisn_state : public driver_device
3839
private:
3940
required_device<cpu_device> m_maincpu;
4041
required_device<generic_slot_device> m_cart;
42+
43+
u16 m_table[0xfe0/2];
4144
};
4245

4346
static INPUT_PORTS_START( cassvisn )
@@ -49,6 +52,41 @@ DEVICE_IMAGE_LOAD_MEMBER(cassvisn_state::cart_load)
4952
m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
5053
m_cart->common_load_rom(m_cart->get_rom_base(), size, "prg");
5154
memcpy(memregion("maincpu")->base(), m_cart->get_rom_base(), size);
55+
56+
upd777_disassembler::populate_addr_table(m_table);
57+
58+
if (size == 0xfe0)
59+
{
60+
u8 *ROM = memregion("maincpu")->base();
61+
62+
u8 m_newrom[0x1000];
63+
std::fill(std::begin(m_newrom), std::end(m_newrom), 0xff);
64+
65+
for (int realadd = 0; realadd < 0x800; realadd++)
66+
{
67+
int found = -1;
68+
for (int checkaddr = 0; checkaddr < 0xfe0/2; checkaddr++)
69+
{
70+
if (m_table[checkaddr] == realadd)
71+
found = checkaddr;
72+
}
73+
74+
if (found != -1)
75+
{
76+
m_newrom[(realadd * 2) + 1] = ROM[(found * 2) + 0];
77+
m_newrom[(realadd * 2) + 0] = ROM[(found * 2) + 1];
78+
}
79+
}
80+
81+
FILE *fp;
82+
fp=fopen("rearranged_rom.bin", "w+b");
83+
if (fp)
84+
{
85+
fwrite(m_newrom, 0x1000, 1, fp);
86+
fclose(fp);
87+
}
88+
}
89+
5290
return std::make_pair(std::error_condition(), std::string());
5391
}
5492

0 commit comments

Comments
 (0)