The emulator executes the bitcode generated by the assembler.
The emulator works in ticks. Each
tick() executes one instruction,
which is fetched from the rom. Ticks executed by the
which is invoked by a simple
setTimeout. Because there is a limit on how frequent
setTimeout can fire, a number of
ticks is executed in each
- check if the emulator is running, if not, exit
- check if the number of instructions to be executed has been executed, if yes, exit (see
- check if the emulator should be waiting (
DELAYexecuted), if yes, set a timeout of the desired time and exit. This is skipped if the emulator is stepping.
- check for interrupts
- fetch the next instruction from the ROM
- check if the instruction is cached, if not disassemble and cache
- fetch instruction from the cache
- load needed values for parameters
- call the
exec()-function of the instruction
- check and set the zero-flag, if specified in instruction-file
The timeout which is set by
setTickWrapperTimeout() can be interrupted by a number of things:
CONTINUE-message (to allow faster stepping)
In addition the timeout will be longer when the
DELAY-instruction) is set.
The emulator pins and their state are handled by a
IOBank instance. Please refer to the documentation for more
information on this. The
getIO function of the emulator api are essentially wrapper functions for
the actual pin objects.
The is located in the RAM, beginning from
sp gets increment before the byte is pushed (pre-increment), so
sp always points to the last byte. Words are pushed with the least significant byte first.
An example can be found in the tutorial.
Data structures which are used inside the emulator and its messages and broadcasts.
Details about the Communicator-Implementation for the emulator, including the messages and broadcasts.