MAME: Tube devices

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
jgharston
Posts: 2759
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: MAME: Tube devices

Postby jgharston » Tue Oct 10, 2017 7:34 pm

Pernod wrote:The ROM disassemblies at http://mdfs.net/Software/Tube/80x86/ suggest the 80186 and 80286 are handled quite differently. Specifically in http://mdfs.net/Software/Tube/80x86/Client86.src we have:

Yes, the '186 runs the Tube Client from ROM, the '286 runs the Tube Client from RAM. That caught me out intiially when disassembling it.

Pernod wrote:So does the ROM get switched out when IO port 50 is read to make the whole 1MB available?
I'm also seeing writes to IO port 60, any idea what this does?

Note sure, I think I've got some notes somewhere.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Tue Oct 10, 2017 7:43 pm

jgharston wrote:
Pernod wrote:So does the ROM get switched out when IO port 50 is read to make the whole 1MB available?
I'm also seeing writes to IO port 60, any idea what this does?

Note sure, I think I've got some notes somewhere.

No need, the ROM does get switched out after being copied to RAM, and IO port 60 sets up an IRQ vector.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
jgharston
Posts: 2759
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: MAME: Tube devices

Postby jgharston » Wed Oct 11, 2017 12:39 pm

Pernod wrote:
jgharston wrote:
Pernod wrote:So does the ROM get switched out when IO port 50 is read to make the whole 1MB available?
I'm also seeing writes to IO port 60, any idea what this does?

Note sure, I think I've got some notes somewhere.

No need, the ROM does get switched out after being copied to RAM, and IO port 60 sets up an IRQ vector.

Ah, that rings a bell. (inadvertant pun :) )

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
hjalfi
Posts: 74
Joined: Sat May 13, 2017 10:17 pm
Location: Zürich, Switzelrand
Contact:

Re: MAME: Tube devices

Postby hjalfi » Fri Oct 13, 2017 1:35 pm

I'm looking for a version of MAME which supports the 6502 coprocessor --- it looks from this thread like it's working now?

Any suggestions on where to find it (and use it)? The current binaries I have access to don't seem to have it (it behaves as if no coprocessor is plugged in). Do I need to build from source to get at it?

I'm looking for an emulator with more accurate floppy disk timings than b-em or beebem.

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sat Oct 14, 2017 10:52 am

hjalfi wrote:Any suggestions on where to find it (and use it)? The current binaries I have access to don't seem to have it (it behaves as if no coprocessor is plugged in). Do I need to build from source to get at it?

You'll need the latest MAME release from http://mamedev.org/release.html and the appropriate ROMs.

To start MAME with 6502 attached from cmd use: mame bbcb -tube 6502

If you're concerned about floppy timings then I wouldn't recommend the 8271 in MAME as it's only used by the Atom and BBC and hasn't been developed as much as some of the other controllers. Fortunately you can also specify which controller you want to use: mame bbcb -fdc acorn1770 -tube 6502

You can also select attached devices (FDC, Tube, 1MHz Bus) from the MAME internal UI if you don't like using cmd.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
BigEd
Posts: 1496
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: MAME: Tube devices

Postby BigEd » Sat Oct 14, 2017 11:01 am

(Can MAME emulate solid state storage? Or infinitely fast floppies, which is probably about the same thing?)

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sat Oct 14, 2017 11:10 am

BigEd wrote:(Can MAME emulate solid state storage? Or infinitely fast floppies, which is probably about the same thing?)

Yes, but no such devices have been implemented in the BBC driver. Which device would like to see implemented?
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
BigEd
Posts: 1496
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: MAME: Tube devices

Postby BigEd » Sat Oct 14, 2017 11:13 am

Well, I'm a user of MMFS - but it would be easier, I would think, just to zero out the modelling of floppy head movement and rotational delay, and stick with DFS. Either would do, just to speed up file access, for those uses where file access is a limiting factor... I'm thinking of Cowgol although Fuzix is another case, potentially.

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sat Oct 14, 2017 11:24 am

To speed up emulation you can press Insert, enable UI first by pressing ScrollLock.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
BigEd
Posts: 1496
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: MAME: Tube devices

Postby BigEd » Sat Oct 14, 2017 11:27 am

