Ideas for PCAT

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Ideas for PCAT

Unread post by Newsdee »

Now that the PCXT core is finally "done", I can't help but wonder what it would take to create a core for an AT-class architecture
(I know Spark will take a hyatus; this is by no means a request but rather a thought experiment for my own curiosity)

This would be best suited for a new core to avoid breaking the use cases of PCXT (and also simplifying design),
and allow running games that need a little more speed (beyond the 4Mhz AT equivalent max speed of PCXT).

I can think of the following changes:

  • upgraded CPU to 80186 class (or better) with a 24-bit RAM bus (allowing up to 16MB of RAM)

  • ISA bus support (16bit bus)

  • Enhance chipset (one extra 8259A and 8237A, plus 82288 ?)

  • Upgrade video to VGA/EGA card (removing support for CGA/MDA but ideally keeping TGA for later Tandy machines)

  • Use a new BIOS compatible with new chipset

Obvious caveat / counter-argument for this is that we'd probably could achieve something similar by a custom build of ao486 with lower clock frequencies; but since there are already a couple of 80x86 CPUs written from scratch (next186 and 80x86), it may be interesting to check how they fare. They would not be cycle accurate like the MCL86, though.

This also assumes we might achieve one day a full 286 replacement (at least a compatible instruction set).

MicroCoreLabs
Core Developer
Posts: 96
Joined: Sun Jun 05, 2022 6:12 pm
Location: California
Has thanked: 6 times
Been thanked: 86 times
Contact:

Re: Ideas for PCAT

Unread post by MicroCoreLabs »

If you only want a speed boost then it can be achieved most easily by making improvements to the PCXT core - I have posted notes in this forum on how it can be done. If there is no interest in this level of effort then developing a new 80286 core and chipset are even more unlikely...

User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: Ideas for PCAT

Unread post by spark2k06 »

In the repository will be available the available sources to carry out an alternative fork with the necessary improvements for an improved core, but unreal in reality. For those who are up for it, I will indeed take a break πŸ˜ƒ

The main objective of the core has been achieved, and we have even gone further in some respects. Such a radical change to make it faster already seems to me to take it too far, whatever it is, it would no longer look like a PCXT.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

spark2k06 wrote: ↑Mon Dec 12, 2022 4:48 am

whatever it is, it would no longer look like a PCXT.

Exactly, this isn't just about a speed boost but to represent more accurately PC compatibles from 1987 onwards... when EGA existed for a few years and VGA just came out. That's why I'm calling it "PCAT" :D

User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: Ideas for PCAT

Unread post by spark2k06 »

Newsdee wrote: ↑Mon Dec 12, 2022 5:27 am
spark2k06 wrote: ↑Mon Dec 12, 2022 4:48 am

whatever it is, it would no longer look like a PCXT.

Exactly, this isn't just about a speed boost but to represent more accurately PC compatibles from 1987 on-wards... where EGA existed for a few years and VGA just came out. That's why I'm calling it "PCAT" :D

In any case, this task will no longer be so easy. As I have said before, what I have achieved in this core, in spite of some efforts, has been mainly due to the previous hard work on the chipset, the CPU, and the graphics card.

None of this is available to the adventurer who sets out to make a PCAT. Next186 for me does not count as a real CPU and that can be taken to a real chipset...it has its peculiarities that makes it incompatible. So even in the CPU we would start from scratch.

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Ideas for PCAT

Unread post by Malor »

The basic problem is that building an FPGA 80286 CPU would be very hard work, but the gains from the 286 would be minimal. Almost everything the 80286 did was never meaningfully taken up by the market. The reward for effort just isn't there. About the only thing is the High Memory Area, which was indeed pretty cool, but you can get that on every chip afterward.

IMO, fixing or rebuilding the AO486 core would produce much better overall results with a lot less labor invested. Even starting that project over from scratch would be easier than trying to make a 286, because the AO486 CPU is mostly finished. From what I can tell, the CPU is the massive hurdle for any further x86 work.

In real life, the 16-bit ISA slots and cascaded interrupt controllers, adding additional IRQs, were very important parts of the AT, and were kept around for a very long time. But those don't really apply to the Mister. I don't think either PCXT or AO486 are actually implementing the ISA bus, it's abstracted away into just address space, I/O ports, and IRQs, and those limited parts have apparently already been implemented for the AO486.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

spark2k06 wrote: ↑Mon Dec 12, 2022 5:35 am

