Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
agi-game:specifications-resources [2021/05/24 15:14] – frater | agi-game:specifications-resources [2021/05/24 15:20] – [The <tt>said</tt> test command] frater | ||
---|---|---|---|
Ligne 331: | Ligne 331: | ||
</ | </ | ||
- | ==== The //else// command and more on brackets ==== | + | ==== The **else** command and more on brackets ==== |
- | The //else// statement will always continue after an //if// bracket block. This next feature is important and has caused a number of hassles in the past. When an //else// statement follows an //if//, then the bracket distance given after the //if// statement //will be three bytes longer// (this is a consequence of the way the interpreter handles | + | The **else** statement will always continue after an **if** bracket block. This next feature is important and has caused a number of hassles in the past. When an **else** statement follows an **if**, then the bracket distance given after the **if** statement //will be three bytes longer// (this is a consequence of the way the interpreter handles |
Here's an example: | Here's an example: | ||
Ligne 352: | Ligne 352: | ||
</ | </ | ||
- | Usually you would expect the bracket distance to be 0x0002 but in the above case it is clearly 0x0005 which illustrates the difference between a straight //if// statement and an // | ||
- | The //else// statements themselves are a lot like //if// statements except that they' | + | Usually you would expect the bracket distance to be 0x0002 but in the above case it is clearly 0x0005 which illustrates the difference between a straight **if** statement and an **if..else** structure. The situation is the same for nested **if..else** structures. |
+ | |||
+ | The **else** statements themselves are a lot like **if** statements except that they' | ||
==== Test conditions ==== | ==== Test conditions ==== | ||
Ligne 589: | Ligne 590: | ||
//Situation 2.// | //Situation 2.// | ||
- | If the code is an 0xFF code, then if jumps to the //if// statement handler. In this routine is basically assesses whether the whole test condition evaluates to true or to false. It does this by treating each test separately and calling the relevant test command routines using the jump table in the '' | + | If the code is an 0xFF code, then if jumps to the **if** statement handler. In this routine is basically assesses whether the whole test condition evaluates to true or to false. It does this by treating each test separately and calling the relevant test command routines using the jump table in the '' |
//Situation 3.// | //Situation 3.// | ||
- | If in the normal execution of AGI commands, the code 0xFE is encountered, | + | If in the normal execution of AGI commands, the code 0xFE is encountered, |
If you're confused by this, the following example will probably explain things. | If you're confused by this, the following example will probably explain things. | ||
Ligne 619: | Ligne 620: | ||
</ | </ | ||
- | This is exactly how all //if//s and //else//s are implemented in the logic code. The //if// statement is a conditional branch where the branch is taken if the condition is not met, while the //else// statement is a nonconditional jump. If a 0xFE code appears in the middle of some AGI code and wasn't actually originally coded as an //else//, then it was most likely a //goto// statement. | + | This is exactly how all **if**s and **else**s are implemented in the logic code. The **if** statement is a conditional branch where the branch is taken if the condition is not met, while the **else** statement is a nonconditional jump. If a 0xFE code appears in the middle of some AGI code and wasn't actually originally coded as an **else**, then it was most likely a **goto** statement. |
+ | |||
+ | ==== The **said** test command ==== | ||
- | ===The < | ||
The above assembly language code does raise a very important point. | The above assembly language code does raise a very important point. | ||
- | The //said// command can have a variable number of arguments. Its | + | The **said** command can have a variable number of arguments. Its code is 0x0E, and the byte following this byte gives the number of two byte words that follow as parameters. |
- | code is 0x0E, and the byte following this byte gives the number of | + | |
- | two byte words that follow as parameters. | + | |
Examples: | Examples: | ||
- | < | + | <code C> |
if (said(marble)) | if (said(marble)) | ||
if (said( open, door)) | if (said( open, door)) | ||
</ | </ | ||
- | In the above examples, the values 0x011E, 0x0237, and 0x0073 are just | + | In the above examples, the values 0x011E, 0x0237, and 0x0073 are just random word numbers that could stand for the words given. |
- | random word numbers that could stand for the words given. | + | |
===Inner loops=== | ===Inner loops=== |