@@ -15,6 +15,7 @@ the linked 'design note' contains a large amount of useful information
15
15
#include " bus/generic/slot.h"
16
16
#include " bus/generic/carts.h"
17
17
#include " cpu/upd777/upd777.h"
18
+ #include " cpu/upd777/upd777dasm.h"
18
19
19
20
#include " softlist_dev.h"
20
21
@@ -38,6 +39,8 @@ class cassvisn_state : public driver_device
38
39
private:
39
40
required_device<cpu_device> m_maincpu;
40
41
required_device<generic_slot_device> m_cart;
42
+
43
+ u16 m_table[0xfe0 /2 ];
41
44
};
42
45
43
46
static INPUT_PORTS_START ( cassvisn )
@@ -49,6 +52,41 @@ DEVICE_IMAGE_LOAD_MEMBER(cassvisn_state::cart_load)
49
52
m_cart->rom_alloc (size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);
50
53
m_cart->common_load_rom (m_cart->get_rom_base (), size, " prg" );
51
54
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
+
52
90
return std::make_pair (std::error_condition (), std::string ());
53
91
}
54
92
0 commit comments