Page 1 of 1

Econet for Arculator (and other emulators)

Posted: Thu May 31, 2018 10:27 am
by myelin
Just in case anyone is interested (or also working on this), I've started on an Econet implementation for Arculator. It's a high-level model of the MC68B54 chip as found in MAME and BeebEm, and I'm intending on supporting AUN, so it should be able to talk to aund and beebem's AUN code (and maybe RPCEmu?) when it's done.

(I'm aware I'm reinventing the wheel here and could just port the GPL code from beebem-windows or the 3-clause-BSD code from MAME, but this is partly an educational mission for me, to understand how RISC OS and the Acorn MOS talk to the 6854, so I can one day make my econet_from_scratch board function as an Econet module in a Master or Arc.)

So far, on my macOS build, I have RISC OS 3.11 booting and showing the 'Net' icon in the icon bar, and logging scout packets when I try to do things like browse the network or log in to a file server. I haven't implemented any of the actual networking code yet.

Re: Econet for Arculator (and other emulators)

Posted: Thu May 31, 2018 10:33 am
by Ottly
More the merrier. :-)

I find beebems implementation of econet very buggy. Times out and hangs.

RPCemu is pretty rock solid for RISC OS.

Re: Econet for Arculator (and other emulators)

Posted: Thu May 31, 2018 11:15 am
by Pernod
The implementation in MAME is also not complete, it's never worked afaik. I'll be following your progress to hopefully improve MAME too.

Re: Econet for Arculator (and other emulators)

Posted: Thu May 31, 2018 12:33 pm
by Phlamethrower
Call me crazy, but it would be nice to have an emulator-agnostic "podule emulation API" so that once a podule emulation has been written for one emulator, it can be used with another emulator just by copying the precompiled podule DLL and a few configuration files to the right location.

I'd hope that in terms of emulating a podule this would be pretty straightforward (there are only so many bus operations that can be performed on a podule connector!). But maybe the stumbling block would be working out a user-friendly way of configuring the podules - e.g. configuring how the virtual econet/ethernet podule connects to your real network. Ideally this would be done via the emulator's native configuration UI, but since each emulator will be using its own choice of UI framework, there'd have to be some kind of interface to wrap that as well.

Then you get to the annoying podules which tap into other signals within the system (e.g. video compositing), which would be a lot harder to deal with in an efficient and emulator-agnostic manner. But still, it's nice to dream!

Re: Econet for Arculator (and other emulators)

Posted: Thu May 31, 2018 5:50 pm
by myelin
Sounds like an excellent plan!

It looks like Arculator and RPCEmu already do this, at least for the simple case (no configuration, no complicated magic like video)... here's the interface podules have to implement to be dynamically loadable:

Code: Select all

typedef struct podule
{
        void (*writeb)(struct podule *p, int easi, uint32_t addr, uint8_t val);
        void (*writew)(struct podule *p, int easi, uint32_t addr, uint16_t val);
        void (*writel)(struct podule *p, int easi, uint32_t addr, uint32_t val);
        uint8_t  (*readb)(struct podule *p, int easi, uint32_t addr);
        uint16_t (*readw)(struct podule *p, int easi, uint32_t addr);
        uint32_t (*readl)(struct podule *p, int easi, uint32_t addr);
        void (*memc_writeb)(struct podule *p, uint32_t addr, uint8_t val);
        void (*memc_writew)(struct podule *p, uint32_t addr, uint16_t val);
        uint8_t  (*memc_readb)(struct podule *p, uint32_t addr);
        uint16_t (*memc_readw)(struct podule *p, uint32_t addr);
        int (*timercallback)(struct podule *p);
        void (*reset)(struct podule *p);
        int irq,fiq;
        int msectimer;
        int broken;
} podule;
For Econet it's a bit different because, at least on the pre-RiscPC machines, the Econet module isn't a podule; it's a custom socket that takes the same module used by the Master 128. The code should be shareable between all the emulators though... I'm hoping to contribute it to as many emulators as possible, under their own licenses (or something compatible with them all to make it easy to share everything).

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 01, 2018 4:44 pm
by SarahWalker
For basic configuration I was planning to bring the PCem config system over to Arculator. This lets you define this sort of thing :

Code: Select all

static device_config_t sb_config[] =
{
        {
                .name = "addr",
                .description = "Address",
                .type = CONFIG_SELECTION,
                .selection =
                {
                        {
                                .description = "0x210",
                                .value = 0x210
                        },
                        {
                                .description = "0x220",
                                .value = 0x220
                        },
                        {
                                .description = "0x230",
                                .value = 0x230
                        },
                        {
                                .description = "0x240",
                                .value = 0x240
                        },
                        {
                                .description = "0x250",
                                .value = 0x250
                        },
                        {
                                .description = "0x260",
                                .value = 0x260
                        },
                        {
                                .description = ""
                        }
                },
                .default_int = 0x220
        },
        {
                .name = "irq",
                .description = "IRQ",
                .type = CONFIG_SELECTION,
                .selection =
                {
                        {
                                .description = "IRQ 2",
                                .value = 2
                        },
                        {
                                .description = "IRQ 3",
                                .value = 3
                        },
                        {
                                .description = "IRQ 5",
                                .value = 5
                        },
                        {
                                .description = "IRQ 7",
                                .value = 7
                        },
                        {
                                .description = ""
                        }
                },
                .default_int = 7
        },
        {
                .name = "dma",
                .description = "DMA",
                .type = CONFIG_SELECTION,
                .selection =
                {
                        {
                                .description = "DMA 1",
                                .value = 1
                        },
                        {
                                .description = "DMA 3",
                                .value = 3
                        },
                        {
                                .description = ""
                        }
                },
                .default_int = 1
        },
        {
                .type = -1
        }
};
which then gets turned into a dialog box by the emulator :
config.png
config.png (15.47 KiB) Viewed 1594 times
This works well for simple stuff (it currently implements integer, binary (ie checkbox), selection (ie listbox) and a special type for MIDI out devices).

