• Please review our updated Terms and Rules here

8086 emulator tech discussion

Mike,
The forum on your fake86 site is getting spam infested.. it's those 'payday loans' (groan) posters that used to vandalize the old vcforum here.
-Tor (we need a global task force to hunt down spammers. Physically.)
 
ACK! thanks Tor. dammit, i hate that. is there some way to punch somebody in the face over TCP?
 
Hallo Mike,


hmm, well i've tried 5150/5160 ROMs and they freak out and halt because i don't have the DMA controller emulated... at least i think that's why, but it can run ROM BASIC..
I just wrote a PM to you (before I found this thread) because I wasn't able to fire up my own BIOS under FAKE86 and I wondered why. If the above is the answer, why does your BIOS work fine? If it has no DMA support onboard, then tell me why it also works fine on a real IBM board?

Other questions:
- is it possible to compile your sources under DOS/Windows?
- would you mind me porting it to FreePascal?

Edit: forgot to mention I have the source files of my own BIOS available. I also re-engineered the IBM BIOS (only upper 8 KB), if interested....

I hope to hear from you soon!


Groetjes, Ruud Baltissen
www.Baltissen.org
 
Last edited:
Hallo Mike,



I just wrote a PM to you (before I found this thread) because I wasn't able to fire up my own BIOS under FAKE86 and I wondered why. If the above is the answer, why does your BIOS work fine? If it has no DMA support onboard, then tell me why it also works fine on a real IBM board?

Other questions:
- is it possible to compile your sources under DOS/Windows?
- would you mind me porting it to FreePascal?

Edit: forgot to mention I have the source files of my own BIOS available. I also re-engineered the IBM BIOS (only upper 8 KB), if interested....

I hope to hear from you soon!


Groetjes, Ruud Baltissen
www.Baltissen.org

hi, hmm.... i'm not sure exactly why your BIOS won't boot in fake86. i'm sure it could be many different things. the environment fake86 emulates is definitely not as complete as the real PC/XT architecture (at least not yet) but it's "close enough" to run just about any old 16-bit DOS software.

and yes, it will compile fine under windows using mingw. i've been doing all of the coding for it on windows using the dev-c++ IDE. i haven't tried this in windows since the IDE takes care of it for me, but i'm pretty sure using this command line will do it if you navigate to src/fake86 from the tar.gz:

