![]() |
|
i know kigb is a game boy/gbcolor emulator |
BAF
Member #2,981
December 2002
![]() |
but how do i make a gameboy advance emulator" how do i go about making an emulator??? |
Thomas Harte
Member #33
April 2000
![]() |
A genuine emulation of the hardware? Not too tricky: - get a list of all the logic bearing components in the GBA If the thing you want to emulate is quite fast compared to the thing you want to emulate on, you'll need to start cheating. The common technique is to identify the 'prime' component of a system and focus your emulation around that. The prime component of a GBA is the ARM CPU. You'd then write code which fetched, decoded and executed ARM instructions. If you really had very little regard for accuracy whatsoever you might then do something like perform ARM instructions for the number of cycles it takes for one iteration of the display to be drawn, then take a break to update the display, then return to doing the CPU stuff. A better implementation might do a similar thing but run the CPU for as long as it takes one scanline to appear, then draw the scanline. And so on. If you are lucky you'll get a system whereby the components external to the prime component have only fixed effects upon it (i.e. interrupts always at the same time, timing always affected in the same way...), in which case cheats like the above can be made to be very close to the way the real hardware is working. [My site] [Tetrominoes] |
spellcaster
Member #1,493
September 2001
![]() |
Get the hardware specs. -- |
Thomas Harte
Member #33
April 2000
![]() |
Be aware that often you will not derive a fully accurate model from just registers, opcodes and opcode cycle length information - on almost all computers other factors affect timing and therefore other implicit elements of interaction. For example, on a GBA (and most things), the timing for memory which describes the display is different than that elsewhere. It may also be dependant upon exactly what the display chip is doing at the time (although it may not be, I know nothing of GBA specifics). Furthermore, well written software might exploit these differences to achieve effects that might not otherwise be possible - especially on the messed up 80s style 'sprite lists' that Nintendo still cling to. An example from another platform is a particular ZX Spectrum game which exploits the way that RAM refresh is internal to the CPU in order to starve the video display circuits of memory access and selectively create a noise effect on screen. [My site] [Tetrominoes] |
Johnny13
Member #805
October 2000
![]() |
Quote: but how do i make a gameboy advance emulator Alg3D Praise my Games!!<code>#define SPAMMER (post>=666&&postperday>=6)</code><Mr.spellcaster>What post? <Mr.spellcaster>A useful post by me. |
BAF
Member #2,981
December 2002
![]() |
osunds tricky... |
Mars
Member #971
February 2001
![]() |
What did you expect, an emulate_system() function that you'd pass a SYSTEM_GBA constant and a "super_mario_advance.gba" filename? -- |
Thomas Harte
Member #33
April 2000
![]() |
The GBA is actually one of the easier to emulate. It had only one CPU and simple timing rules and non-CPU hardware. Additionally the CPU is quite slow and best of all is a proper RISC design, meaning that everything about it is simple. If you wanted to make life hard, you might have a bash at dynamic recompilation! I keep meaning to do this, but my primary project continues to take up the majority of my time. [My site] [Tetrominoes] |
BAF
Member #2,981
December 2002
![]() |
hehe. humm, what exactly is dynamoc recompilation? Sounds hard:-/ |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Bobby: Its a concept thats an order of magnitude harder to comprehend than "Copy & Paste". Quote: dynamoc
-- |
Carrus85
Member #2,633
August 2002
![]() |
Dynamic Recompilation- Recompiling Dynamically Not that easy to implement, I would imagine. Essentually what you do is recompile the rom into an easily read/understood form so you can execute it easilier. But, to do this effectively, you would probably have to write some form of a custom compiler... which, I'm sad to say, I have ZERO experience in. FYI: Do we really need to turn this into a flame, people? Don't turn it into a flame.
|
X-G
Member #856
December 2000
![]() |
You compile it to native code on whatever platform you're running on. -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
From what I've learned (could be wrong), Dynamic Recompilation is somewhat akin to JIT, where at runtime, you convert the code to native opcodes and run on the host cpu instead of on an emulator. -- |
BAF
Member #2,981
December 2002
![]() |
i have -25 experience in it. i thought you were getting at that. i wonder .. which would be easier-arm instruction table or recompilation. ot: how do you decompile an exe into c/c++ code? |
Thomas Fjellstrom
Member #476
June 2000
![]() |
That is pretty impossible. There is no way to go back to the code you originally wrote.. Unles you had an infinite amount of monkeys. Especially after the optimizer gets done with the code, its just not the same code you wrote. -- |
spellcaster
Member #1,493
September 2001
![]() |
Bobby, don't you think you should code something simple before starting with more complex concepts might be a good idea? You still have problems with the C/C++ syntax. So, try to finish a few small programs. Then get some good books on the advanced topics (I'd suggest the Dragon book and "Operating Systems") work through them, and then start again. This kind of stuff is complex. Right now you're not ready for it. First, you need to become a Jedi, then you can face Darth Emulator. -- |
BAF
Member #2,981
December 2002
![]() |
ok. i made a demo and i am making a ss right now:) |
Cage
Member #1,277
March 2001
|
GBA games are written in C, C++, you name it, as long as you have a proper compiler that can create binary executables for the ARM CPU
----- |
spellcaster
Member #1,493
September 2001
![]() |
Quote: ok. i made a demo and i am making a ss right now
What's a "ss"? -- |
gillius
Member #119
April 2000
|
I think he means screensaver. I finially figured it out in the other thread when you asked why he would want that code. Then I saw it exits when you do any input, which acts like a screensaver does, hence ss. But it took me almost 2 days to figure that out. Gillius |
BAF
Member #2,981
December 2002
![]() |
heh. it is a screen saver::) |
gnolam
Member #2,030
March 2002
![]() |
Why don't you say it straight out then? -- |
BAF
Member #2,981
December 2002
![]() |
too lazy (see, no punctuation |
spellcaster
Member #1,493
September 2001
![]() |
Quote: too lazy That's teh 2nd time you gave that answer. From now on, I'll be to lazy to answer your posts correctly. -- |
Thomas Harte
Member #33
April 2000
![]() |
Quote: From what I've learned (could be wrong), Dynamic Recompilation is somewhat akin to JIT That is exactly to what I was referring. Some emulators (notably N64 and Playstation ones) can go even further by spotting references to particular functions from the footprint the manufacturer supplied compiler generates and can then head off into highly optimised pre-supplied interpretations of the same functions. Dynamic recompilation is particularly applicable to older ROM based formats where, on the whole, code cannot dynamically modify itself, and to newer 32bit and above consoles where large sections of code tend to have been spat out by a compiler of some sort and for that reason doesn't do much that is very unpredictable. I suspect because the CPU and graphics hardware are so massively mismatched in the GBA, a lot of people will produce highly optimised assembly written code for their inner loops, although hopefully they'll leave it in ROM meaning that dynamic recompilation is still a 'good' idea. Quote: i wonder .. which would be easier-arm instruction table or recompilation 'Instruction tables' are always easier, although it'd be silly to use an actual table for the ARM because all of the opcodes have meaningful bit patterns, and there is the option for 32bit instructions meaning that only if you represented every entry in your table by exactly one byte and had no code whatsoever could you fit a genuine table into your PC's RAM. [My site] [Tetrominoes] |
|