Difference between revisions of "Interpreter cycle"
From AGI Wiki
Jump to navigationJump to search| Line 1: | Line 1: | ||
| − | + | The interpreter cycle in [[AGI]] works thusly: | |
| − | + | <pre> | |
| + | +---------------------------+ | ||
| + | | 1. delay time | | ||
| + | +---------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +----------------------------+ | ||
| + | |2. clear the keyboard buffer| | ||
| + | +----------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +---------------------------+ | ||
| + | | Flag (2) - > 0 | | ||
| + | | Flag (4) - > 0 | | ||
| + | +---------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +-------------------------------------+ | ||
| + | | 3. poll keyboard and joystick | | ||
| + | +-------------------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +-------------------------------------+ | ||
| + | | If the current mode is | | ||
| + | | - program_control, the direction of | | ||
| + | | Ego motion <-- var(6). | | ||
| + | | - player.control, var (6) --> dir. | | ||
| + | | of Ego motion. | | ||
| + | +-------------------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +---------------------------------------------------------------+ | ||
| + | | For all objects for which command animate.obj, start_update | | ||
| + | | and draw were carried out, the recalculation of the direction | | ||
| + | | of movement is performed. | | ||
| + | +---------------------------------------------------------------+ | ||
| + | | | ||
| + | V | ||
| + | +---------------------------------------------------------------+ | ||
| + | | If the score has changed (var (3)) or the sound has been | | ||
| + | | turned on or off (Flag (9)), the status line is updated. | | ||
| + | +---------------------------------------------------------------+ | ||
| + | | | ||
| + | +---------+ | ||
| + | V | ||
| + | +--------------------------+ | ||
| + | +---------------->| 4 Logic 0 is executed | | ||
| + | | +--------------------------+ | ||
| + | | | | ||
| + | | V | ||
| + | | +--------------------------------------+ | ||
| + | | | - Dir. of motion of Ego <-- var (6) | | ||
| + | | | - If score (var (3)) or Flag (9) | | ||
| + | | | have changed their values - update | | ||
| + | | | the status and score (on Var (3)); | | ||
| + | | | - Var (5) - > 0; | | ||
| + | | | - Var (4) - > 0; | | ||
| + | | | - Flag (5) - > 0!!!! | | ||
| + | | | - Flag (6) - > 0; | | ||
| + | | | - Flag (12) - > 0. | | ||
| + | | +--------------------------------------+ | ||
| + | +----------------------------+ | | ||
| + | | Execute: | V | ||
| + | | ~~~~~~~~~~~~~~~~~~~~~~~~ | +------------------------+ | ||
| + | | - stop.update; | | Update all controlled | | ||
| + | | - unanimate.all; | | objects on the screen. | | ||
| + | | - destroy all logic | +------------------------+ | ||
| + | | resources except | | | ||
| + | | for logic 0; | V | ||
| + | | - player.control; | +--------------+ | ||
| + | | - unblock; | | new.room n | | ||
| + | | - set_horizon 36; | | or | | ||
| + | | - var (1) = var (0); | | new.room.v n | | ||
| + | | - var (0) = n | Var(n); | | was issued? | | ||
| + | | - var (4) = 0; | | | | ||
| + | | - var (5) = 0; | +-------+------+ | ||
| + | | - var (9) = 0; |<-----------+ Yes | No | | ||
| + | | - var (16) = number of | +-------+--+---+ | ||
| + | | view assoc. w/Ego; | | | ||
| + | | - Ego coords from var (2); | | | ||
| + | | - var (2) = 0; | | | ||
| + | | - flag (2) - > 0; | V | ||
| + | | - flag (5) - > 1!!!! | +--------------+ | ||
| + | | - score < - var (3); | | Go to step 1 | | ||
| + | +----------------------------+ +--------------+ | ||
| + | </pre> | ||
| − | |||
| − | == | + | == Resources == |
| − | + | *[[AGI Specifications: Chapter 3 - AGI Internals|AGI Internals]] | |
| − | |||
| − | |||
| − | |||
| − | : | ||
| − | |||
| − | |||
| − | |||
| − | |||
| | ||
| − | [[Category: | + | [[Category:Interpreter]] |
Revision as of 00:51, 29 December 2013
The interpreter cycle in AGI works thusly:
+---------------------------+
| 1. delay time |
+---------------------------+
|
V
+----------------------------+
|2. clear the keyboard buffer|
+----------------------------+
|
V
+---------------------------+
| Flag (2) - > 0 |
| Flag (4) - > 0 |
+---------------------------+
|
V
+-------------------------------------+
| 3. poll keyboard and joystick |
+-------------------------------------+
|
V
+-------------------------------------+
| If the current mode is |
| - program_control, the direction of |
| Ego motion <-- var(6). |
| - player.control, var (6) --> dir. |
| of Ego motion. |
+-------------------------------------+
|
V
+---------------------------------------------------------------+
| For all objects for which command animate.obj, start_update |
| and draw were carried out, the recalculation of the direction |
| of movement is performed. |
+---------------------------------------------------------------+
|
V
+---------------------------------------------------------------+
| If the score has changed (var (3)) or the sound has been |
| turned on or off (Flag (9)), the status line is updated. |
+---------------------------------------------------------------+
|
+---------+
V
+--------------------------+
+---------------->| 4 Logic 0 is executed |
| +--------------------------+
| |
| V
| +--------------------------------------+
| | - Dir. of motion of Ego <-- var (6) |
| | - If score (var (3)) or Flag (9) |
| | have changed their values - update |
| | the status and score (on Var (3)); |
| | - Var (5) - > 0; |
| | - Var (4) - > 0; |
| | - Flag (5) - > 0!!!! |
| | - Flag (6) - > 0; |
| | - Flag (12) - > 0. |
| +--------------------------------------+
+----------------------------+ |
| Execute: | V
| ~~~~~~~~~~~~~~~~~~~~~~~~ | +------------------------+
| - stop.update; | | Update all controlled |
| - unanimate.all; | | objects on the screen. |
| - destroy all logic | +------------------------+
| resources except | |
| for logic 0; | V
| - player.control; | +--------------+
| - unblock; | | new.room n |
| - set_horizon 36; | | or |
| - var (1) = var (0); | | new.room.v n |
| - var (0) = n | Var(n); | | was issued? |
| - var (4) = 0; | | |
| - var (5) = 0; | +-------+------+
| - var (9) = 0; |<-----------+ Yes | No |
| - var (16) = number of | +-------+--+---+
| view assoc. w/Ego; | |
| - Ego coords from var (2); | |
| - var (2) = 0; | |
| - flag (2) - > 0; | V
| - flag (5) - > 1!!!! | +--------------+
| - score < - var (3); | | Go to step 1 |
+----------------------------+ +--------------+
Resources