None of this is available to the adventurer who sets out to make a PCAT. Next186 for me does not count as a real CPU and that can be taken to a real chipset...it has its peculiarities that makes it incompatible. .

What about 80x86? https://github.com/jamieiles/80x86

The S80186 IP core is a compact, 80186 binary compatible core, implementing the full 80186 ISA suitable for integration into FPGA/ASIC designs.

Granted I don't expect it to be cycle accurate - probably it's missing a lot and may have weird behaviors; but in theory it can be integrated as a CPU.

Malor wrote: ↑Mon Dec 12, 2022 5:58 am

Even starting that project over from scratch would be easier than trying to make a 286, because the AO486 CPU is mostly finished.

For sure a 386+ CPU would be better; but how much of ao486 can be abstracted away as a standalone CPU?
Alternatively maybe it can be slowed down in a custom build - so we don't have to fiddle with the cache options.

User avatar
spark2k06
Core Developer
Posts: 868
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 961 times

Re: Ideas for PCAT

Unread post by spark2k06 »

Well, I don't know, but if cycle accuracy is no longer important, I also agree with Malor that the most logical path is an adapted ao486.

held
Posts: 209
Joined: Sun Sep 26, 2021 2:18 pm
Has thanked: 27 times
Been thanked: 31 times

Re: Ideas for PCAT

Unread post by held »

Do you think, running DOOM properly is out of the question?

I would like a redo of the 486 very much, its not on par with the other cores. Its there, but I still feel its missing. What would be the time period that is actually achievable? because the ao486 had a lot of expectations that were not met imo. Are we talking everything before 1992, the pre-DX2 era?

User avatar
thisisamigaspeaking
Posts: 231
Joined: Mon May 23, 2022 12:28 am
Has thanked: 74 times
Been thanked: 21 times

Re: Ideas for PCAT

Unread post by thisisamigaspeaking »

Newsdee wrote: ↑Mon Dec 12, 2022 4:20 am

[*] Upgrade video to VGA/EGA card (removing support for CGA/MDA but ideally keeping TGA for later Tandy machines)

Of course an implementation could support whatever it like, but VGA includes support for all CGA and MDA modes (although not at a register level so CGA demos might not work or that kind of thing).

Newsdee wrote: ↑Mon Dec 12, 2022 5:27 am

Exactly, this isn't just about a speed boost but to represent more accurately PC compatibles from 1987 onwards... when EGA existed for a few years and VGA just came out. That's why I'm calling it "PCAT" :D

The same argument could be made that CGA was only out for 3 years before EGA came out.

There was some lag before 256 color VGA games were common though, while EGA support continued to grow even after 1987. There are a significant number of games with EGA support, although how many of those 320x200x16 games don't support Tandy I'm not sure. Support for 640x350x16 would be great for shareware games and SimCity.

held wrote: ↑Mon Dec 12, 2022 9:07 am

Do you think, running DOOM properly is out of the question?

I would like a redo of the 486 very much, its not on par with the other cores. Its there, but I still feel its missing. What would be the time period that is actually achievable? because the ao486 had a lot of expectations that were not met imo. Are we talking everything before 1992, the pre-DX2 era?

I think the minimum CPU for DOOM is a 386 so this is more into ao486 territory than PCAT.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

So I did some benchmarking, and maybe we don't need any new cores after all :lol:
Using ao486 at 15Mhz with L1 cache on and L2 cache off results in the same performance as a PC-AT 6Mhz (as measured by Spark in another thread)

I tried to find Dhrystones equivalent for various systems to map into the table below.

One interesting observation is that we should never disable both caches in ao486 because that's made obsolete by the PCXT core...
PCXT has cycle-accurate modes and disabling both caches on ao486 resutls in much worse performance(!). I doubt anybody would want that?

It would be nice to revamp the ao486 to have a more intuitive CPU speed selection; but in the interim I hope this table helps.

ao486 performance - CheckIt 3.0 Dhrystones

perf_ao486.PNG
perf_ao486.PNG (58.08 KiB) Viewed 8269 times

PCXT performance - CheckIt 3.0 Dhrystones

perf_pcxt.PNG
perf_pcxt.PNG (10.6 KiB) Viewed 8269 times
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Ideas for PCAT

Unread post by Malor »

Newsdee wrote: ↑Mon Dec 12, 2022 6:10 am

For sure a 386+ CPU would be better; but how much of ao486 can be abstracted away as a standalone CPU?
Alternatively maybe it can be slowed down in a custom build - so we don't have to fiddle with the cache options.

