Difference between revisions of "SCI/Specifications/SCI virtual machine/Interpreter initialization and the main execution loop"

Jump to navigation Jump to search
m
Add "Notes" section
(Merging of the SCI documentation)
 
m (Add "Notes" section)
 
Line 26: Line 26:


So, how does an SCI program execute? Well, the play method is defined in the <tt>Game</tt> class, and it is never overridden. It consists of a huge loop which calls <tt>Game::doit</tt> continuously, followed by a pause according to the selected animation speed. That is, the script, not the interpreter, handles animation speed. Notice how the debugger very often shows the statement sag <tt>$12</tt> upon entering the debugger? This instruction resides in <tt>Game::play</tt>, and the break occurs here because of a <tt>KWait</tt> kernel call which is executed right before that instruction. This wait takes the most execution time, so therefore the debug break is most likely to be A game programmer would then override <tt>Game::doit</tt> and place the game specific main loop here (still, <tt>Game::doit</tt> is almost identical from game to game). Execution of the <tt>Game::play</tt> main loop stops when an event causes global variable 4 to be non-zero. The last ret instruction is met, and the interpreter terminates.
So, how does an SCI program execute? Well, the play method is defined in the <tt>Game</tt> class, and it is never overridden. It consists of a huge loop which calls <tt>Game::doit</tt> continuously, followed by a pause according to the selected animation speed. That is, the script, not the interpreter, handles animation speed. Notice how the debugger very often shows the statement sag <tt>$12</tt> upon entering the debugger? This instruction resides in <tt>Game::play</tt>, and the break occurs here because of a <tt>KWait</tt> kernel call which is executed right before that instruction. This wait takes the most execution time, so therefore the debug break is most likely to be A game programmer would then override <tt>Game::doit</tt> and place the game specific main loop here (still, <tt>Game::doit</tt> is almost identical from game to game). Execution of the <tt>Game::play</tt> main loop stops when an event causes global variable 4 to be non-zero. The last ret instruction is met, and the interpreter terminates.
==Notes==
<references />
236

edits

Navigation menu