Thanks
[WINDOW ONLY, NON-SDL] Fast forward. While held, runs game with
throttling disabled and with the maximum frameskip.

Would that speed up floppy access too? Or just CPU? I was thinking of something which would speed up floppy access but not CPU.

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sat Oct 14, 2017 11:34 am

It speeds up the whole emulation, CPU, floppy, everything. To speed up floppy access only would require a gross hack, so you really need a proper solid state device to be implemented.
I'll take a look at how feasible it would be to implement the MMFS interface.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
BigEd
Posts: 1496
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: MAME: Tube devices

Postby BigEd » Sat Oct 14, 2017 5:49 pm

Thanks!

tom_seddon
Posts: 84
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: MAME: Tube devices

Postby tom_seddon » Sat Oct 14, 2017 10:32 pm

Regarding speeding up disc accesses: what I did on model-b was have a mode that turned off the speed limiter and only rendered every 50th frame when the disc was being accessed or when a PC key was pressed. This is a bit of a quick and dirty hack, but it worked nicely, and the hacky bit was fairly localized (since keyboard and disc sections just exposed a flag each, which the main loop checked when regulating the speed).

For b2, I did it "properly", by which I mean I did something awful: the 1770 and the 6502 communicate, so that every time the 1770 raises an NMI, instead of waiting some period before issuing the next one, it waits for the instruction after the next RTI, then raises another straight away. The 6502 then gets a stream of NMIs, as fast as it can handle. This mode also removes most disc-related delays (except for the delay between sectors, due to the way Watford DDFS works.)

In principle this can be foiled, but it seems to be reliable with the DFSs I've tried it with: Acorn 1770 DFS, Watford DDFS, Opus DDOS and Opus CHALLENGER. The code for this was a fair bit more invasive though...

--Tom

crj
Posts: 323
Joined: Thu May 02, 2013 4:58 pm

Re: MAME: Tube devices

Postby crj » Sat Oct 14, 2017 11:15 pm

tom_seddon wrote:I did something awful: the 1770 and the 6502 communicate, so that every time the 1770 raises an NMI, instead of waiting some period before issuing the next one, it waits for the instruction after the next RTI, then raises another straight away.

There goes the neighboIRQ handler. Doesn't that play merry hell with the interval timer, TIME, flashing colours, auto-repeat, sound, etc.?

tom_seddon
Posts: 84
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: MAME: Tube devices

Postby tom_seddon » Sun Oct 15, 2017 12:37 am

When an NMI is raised, IRQs are disabled. The NMI handler could in theory enable interrupts, which is something my emulator doesn't check for, but it would be crazy to do that because disc NMIs occur on a schedule that's tight enough that you don't want any uncertainty.

--Tom

crj
Posts: 323
Joined: Thu May 02, 2013 4:58 pm

Re: MAME: Tube devices

Postby crj » Sun Oct 15, 2017 1:46 am

I'm aware of this.

Obviously, NMIs have to be able to delay IRQs. But normally they don't saturate the CPU, so the IRQ will get handled fairly soon. If NMIs are coming back-to-back you risk missing an interrupt altogether.

User avatar
hjalfi
Posts: 74
Joined: Sat May 13, 2017 10:17 pm
Location: Zürich, Switzelrand
Contact:

Re: MAME: Tube devices

Postby hjalfi » Sun Oct 15, 2017 10:18 am

