old PC emulator
category: general [glöplog]
the objective of the emulator is to do realtime showing of old demos. I'm not going to make emulation of processors newer than 486 for two reasons: a) my computer isn't fast enough, b) i don't think that currently i have the needed knowledge to emulate the Pentiums (and actually i'm not 100% sure about 486s, but i'll try). I'll try to add audio/video output, but at this time i don't know even how :P. Let me first to finish a working version of the emulator.
About the HDD stuff. I'm thinking to use those huge files for HDD and FDD too. It is possible to use real FDDs instead of files anyway, but i'm not sure how to access HDD. One solution is, after the emulated DOS is loaded, to hook some 21h functions for file handling. I think that this was easy for Amiga, because Amiga's OS is in the ROM (or i'm wrong? i don't know a bit about Amiga... :P).
anyway, thanks for the help...
About the HDD stuff. I'm thinking to use those huge files for HDD and FDD too. It is possible to use real FDDs instead of files anyway, but i'm not sure how to access HDD. One solution is, after the emulated DOS is loaded, to hook some 21h functions for file handling. I think that this was easy for Amiga, because Amiga's OS is in the ROM (or i'm wrong? i don't know a bit about Amiga... :P).
anyway, thanks for the help...
I haven't read all the threads yet, but I thought it again, I would love to help you if and when I find more time. Such a PC emulator is a thing I would love to see too, so why not? I tried to reached you through phone, but you had your mobile phone disabled. I will try again today...
Optimus
P.S. Several days before, I must have burned a 486 motherboard, cause I am illiterate according to hardware matters, ugh :(
So,. no 486 anymore to watch the old demos... :P
For the moment... cause my father has found me some old 286 and 486 M/B & CPU now! And I will get a box with gfx card and 386 and all from another friend..
I have also an old 8088 NEC with hercules lying in my village, hehe :)
But a PC emulator is a vital thing I beleive!
Speed is not a matter for the moment. I beleive and understand Bad Sector when he says that it has to start from the basic small things (Just emulating the 8088 and stuff first..) and I think we should have first a noble PC emul that works accurate and good, regadless the speed,. and in the meantime we will see about optimizing matters and emulation of more hardware. It is how other emul programmers starts. You first see a first exclusive release of a working GBA emul for example,. no matter how slow it is, it just matters that it works and runs the Bios, and some basic software,. and then you continue developping on that. Optimizing is after that perhaps... at least I think we should do it like this and later we will see..
Yep, I like the idea of starting small and making steady progress.. but of course it's good to keep in mind any future features that people might want to add, just to ensure that the decisions made don't impede future work. Of course this complicates design and can slow development to a halt if you spend all your time worrying.. so yeah.. do whatever :)
try to do your emulation so portable that it can be run on other platforms than pc too.
Badsector: you are really confused ... and you have missed the point ...
what is the point to emulate a cpu with an instruction set that is part of the instruction set of the current cpu !?! what kind of "emulation" is that !?
And then what? you are going to run dos on it? why not do so on the real cpu instead? the pentium4 will run every fucking instruction of the 8086...
What you need to do (which in the danger of sounding negative, I think you can't) is to trap the dos calls of the program and pass them to the appropriate win32 api functions, and handle the vga interrupts and outputs and do what you have to do with Direct Draw ... THAT is what you have to do to play dos demos under windows, not emulate the fucking cpu on the same cpu !
what is the point to emulate a cpu with an instruction set that is part of the instruction set of the current cpu !?! what kind of "emulation" is that !?
And then what? you are going to run dos on it? why not do so on the real cpu instead? the pentium4 will run every fucking instruction of the 8086...
What you need to do (which in the danger of sounding negative, I think you can't) is to trap the dos calls of the program and pass them to the appropriate win32 api functions, and handle the vga interrupts and outputs and do what you have to do with Direct Draw ... THAT is what you have to do to play dos demos under windows, not emulate the fucking cpu on the same cpu !
There is one (and *exactly* one) reason I'd see for emulating the CPU, and that's making the whole emulator cycle exact to get things like the early VGA-register-tweaking based demos to run, which required setting VGA registers on a per-scanline basis; such accurate timing is quite hard to get when running the whole thing in V86 mode.
However, I don't think that's TOO interesting at the moment; something that gives you GUS support, a working system slowdown and stable timing would be everything I want for now :)
However, I don't think that's TOO interesting at the moment; something that gives you GUS support, a working system slowdown and stable timing would be everything I want for now :)
I think a better reason to emulate it, is that you'll fail otherwise. If you don't get the full compatibility, you've failed.
It may sound like a stupid question but if you don't emulate the whole CPU, how do you just catch "in" and "out" instruction which were heavily used in the good ol' tweaked-mode days? How can you blindly execute old code using the host CPU and just having hooks for direct I/O instructions? I guess you have somehow to postprocess the code object or something? Or map the port-reserved memory range and monitor it on a regular basis? I'm not an emulation expert so that's why I'm just asking...
brioche, all these i/o etc dangerous stuff are privileged instructions and can be trapped by processor when it's running in user mode.
normally, you'll just see "general protection fault. program terminated. contact vendor" or something like that, but there's nothing stopping the os from faking all the stuff and returning to the program instead of terminating it.
normally, you'll just see "general protection fault. program terminated. contact vendor" or something like that, but there's nothing stopping the os from faking all the stuff and returning to the program instead of terminating it.
[quote]the pentium4 will run every fucking instruction of the 8086...[quote]
nuclear: that's not entirely true. there are subtle differences. the two that I remember are (it's been a while, i might be wrong on the details :)...
1) the behaviour of `push sp' has changed at some point.
(the order of updating the stack and changing sp _is_
quite important :)
2) on XT's you could do a sort of far jump with `pop cs'.
perhaps there are more of these peculiar changes.
nuclear: that's not entirely true. there are subtle differences. the two that I remember are (it's been a while, i might be wrong on the details :)...
1) the behaviour of `push sp' has changed at some point.
(the order of updating the stack and changing sp _is_
quite important :)
2) on XT's you could do a sort of far jump with `pop cs'.
perhaps there are more of these peculiar changes.
look...
despite what some people (cough*plek*cough) say, wouldn't we all like some sort of emulator that would render either our multiboot or oldskool extra pc purposeless?
I've seen plenty emulations of a PC with a "soundblaster inside" claim, but I'd be immortally happy if some guy would make an emulator (or a *really* dirty hack for the aforementioned emulators) to make things fly with GUS support.
I mean, I may have a collection of those red devils, but I'd sooner try to get my atari ST working again than multibooting into a legacy OS for 'that classic demo'.
despite what some people (cough*plek*cough) say, wouldn't we all like some sort of emulator that would render either our multiboot or oldskool extra pc purposeless?
I've seen plenty emulations of a PC with a "soundblaster inside" claim, but I'd be immortally happy if some guy would make an emulator (or a *really* dirty hack for the aforementioned emulators) to make things fly with GUS support.
I mean, I may have a collection of those red devils, but I'd sooner try to get my atari ST working again than multibooting into a legacy OS for 'that classic demo'.
I'm glad someone has undertaken the project... looks to me like the reason some of you never took it on is cuz you were too busy arguing over whether to emulate the cpu or not (:
Shouldn't virtual machine applications (like vmware) be enough to 'emulate' old pc's?
i assume they are slow/not very userfriendly (at least bochs isn't)/don't do the trick for demos which don't behave like word processors. also, soundcard emulation is an important part.
BadSector, I hope you succeed. A PC-emulator would be something really great, today's pc's doesn't work with old stuff like they should.. manufacturers today doesn't even seem to care if their graphic boards are 100% VGA-compatible anymore =) And most of the soundblaster-emulators are just pure shit. Works sometimes, if you're lucky.
About the question about emulating the CPU or not, have you all forgotten the Pentium 2 Pascal-bug? =) Patching all demos to run on a modern cpu doesn't really feel like something I want to do.
Also, I wonder, how will memory configuration work? I remember all the struggle to get just those extra kilobytes to make one program run, but then you realized that you had removed something that another program needed, and you had to make multiple config.sys/autoexec.bat-bootups with a menu to run everything. With emm386 or without, etc. This could be a lot easier with a config-screen in an emulator than running it on a "real" old pc.
Remember this, all soundcards like gus and sb are ISA cards. Most of the motherboards that are sold today don't have any ISA-slot anymore.
Well, BadSector, would be fun to try this emulator sometime soon, good luck =)
About the question about emulating the CPU or not, have you all forgotten the Pentium 2 Pascal-bug? =) Patching all demos to run on a modern cpu doesn't really feel like something I want to do.
Also, I wonder, how will memory configuration work? I remember all the struggle to get just those extra kilobytes to make one program run, but then you realized that you had removed something that another program needed, and you had to make multiple config.sys/autoexec.bat-bootups with a menu to run everything. With emm386 or without, etc. This could be a lot easier with a config-screen in an emulator than running it on a "real" old pc.
Remember this, all soundcards like gus and sb are ISA cards. Most of the motherboards that are sold today don't have any ISA-slot anymore.
Well, BadSector, would be fun to try this emulator sometime soon, good luck =)
If you want a complete emulation, there's already 'bochs'..
If you want to run "native", there's 'wmware' and 'plex86'.
It would be really nice to see 'plex86' on the windows platform!
If you want to run "native", there's 'wmware' and 'plex86'.
It would be really nice to see 'plex86' on the windows platform!
found this program http://dosbox.zophar.net/
dunno if it's any good though
dunno if it's any good though
last version i tested was pretty useless, but it's still in development, so it will probably get better with time :)
hey, this DosBox thing kinda works now... I can play Star Control 2 on it, although with garbled sound, but still...