User Tools

Site Tools


intrinsic_statements

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
intrinsic_statements [2020/02/15 23:08]
adminz created
intrinsic_statements [2020/03/03 21:32]
jtwine
Line 16: Line 16:
 <code c> <code c>
 __Delay 50;    // Delay For About 2 Seconds __Delay 50;    // Delay For About 2 Seconds
 +__Delay Reg2;  // Delay For Whatever Value Is In REG2
 </​code>​ </​code>​
  
-==== __Delay ==== 
-The ''​%%__%%Delay''​ statement is causes execution to pause for a specified amount of time.  Internally, a counter value is decremented and tested against zero.  If the value is greater than zero, the value is decremented and tested again, etc. until the value reaches zero and processing resumes. 
  
-The syntax of the statement is: ''​%%__%%Delay <​count>;​''​+==== __Fill ==== 
 +The ''​%%__%%Fill'' ​statement fills a range of memory with a specific byte.  During the fill operation, the byte value remains static.
  
-The counter value is a 32-bit value and a value of 25 is about 1 second.+The syntax ​of the statement ​is: ''​%%__%%Fill From <​address>​ To <​address>​ With <​byte>;''​
  
 <code c> <code c>
-__Delay 50   // Delay For About 2 Seconds+__Fill From Reg1 To Reg2 With 0xAA; 
 +</code> 
 + 
 + 
 +==== __FillRamp ==== 
 +The ''​%%__%%FillRamp''​ statement fills a range of memory with a byte value, and increments the byte value during the fill operation. ​ After the byte reaches 0xFF (255) it is reset back to zero. 
 + 
 +The syntax of the statement is: ''​%%__%%FillRamp From <​address>​ To <​address>​ With <​byte>;''​ 
 + 
 +<code c> 
 +__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=Reg8;                     // First Parameter ​ - Intrinsic Command 
-    Alias FromOrDelay=RegE;                 // Second Parameter - Start Of Fill Range or Delay Counter/​Value +    Alias FromOrDelay=Reg9;                 // Second Parameter - Start Of Fill Range or Delay Counter/​Value 
-    Alias To=RegD;                          // Third Parameter - End Of Fill Range +    Alias To=RegA;                          // Third Parameter ​ - End Of Fill Range 
-    Alias FillChar=RegC;                    // Fourth Parameter - Character to use for Fill/​FillRamp ​     ​+    Alias FillChar=RegB;                    // Fourth Parameter - Character to use for Fill/​FillRamp ​     ​
  
-    If Command == 1 Goto Delay; ​            // ​RegF == 1 - Delay +    If Command == 1 Goto Delay; ​            // ​Reg8 == 1 - Delay 
-    If Command >= 2 Goto Fill;              // RegF == 2 - Fill, RegF == 3 - FillRamp+    If Command >= 2 Goto Fill;              // Reg8 == 2 - Fill, Reg8 == 3 - FillRamp
     Goto End;     Goto End;
  
Line 67: 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.  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>​
intrinsic_statements.txt · Last modified: 2020/03/03 21:35 by jtwine