OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:37 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: an 8086 PC emulator
PostPosted: Wed Jun 15, 2011 2:11 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
hi.. this is something i've been working on for the last 6 or 7 months, open-source written in C from scratch. it's a PC emulator that current supports every 8086 instruction, and nearly every 80186 instruction. there is much work left to do, but if anybody is interested you can check it out here

http://fake86.rubbermallet.org
^win32 build plus source .tar.gz for linux are available :)

screenshots are there too, so you can see exactly what it's capable of so far. also, i've written it all myself so far but if any other devs are interested in teaming up with me on it i am open to that if you've got emulation skills. one thing i'm currently interested in, in particular, is somebody with really good knowledge of an ethernet adapter interface such as NE2000 since i would like to add support for one using pcap.

i'd love comments, suggestions, flames, etc. if anybody has the time and interest to take a peek.


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Wed Jun 15, 2011 5:20 pm 
Offline
Member
Member
User avatar

Joined: Thu Feb 14, 2008 10:46 am
Posts: 277
Location: Italy
HI! Wow good job, I tried it only with the rom bios but it seems to work well :)
I'm also developing an emulator (a 80386 emulator) for my operating system (so I will be able to analize the kernel in the kernel itself with the debugger. Good luck :)


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Wed Jun 15, 2011 7:58 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
Karlosoft wrote:
HI! Wow good job, I tried it only with the rom bios but it seems to work well :)
I'm also developing an emulator (a 80386 emulator) for my operating system (so I will be able to analize the kernel in the kernel itself with the debugger. Good luck :)


both the source and win32 bin packages come with a custom freedos install floppy image in the image\ folder if you wanted to play with it more. how far along is your emulator?


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Wed Jun 15, 2011 9:23 pm 
Offline

Joined: Sat Mar 10, 2007 1:05 am
Posts: 15
i test the emulatorfailed.(the kernel run well in bochs 2.3.6 and qemu(0.10.2 and 0.14.1)).
command: fake86.exe -fd0 image\floppy.img -boot 0

Image


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Wed Jun 15, 2011 9:46 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
nope, that is what i expect would happen actually. your kernel looks 32-bit. Fake86 only emulates an 8086 which is a 16-bit CPU. the same thing would probably happen if you booted that floppy on a real 8086 or 8088 computer.

thanks for having a look though. :)

if you tried running your kernel again, but add -verbose to the command line, you'll probably see your console window littered with a flood of "Illegal opcode ##" messages.


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 8:58 am 
Offline
Member
Member
User avatar

Joined: Sat Jul 17, 2010 12:45 am
Posts: 487
Great! If you could just add 80386 emulation, it would be excellent.

Good job.

_________________
Programming is not about using a language to solve a problem, it's about using logic to find a solution !


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 9:35 am 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
Well, darn, this looks better than my RME project :( Well done.

Just a question, what techniques/programs did you use to debug it?

Also, is it designed to be realmode only, or strictly 8086? I tried running FreeDOS (balder10.img) and DOS 6.22 (boot622.IMA) with it, and both froze.

[edit] If you run FreeDOS, it hard freezes, and stops responding to Ctrl-C and close (Linux 2.6.38)

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 10:09 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
Chandra wrote:
Great! If you could just add 80386 emulation, it would be excellent.

Good job.


i would love to add 386 support eventually. i didn't want to make it that complex when i started on it. it definitely would be cool to see it booting linux or win95/NT.


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 10:22 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
thepowersgang wrote:
Well, darn, this looks better than my RME project :( Well done.

Just a question, what techniques/programs did you use to debug it?

Also, is it designed to be realmode only, or strictly 8086? I tried running FreeDOS (balder10.img) and DOS 6.22 (boot622.IMA) with it, and both froze.

[edit] If you run FreeDOS, it hard freezes, and stops responding to Ctrl-C and close (Linux 2.6.38)


what's RME?

and it is strictly 8086 plus nearly all 80186 instructions. as for DOS 6.22, i'm aware of the problem actually. MS-DOS 3.2 and newer will hang when booting. i'm pretty sure it has something to do with my int 13h emulation. still trying to hunt that bug down.

with FreeDOS, the latest version uses a kernel with 286 opcodes. you'd have to recompile it for 8086, and then it would work. there is a slightly older version of it on the floppy image that i included in the download, and it works properly. i fixed the hard freeze, and it won't happen in the next version. what was happening is that if it executed a HLT, it was changing the window title to "Fake86 [halted]" and then the IP remains on that instruction... so it was changing the window title on every single instruction which made the window quit responding.

it also works with DR-DOS (tested up to 7.03)

running FreeDOS:

Image

Image




btw, last night i started writing code to emulate the adlib. still a lot of work to do on that, but it basically is working already

http://rubbermallet.org/fake86.mp3 <--- from playing ultima 6 in the emu


Last edited by miker00lz on Thu Jun 16, 2011 11:03 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 10:36 am 
Offline
Member
Member
User avatar

Joined: Thu Feb 14, 2008 10:46 am
Posts: 277
Location: Italy
RME is a real mode emulator ;)
I'm writing the emulation layer of many basic devices like PIC, PC speaker and so on :)


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 4:54 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
Karlosoft wrote:
RME is a real mode emulator ;)
I'm writing the emulation layer of many basic devices like PIC, PC speaker and so on :)


ah, yeah gotcha. maybe i can help you with some details if you need it. let me know and i might be able to help.


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 5:09 pm 
Offline
Member
Member
User avatar

Joined: Thu Feb 14, 2008 10:46 am
Posts: 277
Location: Italy
The same for me :) If you have question that I may know I'll be happy to answer :)


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 8:53 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
(not the hijack the thread or anything)

RME (which is my Real-Mode only emulator, designed to replace VM8086 in 64-bit OSes) is currently at the "step though and compare to bochs" debugging phase, trying to iron out those tiny behavioural bugs.

If you have a different testing image to the ones that I mentioned, it would be appreciated.

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Thu Jun 16, 2011 9:57 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 08, 2010 3:16 am
Posts: 144
Location: St. Louis, MO USA
what i used a lot was emu8086 (http://www.emu8086.com) which has a built-in assembler and the best 8086 debugging interface i've ever seen. (its a windows-only program, it'll probably work fine in wine if youre on linux) i also compared output of some of my instructions with a real 8088's output. some of the trickiest stuff was getting flag calculations correct, especially on the bitshifting instructions.

i'm very confident in my CPU core now, everything i throw at it matches up with the real thing so you can peek at my code if you want. i also wrote a little test utility in assembler that checks and verifies all addressing mode calculations. it's on another one of my computers here, let me know if you want it.




alsooooooo... i added attack and decay to my adlib code http://rubbermallet.org/fake86-adlib(attack-decay).mp3

the only big thing left to do with adlib is add the percussion stuff.... not sure quite how to go about that.


Top
 Profile  
 
 Post subject: Re: an 8086 PC emulator
PostPosted: Fri Jun 17, 2011 4:46 am 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
If you could provide that test program, that would be lovely. I hope to have this running DOS sometime soon :)

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 31 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group