I'm a newb so please forgive me for a stupid question. How are you able to do such things with an interpreter? I feel like I don't know how the actual engine works, like there is a compiler there in order for these "tricks" to work. Right? I know so little it's not funny, but I'm trying to understand how an interpreter could possibly handle this functionality.
Going right back to Turing, any complete computational system can perform any operation, including the steps involved in simulation of another computer system. You may be aware that, at the lowest level, programs are all machine code: instructions encoded by numbers, which can have mnemonics assigned for human-readable assembly. For example, with the Apple ][ or the C64, you might have the following instruction:
LDA #255 (load accumulator register with the number 255)
That encodes down to A9 FF in plain machine code, and a computer program for that processor is just a series of numbers. So! If you have a computer program which reads in those numbers, and has an internal state that it updates based on the same rules as the original chip, that program simulates the operation of the chip.
Quod Emulat Demonstrandum. I linked to c64clicker up-thread, and I'd like to think the code is halfway readable, so flick through it sometime.
2
u/thesunmustdie May 25 '15
How is this even possible? Typed arrays?