It's my understanding from forum posts that AO486 exists as a standalone thing, just the CPU as an FPGA project. I guess Sorgelig took that and assembled the other components to make a PC, but overdid it somehow so that the core can just barely fit onto the FPGA. Finding a seed that will correctly build it is apparently quite difficult, so devs working on it spend a lot of time trying and failing to compile it. It's so frustrating to work with that nobody is touching it.

If we could just get the memory bugs fixed, it'd be mostly okay. And you might be able to run some EGA games on it, because VGA is supposed to be backward-compatible. I'm not sure how good the AO486's card is.

Oh, it'd also be nice if the video card could put out real PC frequencies. I guess it doesn't do that now. Might not be any room for the circuitry.

dmckean
Posts: 307
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 388 times
Been thanked: 95 times

Re: Ideas for PCAT

Unread post by dmckean »

Maybe a faster performance fork of this core isn't as crazy as it sounds since the ao486 core is slower than the PCXT when all the cache is disabled.

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Ideas for PCAT

Unread post by Malor »

The real 80486s had 1.2 to 1.6 million transistors. Directly duplicating that on a Cyclone V's 110,000 LEs probably isn't going to happen. I'm guessing, but I bet the AO486 circuitry has only a small execution core, and then uses microcode to run the more complex ops. I think that's why it has to be clocked so much higher than the real thing, and why it's so dependent on cache.

It seems like we'd need a much, much larger FPGA to have a prayer of doing a 486 truly correctly. And it would take an enormous amount of labor and especially debugging. Precisely duplicating the functionality of a 1.2 million transistor chip would likely take years.

Pentiums, with their out-of-order execution engines, are probably forever beyond the capabilities of FPGA hobbyists to reproduce.

edit: it would be especially silly to even try, when almost every one of us already has a machine capable of running 16- and 32-bit DOS code at multiple gigahertz. We just have to use a 32-bit version of Windows.

User avatar
thisisamigaspeaking
Posts: 231
Joined: Mon May 23, 2022 12:28 am
Has thanked: 74 times
Been thanked: 21 times

Re: Ideas for PCAT

Unread post by thisisamigaspeaking »

@Newsdee the first comment seems to have an error, 21k is faster than 16k. Nice table, definitely helpful.

User avatar
thisisamigaspeaking
Posts: 231
Joined: Mon May 23, 2022 12:28 am
Has thanked: 74 times
Been thanked: 21 times

Re: Ideas for PCAT

Unread post by thisisamigaspeaking »

Malor wrote: ↑Mon Dec 12, 2022 3:20 pm

Pentiums, with their out-of-order execution engines, are probably forever beyond the capabilities of FPGA hobbyists to reproduce.

Forever is a long time and that seems unlikely to be the case. Way outside my field of knowledge, but I would guess C to HDL converters and similar tools may become very sophisticated, especially with the help of AI.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

thisisamigaspeaking wrote: ↑Mon Dec 12, 2022 4:17 pm

@Newsdee the first comment seems to have an error, 21k is faster than 16k. Nice table, definitely helpful.

The reference speeds came from here:
https://docs.google.com/spreadsheets/d/ ... p=drivesdk

The comment is wrong in my table, yes. Should be "slower than a 486 DX 40"

dmckean
Posts: 307
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 388 times
Been thanked: 95 times

Re: Ideas for PCAT

Unread post by dmckean »

Malor wrote: ↑Mon Dec 12, 2022 3:20 pm

The real 80486s had 1.2 to 1.6 million transistors. Directly duplicating that on a Cyclone V's 110,000 LEs probably isn't going to happen. I'm guessing, but I bet the AO486 circuitry has only a small execution core, and then uses microcode to run the more complex ops. I think that's why it has to be clocked so much higher than the real thing, and why it's so dependent on cache.

It seems like we'd need a much, much larger FPGA to have a prayer of doing a 486 truly correctly. And it would take an enormous amount of labor and especially debugging. Precisely duplicating the functionality of a 1.2 million transistor chip would likely take years.

There's no reason to directly duplicate it. The MCL86 CPU in this core doesn't directly duplicate the 8088 either.

I

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Ideas for PCAT

Unread post by Malor »

It's still a 1.2 million transistor chip. Recreating it correctly, and then testing it, would be a massive project.

The AO486 CPU core is probably about as good as it's going to get.... a vague workalike that's very inefficient. The stuff around that core could be reasonably improved by hobbyists, but you're probably not going to see more than tiny incremental changes to the CPU itself. There's just no room.