For more complex stuff, eg SCSI card configuration, I was intending to allow podule DLLs to implement a custom dialog through wxWidgets. This would work well for Arculator, but if there's a desire for this to be cross-emulator then obviously that's a non-starter.

Re: Econet for Arculator (and other emulators)

Posted: Sat Jun 02, 2018 2:39 am
by jgharston
Phlamethrower wrote:
Thu May 31, 2018 12:33 pm
Call me crazy, but it would be nice to have an emulator-agnostic "podule emulation API" so that once a podule emulation has been written for one emulator, it can be used with another emulator just by copying the precompiled podule DLL and a few configuration files to the right location.
Exactly what I proposed and pushed for years ago, a Windows equivalent of the RISC OS emulated 6502 I/O and similar RISC OS emulated Z80 I/O service calls. If I dig through the mailing list archive I may even find the original posts.

Re: Econet for Arculator (and other emulators)

Posted: Sun Jun 03, 2018 7:06 pm
by SarahWalker
You mentioned it here : viewtopic.php?f=4&t=3864. You can see quite how little interest there was.

It's probably worth noting that despite RPCemu having had podule support for more than 10 years now, the only publicly released podules were the ones I threw together to test the DLL interface.

It's also worth noting that RPCemu is the only Archimedes/RiscPC emulator that has had a public release in the last 5 years, so being emulator agnostic is perhaps a little unnecessary at this point?

Re: Econet for Arculator (and other emulators)

Posted: Sun Jun 03, 2018 7:38 pm
by Phlamethrower
From my perspective, it would have be nice to have the API defined, so that if/when I eventually add podule support to ArcEm I'd be able to implement support for it there. But since that's likely to be at least a year or two away, I do agree that if no other emulator developers are interested in implementing such a thing then it would just be a bit of a waste of effort.

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 22, 2018 8:06 pm
by flibble
myelin wrote:
Thu May 31, 2018 10:27 am
Just in case anyone is interested (or also working on this), I've started on an Econet implementation for Arculator. It's a high-level model of the MC68B54 chip as found in MAME and BeebEm, and I'm intending on supporting AUN, so it should be able to talk to aund and beebem's AUN code (and maybe RPCEmu?) when it's done.
This does sound interesting, would be fun to connect a virtual arc to a virtual beeb over a virtual network :)

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 22, 2018 8:20 pm
by flibble
SarahWalker wrote:
Sun Jun 03, 2018 7:06 pm
You mentioned it here : viewtopic.php?f=4&t=3864. You can see quite how little interest there was.

It's probably worth noting that despite RPCemu having had podule support for more than 10 years now, the only publicly released podules were the ones I threw together to test the DLL interface.
We dropped the DLL support code from RPCEmu two years ago, we had nothing to use it. Of course the podule code is still there for compiled in podules (the rom podule and network podule), just not the ability to load plugins.
Phlamethrower wrote:
Sun Jun 03, 2018 7:38 pm
From my perspective, it would have be nice to have the API defined, so that if/when I eventually add podule support to ArcEm I'd be able to implement support for it there. But since that's likely to be at least a year or two away, I do agree that if no other emulator developers are interested in implementing such a thing then it would just be a bit of a waste of effort.
I am not in favour of any sort of podule DLL api

1) The API is windows only, the emulators are not.
2) It's not needed, just contribute the podule's code to the emulators.

Whilst attempting to stay on topic, econet is not on the podule bus anyway.

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 22, 2018 9:33 pm
by SarahWalker
flibble wrote:
Fri Jun 22, 2018 8:20 pm
1) The API is windows only, the emulators are not.
FWIW, Arculator's podule code did get ported to Linux.

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 22, 2018 11:00 pm
by Phlamethrower
flibble wrote:
Fri Jun 22, 2018 8:20 pm
I am not in favour of any sort of podule DLL api

1) The API is windows only, the emulators are not.
I should have probably been clearer - I was just using "DLL" as shorthand for "whatever dynamic code loading system is appropriate for the host platform"

Re: Econet for Arculator (and other emulators)

Posted: Fri Jun 22, 2018 11:24 pm
by myelin
flibble wrote:
Fri Jun 22, 2018 8:06 pm
This does sound interesting, would be fun to connect a virtual arc to a virtual beeb over a virtual network :)
Indeed! Hoping to do exactly that, and maybe have it use an USB Econet adapter (either my half-finished one, or flynnjs's one) as a bridge onto a real Econet. Not sure if that would play well with the AUN (or BeebEm's UDP system) side of things, but it would be fun if it worked.

Current status: I have it catching outbound frames from Arculator, and I'm working on figuring out how to properly map these to AUN packets. It looks like some things won't map too well (as I'll have to make the emulator fake an ack to get the OS to send the second half of a fileserver packet, but if the destination server is inaccessible, that'll probably result in the wrong error inside the emulator) but it should hopefully be workable.