VOGONS


MartyPC

Topic actions

Reply 180 of 182, by keenmaster486

User metadata
Rank l33t
Rank
l33t

The IBM AT will refuse to POST if your 286 is running above 8 MHz due to an artificial BIOS limitation. IBM didn't want people overclocking their ATs.

World's foremost 486 enjoyer.

Reply 181 of 182, by GloriousCow

User metadata
Rank Member
Rank
Member
jal wrote on 2024-05-15, 06:13:

I think the main problems are 1) the whole protected mode shenanigans (though you could just forego on that) and 2) that there isn't a single standard 286 like the 8088 was. There's countless manufacturers and clock speeds (6 MHz up to 25MHz), so there's not one single target.

Clock speed of the CPU doesn't really matter so much - it affects wait states, but for an instruction that doesn't access the bus, 10 clock cycles is 10 clock cycles. The CPU doesn't even have to know how fast it is. Right now if you mush the turbo button on an XT in MartyPC it will run the 8088 at ~7Mhz with 0 wait states, but it would theoretically still be completely accurate to that speed, assuming you had fast enough RAM. Eventually I will have RAM response times in machine configurations, and I'll be able to calculate the appropriate wait states based on the CPU frequency and response time, recalculating on clock changes. You could always specify some mythical 0ns RAM if you didn't ever want to have wait states.

As for 286 protected mode, figuring out all that stuff interests me, so I'll probably do it. Otherwise I could just implement V20/186 and call it a day.

It is true that as we enter in on the 286 and beyond the proliferation of steppings and CPU versions and 3rd party chipmakers increases dramatically, so there's no one clear target to be "cycle-accurate" to. I somehow doubt we'll ever see a 286 demo with perfectly cycle-counted effects like we saw in 8088MPH and Area 5150. So a cycle-perfect 286 emulator will probably never be necessary to run any software that can't otherwise be emulated. But I don't think that makes the endeavor useless - it's still academically interesting and potentially useful for programmers. The CPU I will probably be using in my validation work is a Harris 80c286. So assuming I can pull it off, you'll basically get that specific CPU in MartyPC.

Also, paradoxically, as CPUs get faster the problem almost becomes easier because the microcode gets more capable and thus shorter. DIV on the 8088 is a nightmare to implement; but if you look at a CPU with division hardware like the V20, it's much simpler.
Would you rather emulate the instruction on the left, or on the right?

F7.6_histogram.png
Filename
F7.6_histogram.png
File size
50.26 KiB
Views
123 views
File comment
DIV: V20 vs 8088
File license
CC-BY-4.0

MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc

Reply 182 of 182, by jk3one

User metadata
Rank Newbie
Rank
Newbie

Would you rather emulate the instruction on the left, or on the right?

Well, I wouldn´t know where to begin in either case 😀 but even I can see that the right one has a result after a short while. So yes! Fascinating stuff.

Ah no, I didn´t read the diagram correctly. Plenty of additional stuff on the right side. I´ll take the left one!