My guess is that it will take a bigger FPGA for good later-model PC emulation. In the interim, there's always DOSBox-X. It's quite good, my favorite of the DOSBox forks.

dmckean
Posts: 307
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 388 times
Been thanked: 95 times

Re: Ideas for PCAT

Unread post by dmckean »

The MIPS cpu in the PSX is a 900k transistor chip for comparison. We can have a much more compatible core than what we currently have with ao486. It will be a LOT of work though for whoever takes on that project.

Mills
Posts: 83
Joined: Mon Jun 08, 2020 2:52 pm
Has thanked: 15 times
Been thanked: 29 times

Re: Ideas for PCAT

Unread post by Mills »

Newsdee wrote: ↑Mon Dec 12, 2022 4:20 am

Now that the PCXT core is finally "done", I can't help but wonder what it would take to create a core for an AT-class architecture
(I know Spark will take a hyatus; this is by no means a request but rather a thought experiment for my own curiosity)

This would be best suited for a new core to avoid breaking the use cases of PCXT (and also simplifying design),
and allow running games that need a little more speed (beyond the 4Mhz AT equivalent max speed of PCXT).

I can think of the following changes:

  • upgraded CPU to 80186 class (or better) with a 24-bit RAM bus (allowing up to 16MB of RAM)

  • ISA bus support (16bit bus)

  • Enhance chipset (one extra 8259A and 8237A, plus 82288 ?)

  • Upgrade video to VGA/EGA card (removing support for CGA/MDA but ideally keeping TGA for later Tandy machines)

  • Use a new BIOS compatible with new chipset

Obvious caveat / counter-argument for this is that we'd probably could achieve something similar by a custom build of ao486 with lower clock frequencies; but since there are already a couple of 80x86 CPUs written from scratch (next186 and 80x86), it may be interesting to check how they fare. They would not be cycle accurate like the MCL86, though.

This also assumes we might achieve one day a full 286 replacement (at least a compatible instruction set).

If you want a 286, just add 186 instructions to the 8088 cpu, and modify the 8088 ones to be faster like the 286 ones (this might be easy).
Then add the VGA/EGA part from the ao486 SVGA card, and that's it. It won't be cycle accurate, but you can tweak it to be very similar to a real 286, and you'll have a cool 286 clone. I'd love to do it, if I knew something more about FPGAS.

As I said in the other thread, I don't think any games/programs for 286 need cycle accuracy, or specific speeds, there were several 286 clones, and also they can be 6-24 Mhz, so it really doesn't matter, it's like taking the 8088 and making it very fast.

The only benefit of the 286 I found, is the compatibility with games up until 1994, (and it would be easier to remove the few 286 instructions they use, than creating the 286 core), and the possibility to use windows 3.1 without using the 640k of conventional ram (using the protected mode).

I think ao486 does a good job for this, but if you really want the 286, create the ega/vga card for the pcxt core, add 186 instructions, and make it very fast.

For me, adding an EGA card to the pcxt, would be more than enough, much more than I expected from this awesome core :).

Anyway, some day we might have schemes from 286 or 8086 systems, who knows. But they are not as popular as other systems (arcades) so I think it will be difficult.

MicroCoreLabs
Core Developer
Posts: 96
Joined: Sun Jun 05, 2022 6:12 pm
Location: California
Has thanked: 6 times
Been thanked: 86 times
Contact:

Re: Ideas for PCAT

Unread post by MicroCoreLabs »

Would a 80386 that only operates in real mode be interesting? Implementing protected mode is a heavy lift and DOS doesnt even use it...

Speaking of which, was the 386 widely used as an embedded processor? If so, was it used in real mode or was there a need for protected mode in embedded applications?

throAU
Posts: 181
Joined: Fri Sep 11, 2020 1:06 am
Has thanked: 230 times
Been thanked: 27 times

Re: Ideas for PCAT

Unread post by throAU »

Malor wrote: ↑Mon Dec 12, 2022 5:58 am

The basic problem is that building an FPGA 80286 CPU would be very hard work, but the gains from the 286 would be minimal. Almost everything the 80286 did was never meaningfully taken up by the market. The reward for effort just isn't there. About the only thing is the High Memory Area, which was indeed pretty cool, but you can get that on every chip afterward.

IMO, fixing or rebuilding the AO486 core would produce much better overall results with a lot less labor invested. Even starting that project over from scratch would be easier than trying to make a 286, because the AO486 CPU is mostly finished. From what I can tell, the CPU is the massive hurdle for any further x86 work.