Well, I got MAME built, and huge it is too; but it's looking for two specific 4kB ROM files: 6502tube.rom and 65C102_BOOT_110.rom. The only Tube ROMs I can find are 2kB, and don't work. (e.g. here: http://mdfs.net/Software/Tube/6502/)

Any suggestions on where to find these?

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sun Oct 15, 2017 10:44 am

hjalfi wrote:Any suggestions on where to find these?

Yep, here and here.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
hjalfi
Posts: 74
Joined: Sat May 13, 2017 10:17 pm
Location: Zürich, Switzelrand
Contact:

Re: MAME: Tube devices

Postby hjalfi » Sun Oct 15, 2017 11:54 am

It works! No nice floppy disk noises, though --- MESS claims the floppy sound drivers are enabled. (I was rather wanting to hear the disks so I could get a handle on how much time was being wasted on seeks.) Is there a flag to enable it somewhere?

Also, even with the 1770 controller, bbcb won't mount high-density disks, such as my ADF file.

Still, it works very nicely; thank-you!

Also my benchmark has jumped from 8 minutes to 16. As that is now worse, I can only assume that the timing is accurate, because that's how the universe works.

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Sun Oct 15, 2017 12:15 pm

For floppy sounds you should have a samples folder, get it from the official download. I don't support ADFS in bbcb, you'll need to run a Master bbcm to mount your ADF.
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

tom_seddon
Posts: 84
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: MAME: Tube devices

Postby tom_seddon » Mon Oct 23, 2017 12:48 am

crj wrote:I'm aware of this.

Obviously, NMIs have to be able to delay IRQs. But normally they don't saturate the CPU, so the IRQ will get handled fairly soon. If NMIs are coming back-to-back you risk missing an interrupt altogether.


Right, yes - I see what you're getting at now. I'm sure you can engineer situations where it's an issue, but in practice it seems to be fine. Most of the time, there's no disc access; when there is disc access, if interrupts are serviced late or not at all when it's happening, it doesn't seem to actually cause a problem....

--Tom

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Mon Nov 13, 2017 11:24 am

Moving on to the ARM Evaluation System:
0008.png

It's running but not responding to any input, can anyone suggest why this would happen?

I have the ROM located at 0x3000000 and at reset also paged into 0x00000000 to provide the vectors. Then according to the PAL it is paged out of the RAM region upon first write. What would cause it to not respond?
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
hoglet
Posts: 6624
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: MAME: Tube devices

Postby hoglet » Mon Nov 13, 2017 11:32 am

Does escape have any effect?

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Mon Nov 13, 2017 11:34 am

hoglet wrote:Does escape have any effect?

0030.png
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
hoglet
Posts: 6624
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: MAME: Tube devices

Postby hoglet » Mon Nov 13, 2017 11:54 am

Can you post a link to your Co Processor emulation code?

We're using the ARM2 from MAME in PiTubeDirect and it's working fine. So it has to be something amiss in how you have wrapped it as a Co Processor. Here's the PiTubeDirect wrapper:
https://github.com/hoglet67/PiTubeDirec ... pro-arm2.c

Dave

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Mon Nov 13, 2017 12:04 pm

It's not submitted yet so not on Github. Here's the co-processor code but not likely to tell you much unless you're familiar with the MAME macros.

Code: Select all

// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************

    Acorn ANC13 ARM Evaluation System

**********************************************************************/


#include "emu.h"
#include "tube_arm.h"
#include "softlist_dev.h"


//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(BBC_TUBE_ARM, bbc_tube_arm_device, "bbc_tube_arm", "ARM Evaluation System")


//-------------------------------------------------
//  ADDRESS_MAP( tube_arm_mem )
//-------------------------------------------------

static ADDRESS_MAP_START(tube_arm_mem, AS_PROGRAM, 32, bbc_tube_arm_device)
   //ADDRESS_MAP_UNMAP_HIGH
   AM_RANGE(0x0000000, 0x03fffff) AM_READWRITE(ram_r, ram_w)
   AM_RANGE(0x1000000, 0x100001f) AM_DEVREADWRITE8("ula", tube_device, parasite_r, parasite_w, 0x000000ff)
   AM_RANGE(0x3000000, 0x3003fff) AM_ROM AM_REGION("bootstrap", 0) AM_MIRROR(0xc000)
ADDRESS_MAP_END

//-------------------------------------------------
//  ROM( tube_arm )
//-------------------------------------------------

ROM_START( tube_arm )
   ROM_REGION(0x4000, "bootstrap", 0)
   ROM_LOAD("ARMeval_100.rom", 0x0000, 0x4000, CRC(7c27c098) SHA1(abcc71cbc43489e89a87aac64e67b17daef5895a))
ROM_END

//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

MACHINE_CONFIG_MEMBER(bbc_tube_arm_device::device_add_mconfig)
   MCFG_CPU_ADD("arm", ARM, XTAL_20MHz / 3)  /* ARM1 6.667 MHz */
   MCFG_CPU_PROGRAM_MAP(tube_arm_mem)

   MCFG_TUBE_ADD("ula")
   MCFG_TUBE_HIRQ_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, bbc_tube_slot_device, irq_w))
   MCFG_TUBE_PNMI_HANDLER(INPUTLINE("arm", ARM_FIRQ_LINE))
   MCFG_TUBE_PIRQ_HANDLER(INPUTLINE("arm", ARM_IRQ_LINE))

   /* software lists */
   MCFG_SOFTWARE_LIST_ADD("flop_ls_arm", "bbc_flop_arm")
