Home Page
Posted By: Golden Child Address map question - 03/13/22 02:40 AM
I found some mx80 roms and was trying to hook them up just to see how they work.

It's actually pretty simple, the 3b rom is 0-0x7ff, and the 1b and 2b roms go in 0x800-0x8ff and are selected with P24.

[Linked Image from i.imgur.com]

I initially had a problem in the the i8049 had a rom size set to 2048, and I needed it to be 4096 (I think the 8049AH has 12 bit addressing and SEL MB0 and SEL MB1 to set the high bit A11).

The 8049 has an internal rom size of 2048 but it can use EA external access to access 4k.

Code
       // External access line, EA=1: read from external rom, EA=0: read from internal rom
        // FIXME: Current implementation suboptimal
        m_ea = (m_int_rom_size ? 0 : 1);



The problem is that if I try to set my own program memory map with set_addrmap it seems to be ignored. I put some printfs in my handler routine and it only seems to show reads going to the io.


My plan was to handle the rom banking myself with a routine to handle the reads.

Any suggestions on the "proper" way to do it?

Code

//-------------------------------------------------
//  ROM( epson_mx80 )
//-------------------------------------------------

ROM_START( epson_mx80 )
	ROM_REGION(0x800, "mx80_rom_1", 0)
	ROM_LOAD("mx80_graftrax_rom_1.bin", 0x0000, 0x800, CRC(0843ea56) SHA1(23948acb55760ddbfc59c57c1553b2e733983201))

	ROM_REGION(0x800, "mx80_rom_2", 0)
	ROM_LOAD("mx80_graftrax_rom_2.bin", 0x0000, 0x800, CRC(8435f945) SHA1(c1f0a74bf66d114d0f349bec27c7756997352602))

	ROM_REGION(0x800, "mx80_rom_3", 0) 
	ROM_LOAD("mx80_graftrax_rom_3.bin", 0x0000, 0x800, CRC(f1d1c0e7) SHA1(1f4e24575c412368f0b628d2a276c9943debd0ae))


//	ROM_REGION(0x800, "maincpu", 0)
	ROM_REGION(0x1000, "maincpu", 0)  // changed i8049 to 4096
	ROM_LOAD("mx80_graftrax_rom_3.bin", 0x0000, 0x800, CRC(f1d1c0e7) SHA1(1f4e24575c412368f0b628d2a276c9943debd0ae))

ROM_END




void epson_mx80_device::mx80_prog_mem(address_map &map)
{
	map(0x000, 0xfff).r(FUNC(epson_mx80_device::prog_mem_r));  // 12 bits
}

void epson_mx80_device::mx80_data_mem(address_map &map)
{
	map(0x00, 0x7f).r(FUNC(epson_mx80_device::data_r));
}

void epson_mx80_device::mx80_io_mem(address_map &map)
{
	map(0x00, 0x7f).r(FUNC(epson_mx80_device::io_r));
}


void epson_mx80_device::device_add_mconfig(machine_config &config)
{
	// 8049 main cpu
	i8049_device &main(I8049(config, m_maincpu, 6000000)); // 6 Mhz

	main.set_addrmap(AS_PROGRAM, &epson_mx80_device::mx80_prog_mem);  // seems to ignore this
	main.set_addrmap(AS_DATA, &epson_mx80_device::mx80_data_mem);  // and ignore this
	main.set_addrmap(AS_IO, &epson_mx80_device::mx80_io_mem);  // but the IO memory map works


and in devices/cpu/mcs48/mcs48.cpp it sets up the address_map for the program and data

Code
i8049_device::i8049_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
        : mcs48_cpu_device(mconfig, I8049, tag, owner, clock, 4096, 128, I8048_FEATURE, s_mcs48_opcodes)  // changed this to 4096 from 2048
{
}




mcs48_cpu_device::mcs48_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rom_size, int ram_size, uint8_t feature_mask, const mcs48_cpu_dev
ice::mcs48_ophandler *opcode_table)
        : cpu_device(mconfig, type, tag, owner, clock)
        , m_program_config("program", ENDIANNESS_LITTLE, 8, (feature_mask & MB_FEATURE) != 0 ? 12 : 11, 0
                                           , (rom_size == 1024) ? address_map_constructor(FUNC(mcs48_cpu_device::program_10bit), this) : (rom_size == 2048) ? address_map_constructor(FUNC(mcs48_cpu_device::program_11bit), this) : (rom_size == 4096) ? address_map_constructor(FUNC(mcs48_cpu_device::program_12bit), this) : address_map_constructor())
        , m_data_config("data", ENDIANNESS_LITTLE, 8, ( ( ram_size == 64 ) ? 6 : ( ( ram_size == 128 ) ? 7 : 8 ) ), 0
                                        , (ram_size == 64) ? address_map_constructor(FUNC(mcs48_cpu_device::data_6bit), this) : (ram_size == 128) ? address_map_constructor(FUNC(mcs48_cpu_device::data_7bit), this) : address_map_constructor(FUNC(mcs48_cpu_device::data_8bit), this))
        , m_io_config("io", ENDIANNESS_LITTLE, 8, 8, 0)



Hmmmm, the 8039 doesn't have any internal rom so I guess it could be an i8039.

edit: switching it to an i8039 makes my program map work.
© Forums