|
486 Emulator - Help to generate binary |
RmBeer2
Member #16,660
April 2017
|
I have programmed a 486 Emulator, with totally invented hardware. It interprets the basic bytecodes and it works very very well (although I suspect that it has some hidden bugs), it is still missing MMX, SSE and all the weird ones, but for the moment it is fine, I'll leave it for later. I plan to use it to allow any programmer to create games and other programs using the C or C++ language (gcc/g++), although it is also possible to use ASM (as), it will be connected to the game server to consult certain information (users, players, scores, avatars, game/program resources, etc). The problem is that I have not managed to get the gcc cross-compiling to create the pure plain binary file without format like ELF or PE. At the moment I am creating a user interface using my own FS (fuse), so anyone can upload the game/program binary files directly and create their own client just by managing files and directories. πππ π BlackRook WebSite (Only valid from my installer) π C/C++ π GNU/Linux π IceCream/Cornet π πππ Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Rodolfo Lam
Member #16,045
August 2015
|
I don't know if this can be of any help, however it looks that you could use the guides available to make new GCC backends. I found this in the net for you: Writing a GCC back end You could also try with extracting the machine code from the generated *.o files. Kinda like using raw/flat binaries. I did this google search. Again, I might be totally lost on this... It is definetly out of my league. Good Luck with that!
|
Polybios
Member #12,293
October 2010
|
I briefly (!) dabbled with stuff like this many years ago (so take it with a grain of salt). Basically, I loaded and executed some simple ELF files. It's quite simple to write a loader for ELF if you don't need dynamic linking. The main advantage compared to flat binaries is that you can load them to any target address, but you need to process relocations when loading. I'd also strip all debug symbols before loading them at first (but you could even make use of them later...). I'd recommend starting with a simple binary without a standard lib ("freestanding"). For compiling C files with GCC, the options -ffreestanding -fno-builtin -fno-stack-protector might be relevant. If you want a working C std lib, things become a little more complex, since you need to implement syscalls, e.g. for malloc / heap management to work, you typically need some variant of "sbrk". Basically, you need a kernel of some sort. As I understand, you aim for flat binaries to be loaded like it was a kind of ROM cartridge? So you'd probably need to link your kernel layer into every binary. Of course, you could also provide a minimal kernel that your adapted C std lib can call or you could even use dynamic linking for that, too. Producing raw binary files is possible with ld, too, here are some hints: Here are some related resources that might be interesting: Edit: Forgot the first important step: you'll need to build a cross-compiler that can compile to a generic i486 target. Some advice about that here: |
Arthur Kalliokoski
Second in Command
February 2005
|
RmBeer2 said: a 486 Emulator, with totally invented hardware. It interprets the basic bytecodes and it works very very well (although I suspect that it has some hidden bugs), it is still missing MMX, SSE and all the weird ones MMX didn't come out until a couple of revs of the Pentium 1, SSE didn't come out until the Pentium 3. They all watch too much MSNBC... they get ideas. |
Chris Katko
Member #1,881
January 2002
|
If you haven't commited yet, implement 386 first. 486 has lots more opcodes and modes. Ignore pentium opcodes unless you plan on supporting Windows. Because there's "almost" zero pentium games for DOS. Quake 1. Many games had a pentium option (Tyrain) but meh. -----sig: |
Arthur Kalliokoski
Second in Command
February 2005
|
Chris Katko said: Because there's "almost" zero pentium games for DOS. Quake 1. Actually I used to run the Quake 1 shareware episode on a 486, but it only got maybe 8 frames per second at the lowest resolution. I think the actual requirement was a real '87 chip. They all watch too much MSNBC... they get ideas. |
Chris Katko
Member #1,881
January 2002
|
Quake 1 doesn't require a pentium but it's ... pretty much required. John Carmack got "big" into the fact the Pentium chip had two pipelines. The integer and floating point pipelines were separate, so he coded the entire game micro optimized around that fact. Playing on a 486 "works" but is, as you've seen, dog crap slow because the 486 doesn't have two pipelines and every float basically explodes the timing. I can't remember the source but it's burned into my memory. It might have been the Joe Rogan podcast interview, but it seems like that would have been far over Joe's head. Fun fact: The fact that non-Intels had very poor floating point performance basically killed all competiting brands of 486's. (RIP Cyrix) Quote:
John Carmack: The floating-point issue has really hurt them. We had [the link is broken but I could still download it. so I'll just post the PDF as an attachment] I think the "FXCH trick" is the one that requires a pentium to load essentially two instruction streams [integer + float, "I and U" or "I and V" pipelines] at once. [1] References-----sig: |
RmBeer2
Member #16,660
April 2017
|
There are interesting documentations. But it wasn't what I was really asking for, I was letting you create the tools to create the necessary binary. After all, they are interested in making a game. If this is not possible. Maybe later I'll do an ELF to pure binary converter. In a few days I will release the basic header along with the interrupt guide. ============================= πππ π BlackRook WebSite (Only valid from my installer) π C/C++ π GNU/Linux π IceCream/Cornet π πππ Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
Polybios
Member #12,293
October 2010
|
RmBeer2 said: But it wasn't what I was really asking for, I was letting you create the tools to create the necessary binary. After all, they are interested in making a game. I don't really get what you are asking. So who is "you" and "they" here? |
RmBeer2
Member #16,660
April 2017
|
How I'm to know? there are no exact translations, especially with personal pronouns. you == they, or "you+they" what's "tu+ellos" in "ustedes" from spanish, that "ustedes" not have translation. also google translator confuse "I" with "you". EDIT ========================== I also understand that "ustedes" is a more polite way of referring to someone, which is also lost. πππ π BlackRook WebSite (Only valid from my installer) π C/C++ π GNU/Linux π IceCream/Cornet π πππ Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
DanielH
Member #934
January 2001
|
Clearing confusion: RmBeer2: he wasn't asking for translations but what "I" and "they" represent "I" refers to RmBeer2 |
bamccaig
Member #7,536
July 2006
|
Bump. Get to work, OP. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
RmBeer2
Member #16,660
April 2017
|
This is going to have to wait another week until I get something to talk about. Still missing to be published. Even if it goes into production, it will still be like a demo, a beta far from being complete. EDIT ============================ I have decided to leave FS and continue with the client of the terminal. What I want is to focus on what matters most and finish with the Emulator to be used by everyone. For several days I have also been diverted by ffmpeg. This only involves delays. πππ π BlackRook WebSite (Only valid from my installer) π C/C++ π GNU/Linux π IceCream/Cornet π πππ Rm Beer for Emperor 2021! Rm Beer for Ruinous Slave Drained 2022! Rm Beer for Traveler From The Future Warning Not To Enter In 2023! Rm Beer are building a travel machine for Go Back from 2023! Rm Beer in an apocalyptic world burning hordes of Zombies in 2024! |
|