...3 GHz is required to run most games, and still even some lag. Why would emulation require 30x the clock speed of the original OS to work? I realize the code's gotta be translated, but it's usually 2-4x the original CPU.
Well, a lot of Native N64 Games (like Goldeneye, Perfect Dark) had tremendous amounts of lag.
Depends on the hardware being emulated and how complex the hardware really is. Yes, the Nintendo 64 is very complex. "Usually" more like 10x+ faster than the original CPU is required, not 2x-4x, regardless of the hardware being emulated.
The ROM is "written" in VR4300 machine code. Those basic instructions have to be translated into x86 machine code, and then executed. The translation itself takes time, and usually the produced code cannot be as efficient as the original, due to architectural differences. (An operation that could be accomplished on the N64 using 2 instructions and last for 2 cycles might require 30 instructions and 40 cycles to be accurately reproduced on an x86 PC, for example.) So, the actual execution of the translated code also is much more intensive than on the original platform. For these reasons, the host platform must often be many times more powerful than the emulated platform to ensure real-time emulation.
x86 instructions differ from VR4300 instructions in the same way that English words differ from Russian words. An instruction that tells an x86 CPU to add two numbers might look like this: 5F 01 B4 00 8A, while the equivalent instruction running on a VR4300 would be formatted like this: 32 11 B4 01 8A 00. (That's only meant as an example; I have no idea what the actual opcodes would look like.) CPUs for consoles are usually chosen based on cost, performance and suitability for gaming. At the time the N64 was released, Nintendo no doubt felt that that CPU would offer the best 'bang for the buck' and they were probably right.
Writing programming for a game console works the same as writing programming for any computer. You can either write the program using a programming language, like C, and then compile that into native machine code, or you can write in assembly, which is basically just human-readable machine code (with a few extra bells and whistles to make things easier), which gets directly assembled into native machine code. In the case of older consoles, a lot of assembly was used, since it can be written to work more efficiently than the code produced by a compiler, and CPU cycles were at a premium on those older consoles. Nowadays, I'd guess that a lot more higher level code is used, since it's typically easier to manage, and consoles are fast enough that they can afford to waste a few cycles here and there for the sake of quicker development.
What's the purpose of having so many real world languages? In the past in particular, it has typically been more cost effective not to use the same general purpose CPUs as desktop PCs use, but rather to use something a bit more tailored to the tasks that the console really needs to perform. There are hundreds of different applications for CPUs, and using the same general-purpose architecture in all of them is simply not practical.What is the purpose of having so many different instruction sets? Can't there be a universal one like x86?
Most games are not open source. If gaming companies decided to freely release their source code (which would basically mean saying goodbye to whatever profits they hoped to make) then it might be feasible to port the code to PC.Wait, if it's written in Assembly/C then can't it be compiled into x86 code and take only 100MHz on a PC like on the N64?
x86 is NOT universal. It's merely the instruction set that is the most popular in the PC world. The reasons for having more than one instruction set are varied. For one, a particular instruction set may only be good at one thing, and crap at others. For another, unless your competitor has gained a huge amount of market share, it's not always a good idea to use your competitor's instruction set. After all, you'll have to pay licensing fees, be partially subject to your competitor's whims, etc.
As for compiling Assembly/C... Oh, gods no. For one thing, you're forgetting that these games were coded specifically for one platform. You can't just compile the code and expect it to run on the platform you want it to. there's going to be code in there that is specific for the platform. You'd have to rewrite it. For another, Assembly is specific to the instruction set/CPU/processor it's coded for. Assembly is only one or two steps above pure 0s and 1s, after all.
There's also libraries to consider. If your program is dependent on a library from Sony(For example), unless you've coded your game so that you can use another company's library(Say, Sega) that performs the same functions, you could be boned if you want to port it. You'd have to rewrite the game and possibly make the library from scratch.
There are many, many issues when it comes to porting. It's rarely easy unless you're porting from one system to another that's vastly superior(For example, NES to the X360), or to one that's very similar(GC to Wii, for example).
You've also got to take into consideration that what you've said assumes access to the source code. That's just not gonna happen unless you've licensed the game(And even then it's not guaranteed.).
I may not be totally correct with the examples I gave, but what I've meant will stand regardless. It's never as simple as compiling the code.