MACHINE_CONFIG_END

//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const tiny_rom_entry *bbc_tube_arm_device::device_rom_region() const
{
   return ROM_NAME( tube_arm );
}

//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  bbc_tube_arm_device - constructor
//-------------------------------------------------

bbc_tube_arm_device::bbc_tube_arm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
   : device_t(mconfig, BBC_TUBE_ARM, tag, owner, clock),
      device_bbc_tube_interface(mconfig, *this),
      m_arm(*this, "arm"),
      m_ula(*this, "ula"),
      m_ram(*this, "ram"),
      m_bootstrap(*this, "bootstrap"),
      m_rom_select(true)
{
}

//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void bbc_tube_arm_device::device_start()
{
   m_slot = dynamic_cast<bbc_tube_slot_device *>(owner());

   // allocate memory
   m_ram.allocate(0x0400000);
}

//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void bbc_tube_arm_device::device_reset()
{
   m_rom_select = true;
}


//**************************************************************************
//  IMPLEMENTATION
//**************************************************************************

READ8_MEMBER(bbc_tube_arm_device::host_r)
{
   return m_ula->host_r(space, offset);
}

WRITE8_MEMBER(bbc_tube_arm_device::host_w)
{
   m_ula->host_w(space, offset, data);
}


READ32_MEMBER(bbc_tube_arm_device::ram_r)
{
   uint32_t data;

   if (m_rom_select)
   {
      data = m_bootstrap->as_u32(offset & 0x3fff);
   }
   else
   {
      data = m_ram[offset];
   }
   return data;
}

WRITE32_MEMBER(bbc_tube_arm_device::ram_w)
{
   if (!machine().side_effect_disabled()) m_rom_select = false;

   m_ram[offset] = data;
}
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
hoglet
Posts: 6624
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: MAME: Tube devices

Postby hoglet » Mon Nov 13, 2017 1:15 pm

Hmm, can't see anything obvious.

Do you get the same results with the v1.01 client ROM?

It might be worth trying to generate an address trace from the Co Processor, and we could compare that with a similar trace from PiTubeDirect.

Dave

User avatar
Pernod
Posts: 1001
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK

Re: MAME: Tube devices

Postby Pernod » Mon Nov 13, 2017 3:19 pm

Haven't tried 1.01 yet, but here's a trace from typing:
*HELP
*.
*ROMS

Appreciate you taking a look. ARM code doesn't mean much to me unfortunately.
Attachments
trace_arm.zip
(15.99 KiB) Downloaded 5 times
- Nigel

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.

User avatar
jgharston
Posts: 2759
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: MAME: Tube devices

Postby jgharston » Mon Nov 13, 2017 3:24 pm

At the very least *HELP should give a response as it's processed on the client side before being passed to the host.

*HELP should print Supervisor blah blah and then pass the command to the host, so if client<->host command passing was failing you would at least get the client's help message.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
jgharston
Posts: 2759
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: MAME: Tube devices

Postby jgharston » Mon Nov 13, 2017 3:42 pm

It looks like the TEQS opcode isn't working.

Code: Select all

0000A04: TEQS    R0, #$48  ; 'H'
0000A08: BEQ     $ff000d68 ; Check for 'HELP'
0000A0C: TEQS    R0, #$47  ; 'G'
0000A10: BEQ     $ff000e08 ; Check for 'GO'
0000A14: TEQS    R0, #$43  ; 'C'

When issuing the command *HELP that TEQS R0,ASC"H" isn't matching.

Or, earlier, 0000974: LDRB R0, [R11], #$1 isn't fetching the byte from the command line at R11.

Or, R11 isn't being set to point to the command line. A bit fiddly to work out from a disassembly without register contents.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_


Return to “emulators”

Who is online

Users browsing this forum: No registered users and 4 guests