This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
intrinsic_statements [2020/02/15 23:14] adminz |
intrinsic_statements [2020/03/03 21:35] jtwine [Implementation] |
||
---|---|---|---|
Line 26: | Line 26: | ||
<code c> | <code c> | ||
- | __Fill From Reg1 To Reg2 With 0xAA | + | __Fill From Reg1 To Reg2 With 0xAA; |
</code> | </code> | ||
Line 36: | Line 36: | ||
<code c> | <code c> | ||
- | __FillRamp From Reg1 To Reg2 With 0x42 | + | __FillRamp From Reg1 To Reg2 With 0x42; |
</code> | </code> | ||
==== Implementation ==== | ==== Implementation ==== | ||
- | The intrinsic statements are implemented via a custom program (Program #99, ''%%__%%IP%%__%%P99'') that is created and added to the compiled file near the end of the compilation phase. Its implementation is as follows: | + | The intrinsic statements are implemented via a custom program (Program #99, ''%%__%%IP%%__%%P99'') that is added internally and compiled near the end of the compilation phase. Its implementation is as follows: |
<code c> | <code c> | ||
Program __IP__P99; | Program __IP__P99; | ||
- | Alias Command=RegF; // First Parameter - Intrinsic Command | + | Alias Command=RegF; // First Parameter - Intrinsic Command |
Alias FromOrDelay=RegE; // Second Parameter - Start Of Fill Range or Delay Counter/Value | Alias FromOrDelay=RegE; // Second Parameter - Start Of Fill Range or Delay Counter/Value | ||
- | Alias To=RegD; // Third Parameter - End Of Fill Range | + | Alias To=RegD; // Third Parameter - End Of Fill Range |
Alias FillChar=RegC; // Fourth Parameter - Character to use for Fill/FillRamp | Alias FillChar=RegC; // Fourth Parameter - Character to use for Fill/FillRamp | ||
Line 77: | Line 77: | ||
Goto FillReturn; // Go Back To Fill Routine | Goto FillReturn; // Go Back To Fill Routine | ||
- | :End // End Of Program 99 | + | :End |
+ | EndProgram; // End Of Program 99 | ||
</code> | </code> | ||
- | When a intrinsic statement is encountered, the statement is replaced with code to populate the necessary registers with the necessary parameters and a call to Program 99 is made. | + | When a intrinsic statement is encountered, the statement is replaced with code to populate the necessary registers with the necessary parameters and a call to Program 99 is made. For example, the following call to the ''%%__%%Delay'' intrinsic: |
+ | |||
+ | <code c> | ||
+ | __Delay 50; | ||
+ | </code> | ||
+ | |||
+ | -Is replaced with the equivalent of the following code: | ||
+ | |||
+ | <code c> | ||
+ | RegF = 1; | ||
+ | RegE = 50; | ||
+ | Execute 99; | ||
+ | </code> |