gcc.exe src/fake86/*.c -o fake86.exe -O3 -lmingw32 -lSDLmain -lSDL -lwinmm src/fake86/lib/Packet.lib src/fake86/lib/wpcap.lib

you probably will also need to tell it where your compiler's include and library files are. if it doesn't work you might have to add -D_WIN32 but that should already be pre-defined by the compiler.

now as far as under DOS, lol... well, a while back i actually did trim out a bunch of code, make a few changes, and compiled it under turbo c++ 3.0, and then ran it on my XT. it DID run, but it took about 3-4 minutes just to finish POST. ;)

go ahead and do whatever you want with the code too. porting is fine with me.
 
Hallo Mike,

hi, hmm.... i'm not sure exactly why your BIOS won't boot in fake86. i'm sure it could be many different things.
Just before answering your message, I got the bright idea to test six other real 8 KB BIOSes. Of those six only one gave some result: in a flash I saw the pre-boot screen and then the screen went bizerque. The rest was just a black screen :(
My question: how did you get this BIOS? If made by someone, are the sources available?

Many thanks for your advice about MINGW and for your permission to port FAKE86!


Groetjes, Ruud Baltissen
www.Baltissen.org
 
Hi Mike, I just wanted to post my thanks for producing fake86.

Although I'm sure not your design goal, I've been using it to help with development of code for detailed testing an XT-IDE board - means I can code on the netbook, drop exe's into a VHD and test via fake86 (from the comfort of the sofa!), then when everything is square write the image to a CF card, pop out to the workshop to run on real hardware. No problems with it so far!
 
RuudB: i didn't notice your post until now, sorry. the BIOS is the one from phatcode.net, unmodified. most other BIOSes probably aren't going to like fake86 much.

pearce_jj: i enjoy hearing when people actually find a use for my stuff. :)

actually part of the design goal was to be able to write and test software in it! seriously glad it's working correctly for you. i'm curious, how are you testing XT-IDE code in it though? it doesn't emulate the XT-IDE or other IDE controller.
 
Hi Mike, my simple test program is all file system based, so no need for any particular hardware support. As an aside, being able to reduce the amount of RAM in fake86 would be very handy, if you're tinkering with it at any point :)
 
pearce_jj: i will definitely include that option in the next release, which will probably be within a few days. i've also got a new feature that lets you limit the emulation speed. it frees the host CPU when not needed too.


just fixed a huge bug where the PIT countdown registers were never updated. it wasn't a problem for most programs, but some out there like MINIX 2 and the game Jetpack for DOS used direct reads of the countdown register to handle timing rather than hooking the timer interrupt. they, and other apps, work now. various other smaller bugs have been fixed as well, and i've managed to get some minor increases in emulation speed.

i've started adding support for 80386 protected mode, but that probably won't be working right for a while. it's pretty complicated.

fake86-minix-cc.png


^minix 2.0.2
 
fwiw, i just recompiled the whole MINIX 2.0.2 kernel inside MINIX, running inside fake86. there is quite a bit of source code to it. the resulting binary is identical to the pre-supplied kernel. that says good things about my CPU emulation! :)
 
All good stuff!

As you're extending it i386, perhaps there could also be command line options to select which chip it's going to be (086,186,286,386). Although I guess that could add a lot of complexity, not least in terms of getting the various CPU bugs in there.
 
Just a point of curiosity, Mike.

Do you offer settings in your emulator that affect behavior of CPU-sensitive instructions? For example, can I select between 8088 and 80286 behavior on "PUSH SP"? I've noticed several older bits of code that have their own little tests for CPU type.

Is it possible to execute a piece of code under the assumption that a certain CPU is being used and then have the emulator stop and point out an illegal instruction?
 
Just a point of curiosity, Mike.

Do you offer settings in your emulator that affect behavior of CPU-sensitive instructions? For example, can I select between 8088 and 80286 behavior on "PUSH SP"? I've noticed several older bits of code that have their own little tests for CPU type.

Is it possible to execute a piece of code under the assumption that a certain CPU is being used and then have the emulator stop and point out an illegal instruction?

i actually don't have an option to do that, but it was something was considering. it could get complicated. speaking of such things, this is still one of the biggest questions i have. how many little details are involved in making the emulator to appear exactly like a certain CPU?

for example, at some point i apparently changed the code in a way that makes PKUNZIP.EXE think it's a 386 CPU, and since i am not emulating that yet it hangs unless i run it with the "-3" argument to make it not use 32-bit instructions. i really do not have any idea what change did it.
 
There are several articles about how to tell one CPU from another--as I recall, there are some easy tests based on status register bits, so maybe that's what doing your fake 386 in.

The 8088/8086 test is usually done this way:

Code:
    push    sp
    pop     ax
    cmp     ax,sp

An 8086/8088/V20/V30 (that surprised me!) will return the zero flag clear, as those CPUs decrement SP before pushing it. All other CPUs will have ZF set.
 
There are several articles about how to tell one CPU from another--as I recall, there are some easy tests based on status register bits, so maybe that's what doing your fake 386 in.

The 8088/8086 test is usually done this way:

Code:
    push    sp
    pop     ax
    cmp     ax,sp

An 8086/8088/V20/V30 (that surprised me!) will return the zero flag clear, as those CPUs decrement SP before pushing it. All other CPUs will have ZF set.

i was aware of that one, and fake86 does do it that way. i think there are probably a few ways to tell the different CPUs apart.

the BIOS i'm using thinks it is running on a V20, which is actually the closest real-world CPU to what i am emulating. PKUNZIP thinks it's running on a 386, and PC Certify Pro thinks... well, see for yourself:

fake86-pcpro.png


:p

the string and exception tests fail of course because it's trying to use 32-bit string ops, and it's testing 386+ specific exceptions. it just locks up if i try the register or logical ops tests.

so, clearly i need to do some research to fix this...
 
Thanks for the info.

What I'm after is a real productive use for Fake86--identifying code that will not run under an 8086/8 and working out patches. In most cases, this is a matter of a few instructions sprinkled here and there. Right now, the only method to do this is to disassemble the code looking for non-8088/6 instructions.

Alternatively, is anyone aware of a hardware add-on to an 8088 that will NMI on an illegal instruction? Can I do this with Soft-ICE?
 
I have no skill to add but just to mention that this would be very handy, for example the 8-bit compatible PnP SoundBlaster cards I believe need V20+ CPU to run the config utility, so can't be used in 8088/8086 CPU machines. Would be nice to tweak that utility to run on 8088.
 
ah, finally fixed the problem where a lot of VGA games wouldn't show stuff on the screen. somehow, i neglected to add code to READ palette data from the VGA DAC. :facepalm:

everything works great now. the intro sequence to Ultima 6 was one of the things that didn't work right. Where in America's Past is Carmen Sandiego was all screwed up too. both work perfectly now.

check out the vid cap of the U6 intro, and you can hear the very improved adlib emulation too. :)



now, if i could just figure out the damn planar VGA and EGA modes.
 
Back
Top