flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > EPC - 80186 emulator

Author
Thread Post new topic Reply to topic
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Image

EPC is an emulator of PC-XT and similar computers.
It simulates one of 8086,8088,80186, 80188, NEC V20 or NEC V30 CPUs, with 80286 potentially planned, and can run many older DOS programs and early PC games.

Here is the emulator itself and pc-dos 4 image, rather empty without the next file:
http://orbides.1gb.ru/ape/epc-win32-101120.zip (1Mb)
(Patch, described in post 3: http://orbides.1gb.ru/ape/epc-win32-101120-p1.zip )

And there is a collection of cpuid tools, utils, programs and some games:
http://orbides.1gb.ru/ape/epc-moreprogs-101120.zip (2.2Mb)

Why make it?
Bochs emulates all the modern stuff, Qemu aims at running programs, DosBox aims at running games.

In my case, the cut-off is around 80286, maybe a little lower if 286 turns out to be too hard.
At that time the x86 architecture were the most consistent and clear, in my opinion.

I want to make an emulator for the hardware of that era, bugs and oddities included (And learn how all that hardware worked).


So, is there anything like it already made?
Would anyone want it?
What would you like to see in it?
Does it even work for you?

Feedback is welcome.


Last edited by Artlav on 20 Nov 2010, 18:52; edited 2 times in total
Post 20 Nov 2010, 14:30
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
So, how do you handle "POP CS" on various CPUs?

(Obvious reference to this topic) (also, this)
Post 20 Nov 2010, 15:42
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Interesting.
I missed MOV CS,xxxx entirely.

About pop cs - it's valid on 8086/8, generates int 6 on NEC's and 186.

I couldn't find any solid information about how 8086 handle the rest of the invalid opcodes, apparently some of them are handled as IP+2 and some more are "ignored".

So if someone have a genuine PC-XT to test on, or a descriptive manual, that would be the feedback i welcome.
Post 20 Nov 2010, 16:33
View user's profile Send private message Visit poster's website Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Just in case, here is a small patch, incorporating a few recent discoveries:
http://orbides.1gb.ru/ape/epc-win32-101120-p1.zip (Over 101120)

-Fixed mov cs,... on various CPU's
-Fixed irq and mov ss,xx on various CPU's
-Fixed NEC not using AAD base, putting 10 always
-Fixed NEC misdetection thru 8086 interrupt bug
-Added CMOS 8086

Now all CPUID tools capable of it tell NEC and intel CPU's apart precisely.
x88 against x86 is not so clear yet, the only way to tell them apart is the prefetch queue length, and how prefetching work i'm researching only now.
Post 20 Nov 2010, 18:28
View user's profile Send private message Visit poster's website Reply with quote
Ninho



Joined: 07 May 2010
Posts: 16
Ninho
If, and when, you go along and start coding the 80286 emulation, I suggest you contact me (private msg on this board) for a few tips on some undocumented or falsely documented behaviour of the proc.

I communicated some of the stuff to Ralf Brown 10 years ago or so, for eventual corrections to the interrupt list, e did acknowlege but unfortunately stopped updating his lists and that was never published.

Haven't checked your EPC yet, though I don't doubt it is nice and all. What language is the emulator itself coded in ?
Post 29 Jan 2011, 16:42
View user's profile Send private message Reply with quote
Ninho



Joined: 07 May 2010
Posts: 16
Ninho
Artlav wrote:

x88 against x86 is not so clear yet, the only way to tell them apart is the prefetch queue length, and how prefetching work i'm researching only now.


Look for Robert Collins's old pages ( at x86.org if memory serves) for hints on how prefetching works on 286 versus 386. 8086/88 are simpler yet, you'll get the idea of the mechanism involved in both prefetch and predecode queues, and how to measure those experimentally by self modifying code - you need working microprocessors in order to do the actual tests, of course. I think I remember queue lengths (without details on their actual workings) were stated on old documentation, you d'have to look for old printed or archived on the web Intel manuals/books.

If your goal is a very accurate simulation of the prefetch mechanism (possibly not necessary), you must know for each processor type, at least :
- the prefetch queue length in bytes
- access width (surely, 1 byte on 8088/ 2 bytes on 8086)
- "low water" height, when to trigger a prefetch (assuming bus available)
- the predecode queue length (if any)
- low water height for transferring from prefetch to predecode
- possibly more... none of which were ever documented by Intel or competitors (but see R. Collins's notes)

HTH
Post 29 Jan 2011, 16:56
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Ninho wrote:
If, and when, you go along and start coding the 80286 emulation, I suggest you contact me (private msg on this board) for a few tips on some undocumented or falsely documented behaviour of the proc.
That would be useful.
Not sure when i'll get to it, so i'll appreciate if you can send your notes over, whenever you ready/want.

Ninho wrote:
What language is the emulator itself coded in ?
Modern pascal.

Ninho wrote:
Look for Robert Collins's old pages ( at x86.org if memory serves) for hints on how prefetching works on 286 versus 386. 8086/88 are simpler yet,
Good. I think i'll already figured it out, will check that if i can.

Here are the newer files, the emulator itself: http://orbides.1gb.ru/ape/epc-110128.zip (2.8 Mb)
And the HDD image: http://orbides.1gb.ru/ape/epc-hdd.zip (54 Mb)
-80186/80188 difference is now emulated, if one wants.
-Loose emulation supported, which drops some precision for speed
-Windows 3.0 works, many more programs work

Comments are welcome, as usual.

Ninho wrote:
If your goal is a very accurate simulation of the prefetch mechanism
Even the difference between 8086/88 is only detectable by a very fine CPU type detection program, so it's probably safe to draw the bottom line at prefetch queue length.
Post 29 Jan 2011, 17:43
View user's profile Send private message Visit poster's website Reply with quote
JavierDonoso



Joined: 24 May 2011
Posts: 1
JavierDonoso
Don't forget to add 486 and Pentium emulation! Smile
Post 24 May 2011, 21:06
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
JavierDonoso wrote:
Don't forget to add 486 and Pentium emulation! :)
Not worth the effort and not attainable in foreseeable time. :(

I'm working on 286 now, and that is the ceiling of what this emulator would be able to do.
Even 286 is somewhat pointless - i'm at loss to find any software that would be using it's features extensively.
Post 26 May 2011, 12:37
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Didn't Windows 3.x use 286 protected mode?
Post 26 May 2011, 13:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Windows 3.0 runs on 8086, so i guess no, not necessarily.
Haven't tried 3.11.

But with 286 enabled, 3.0 starts using the protected mode, so i guess it can use both. No luck yet running it in PM however.

I should have said commented and documented software that uses 286 is hard to find. Reverse-engineering and making the emulator at the same time is a bit tricky.
Post 26 May 2011, 17:47
View user's profile Send private message Visit poster's website Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Win 3.0 optionally ran in three modes: 8086 (real mode), 80286 (task switching only for DOS though Win16 apps could cooperatively multitask), 80386 (386 extended pmode w/ multitasking DOS sessions). Win 3.1 was 286/386 only, and 3.11 (aka, WinForWorkgroups?) was 386 only. The internals of Win 3.x used DPMI 0.9 / 16-bit [sic] to implement its stuff.

Artlav, I did respond to you in the other thread almost a month ago, but it here sounds like you didn't even see it (oops). I know it's not much help but better than nothing! Smile
Post 26 May 2011, 17:53
View user's profile Send private message Visit poster's website Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav
Sorry, apparently lost to backlog as well. Sad
Thanks for the examples, i'll look at them.
Post 26 May 2011, 18:02
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.