In real life, the 16-bit ISA slots and cascaded interrupt controllers, adding additional IRQs, were very important parts of the AT, and were kept around for a very long time. But those don't really apply to the Mister. I don't think either PCXT or AO486 are actually implementing the ISA bus, it's abstracted away into just address space, I/O ports, and IRQs, and those limited parts have apparently already been implemented for the AO486.

Pretty much that. The big jump in terms of instruction requirements was the 386.

The jump from 386 to 486 was just cache and performance improvement; there was only one new instruction vs. 386.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

MicroCoreLabs wrote: ↑Sat Jan 14, 2023 1:08 am

Would a 80386 that only operates in real mode be interesting? Implementing protected mode is a heavy lift and DOS doesnt even use it...

Speaking of which, was the 386 widely used as an embedded processor? If so, was it used in real mode or was there a need for protected mode in embedded applications?

Many later games used DOS extenders that leveraged protected mode to address the full 32 bits of memory, for example DOS/4GW: https://pikuma.com/blog/what-is-dos4gw-protected-mode

Also from reading wikipedia, it mentions that 386 embedded chips did not have real mode at all.

But a real mode 386 would still be worthwile to make a DOS core wirh higher speed (and accuracy) for early DOS games. It may even benefit Japanese computers such as the PC98 or FM Town cores.

And hopefully, it could also be a stepping stone to add protected mode at a later stage.

MicroCoreLabs
Core Developer
Posts: 96
Joined: Sun Jun 05, 2022 6:12 pm
Location: California
Has thanked: 6 times
Been thanked: 86 times
Contact:

Re: Ideas for PCAT

Unread post by MicroCoreLabs »

Also from reading wikipedia, it mentions that 386 embedded chips did not have real mode at all.

Could you please share where you found this?

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

MicroCoreLabs wrote: ↑Sat Jan 14, 2023 3:27 am

Could you please share where you found this?

Here you go:
https://en.m.wikipedia.org/wiki/Intel_80376

wikipedia wrote:

intended for embedded systems. It differed from the 80386 in not supporting real mode (the processor booted directly into protected mode) and having no support for paging in the MMU.

User avatar
Newsdee
Top Contributor
Posts: 830
Joined: Mon May 25, 2020 1:07 am
Has thanked: 98 times
Been thanked: 209 times

Re: Ideas for PCAT

Unread post by Newsdee »

Actually, it looks like the later 80386EX has full compatibility:
https://www.alldatasheet.com/view.jsp?S ... 3cEALw_wcB

User avatar
pgimeno
Top Contributor
Posts: 677
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 256 times
Been thanked: 208 times

Re: Ideas for PCAT

Unread post by pgimeno »

MicroCoreLabs wrote: ↑Sat Jan 14, 2023 1:08 am

Would a 80386 that only operates in real mode be interesting? Implementing protected mode is a heavy lift and DOS doesnt even use it...

DOS programs routinely used it. Version 2 of my Spectrum emulator was written to work in protected mode, initially with PMODE/W (a DOS4GW restricted clone) and later with a DPMI host like CWSDPMI, to enter and handle protected mode.

Things are different for a 286. Having a 286 with no protected mode would be useful IMO, as long as it supports the LOADALL instruction. Very few programs, if any apart from some from Borland and maybe Windows 3.x, used protected mode.

jordi
Posts: 238
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 95 times
Been thanked: 80 times

Re: Ideas for PCAT

Unread post by jordi »

It could be useful for games like 4ds stunts, and some tandy games that required powerful cpu.

Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: Ideas for PCAT

Unread post by Malor »

MicroCoreLabs wrote: ↑Sat Jan 14, 2023 1:08 am

Would a 80386 that only operates in real mode be interesting? Implementing protected mode is a heavy lift and DOS doesnt even use it...

Speaking of which, was the 386 widely used as an embedded processor? If so, was it used in real mode or was there a need for protected mode in embedded applications?

The biggest reason to use a 386 is the new protected mode, which allows virtualization, and indirectly, the various expanded memory managers, and early Windows. The 32-bit instructions would ultimately be more important, but they weren't strongly taken up by the market until the 486 era.

The 386 ended up being mostly about improving DOS, and having only real mode would pretty much chop it off at the knees for that purpose. It would make DOS faster, but not better. I mean, you could do it, but it seems like you're just making a very fast 8086. It might be easier to redesign the existing core to clock faster instead.

Post Reply