MAME Emulation

A place to discuss everything Dragon related that doesn't fall into the other categories.
User avatar
robcfg
Posts: 1282
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden

Re: MAME Emulation

Post by robcfg » Thu Oct 31, 2019 8:55 pm

Here's MAME vdk loading code:

Code: Select all

bool vdk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
	uint8_t header[0x100];
	io_generic_read(io, header, 0, 0x100);

	int header_size = header[3] * 0x100 + header[2];
	int track_count = header[8];
	int head_count = header[9];

	int file_offset = header_size;

	for (int track = 0; track < track_count; track++)
	{
		for (int head = 0; head < head_count ; head++)
		{
			desc_pc_sector sectors[SECTOR_COUNT];
			uint8_t sector_data[SECTOR_COUNT * SECTOR_SIZE];
			int sector_offset = 0;

			for (int i = 0; i < SECTOR_COUNT; i++)
			{
				sectors[i].track = track;
				sectors[i].head = head;
				sectors[i].sector = FIRST_SECTOR_ID + i;
				sectors[i].actual_size = SECTOR_SIZE;
				sectors[i].size = SECTOR_SIZE >> 8;
				sectors[i].deleted = false;
				sectors[i].bad_crc = false;
				sectors[i].data = &sector_data[sector_offset];

				io_generic_read(io, sectors[i].data, file_offset, SECTOR_SIZE);

				sector_offset += SECTOR_SIZE;
				file_offset += SECTOR_SIZE;
			}

			build_wd_track_mfm(track, head, image, 100000, SECTOR_COUNT, sectors, 22, 32, 24);
		}
	}

	return true;
}
At first glance, the loading code looks correct...

bluearcus
Posts: 57
Joined: Wed Sep 07, 2016 4:45 pm

Re: MAME Emulation

Post by bluearcus » Sat Nov 02, 2019 2:01 am

Yeah, that does look pretty much OK, perhaps it's not directly related to a doublesided format as I'd assumed, Something must be amiss though to explain the Xroar vs Mame discrepancy in behaviour.

pser1
Posts: 1336
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: MAME Emulation

Post by pser1 » Thu Nov 14, 2019 1:20 pm

Hello,
I would like to debug a program that uses a lot of 6309 opcodes.
If I start with -debug, I can load the program after F5 but in the moment I press EXEC to start the program I always get this answer
?6 ERROR

Of course I have not done anything to tell MAME that the program is intended for a 6309 CPU
How should I proceed in order to be able to debug it?
Thanks in advance
pere

User avatar
robcfg
Posts: 1282
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden

Re: MAME Emulation

Post by robcfg » Thu Nov 14, 2019 1:34 pm

Are you choosing a regular Dragon driver or one fitted with a 6309 processor?

pser1
Posts: 1336
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: MAME Emulation

Post by pser1 » Thu Nov 14, 2019 2:51 pm

Hello Robert,
I am using the one I have been using for the std Dragon, so I have to asume it uses a 6809
Is there a different version that accepts a 6309 CPU?
I would appreciate if you could upload it here to test it!
thanks a lot
pere

pser1
Posts: 1336
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: MAME Emulation

Post by pser1 » Thu Nov 14, 2019 2:56 pm

How do you tell MAME that it should accept the 6309 opcodes?
Inside the dragon64.zip there are only three ROMs, two for Basic and one for DOS
But I see no place to state the fact that you would code for the 6309 CPU

cheers
pere

User avatar
robcfg
Posts: 1282
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden

Re: MAME Emulation

Post by robcfg » Thu Nov 14, 2019 5:56 pm

I don’t remember the name right now, but instead of dragon64 you have to start the equivalent machine that has the 6309.

There’s the dragon64 driver, which uses the 6809, and there should be a machine named dragon64_6309 or similar, which is the one you need to use.

Mame does not allow processor configuration per driver, you need a different driver instead.

I’ll take a look later today and come back to you.

pser1
Posts: 1336
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: MAME Emulation

Post by pser1 » Thu Nov 14, 2019 6:52 pm

thanks, Robert
I will have a look later too
cheers
pere

User avatar
robcfg
Posts: 1282
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden

Re: MAME Emulation

Post by robcfg » Thu Nov 14, 2019 7:01 pm

Found it!

Use dragon64h instead of dragon64 as driver.

As in "mame64.exe dragon64h -window - debug"

pser1
Posts: 1336
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: MAME Emulation

Post by pser1 » Thu Nov 14, 2019 7:32 pm

issuing this command from the command line, it opens the machine window and the debug one
but immediately closes both windows and returns to the system
Probably the file dragon64h or its definition *doesn't* exist in my computer
Could you, please, upload that file here and tell me where should I put it (foldername)?
thanks a lot
pere

Ps. I am using MAME 215
Last edited by pser1 on Thu Nov 14, 2019 7:43 pm, edited 3 times in total.

Post Reply