User Tools

Site Tools


features

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
features [2020/02/19 20:23]
jtwine
features [2020/02/26 17:15] (current)
jtwine [Enhanced Semantic Checks and Warnings]
Line 31: Line 31:
 Also, address ranges are validated against the specified Pod as well. Also, address ranges are validated against the specified Pod as well.
  
-The 10LC compiler will also check for things like labels ​or programs ​that are never referenced, helping you look for bugs like cut-n-paste errors where you may have forgotten to change something.+The 10LC compiler will also check for things like Programs, Labels, Constants ​or Aliases ​that are never referenced, helping you look for bugs like cut-n-paste errors where you may have forgotten to change something. ​ Here are some example diagnostic warnings: 
 + 
 +<​code>​ 
 +ScriptFile.s(45,​1):​ Warning L0525: A global Constant named Speech1 was created but was never referenced 
 +ScriptFile.s(51,​1):​ Warning L0529: A global Alias named Unused was created but was never referenced 
 +ScriptFile.s(74,​5):​ Warning L0518: Program Main contains a defined Label UnusedLabel which was never referenced 
 +ScriptFile.s(230,​5):​ Warning L0519: Program TestSound contains a constant named None which was never referenced 
 +ScriptFile.s(231,​5):​ Warning L0519: Program TestSound contains a constant named Mute1 which was never referenced 
 +ScriptFile.s(237,​5):​ Warning L0519: Program TestSound contains a constant named Enable2 which was never referenced</​code>​
  
 You can check out the full list of [[Warnings]] and [[Errors]] that can be emitted by 10LC. You can check out the full list of [[Warnings]] and [[Errors]] that can be emitted by 10LC.
Line 40: Line 48:
 As an example, because 9LC did not prefix hexadecimal values (see above), you could not create symbolic identifiers that consisted solely of hexadecimal digits. ​ Also, 9LC's symbolic names only used 8 characters of significance,​ so it could not disambiguate identifiers like ''​**THISNAME**0''​ and ''​**THISNAME**5''​. ​ With 10LC, the length of symbol names is effectively //​unbounded//,​ and all characters are significant.  ​ As an example, because 9LC did not prefix hexadecimal values (see above), you could not create symbolic identifiers that consisted solely of hexadecimal digits. ​ Also, 9LC's symbolic names only used 8 characters of significance,​ so it could not disambiguate identifiers like ''​**THISNAME**0''​ and ''​**THISNAME**5''​. ​ With 10LC, the length of symbol names is effectively //​unbounded//,​ and all characters are significant.  ​
  
-Lastly, note that all symbols in 10LC are case-insensitive. ​+Lastly, note that all symbols in 10LC are //case-insensitive// so ''​displaytest'',​ ''​DisplayTest'',​ and ''​DISPLAYTEST''​ all refer to the same symbol.
  
 <code c> <code c>
-Program CodeToTestInputs +Program CodeToTestInputs; 
-Program DisplayTest +Program DisplayTest; 
-Program DeadBeef+Program DeadBeef;
  
 :​DammitJimImADoctorNotATechnician ​ :​DammitJimImADoctorNotATechnician ​
Line 56: Line 64:
 Additionally,​ if you specify a specific program number, you will not create "​holes"​ in the numbering system. Unlike 9LC, 10LC numbers Programs dynamically in the order they are encountered during compilation,​ and they draw from a pool of available program numbers so that there are no limitations on the numbers chosen. Additionally,​ if you specify a specific program number, you will not create "​holes"​ in the numbering system. Unlike 9LC, 10LC numbers Programs dynamically in the order they are encountered during compilation,​ and they draw from a pool of available program numbers so that there are no limitations on the numbers chosen.
  
-For example, in 9LC, the third Program below would have a value of 6, but in 10LC it will have a value of 1.  Also, if you continue and create another five dynamically numbered ​programs, they will be numbered 2, 3, 4, **6**, and 7.  The manually-specified program number will not mess up the numbering.+For example, in 9LC, the third Program below would have a value of 6, but in 10LC it will have a value of 1.  Also, if you continue and create another five dynamically numbered ​Programs, they will be numbered 2, 3, 4, **6**, and 7.  The manually-specified program number will not mess up the numbering.
  
 <code c> <code c>
-Program TestInputs ​    // Create Program TestInputs, Defaults To Program 0  +Program TestInputs    // Create Program TestInputs, Defaults To Program 0  
-Program TestDisplay 5  // Create Program TestDisplay,​ Sets Program Number To 5  +Program TestDisplay 5 // Create Program TestDisplay,​ Sets Program Number To 5  
-Program DEADBeef ​      // Create Program DEADBeef, Defaults To Program **1**, Not 6 +Program DEADBeef      // Create Program DEADBeef, Defaults To Program **1**, Not 6 
 </​code>​ </​code>​
  
 ==== Register Aliases ====  ==== Register Aliases ==== 
-Aliases allow you to refer to the standard register set (''​REG0''​-''​REGF''​) using symbolic names. ​ This is similar to existing 9LC functionality but without its restrictions. ​ Unless disabled by the ''​[[Command Line#​Compiler Options|NoPreDefines]]''​ compiler option, 10LC will automatically create the following legacy register ​aliases+Aliases allow you to refer to the standard register set (''​REG0''​-''​REGF''​) using symbolic names. ​ This is similar to existing 9LC functionality but without its restrictions. ​ Unless disabled by the ''​[[Command Line#​Compiler Options|NoPreDefines]]''​ compiler option, 10LC will automatically create the following legacy register ​Aliases
   * **BITMASK** = ''​REGA''​   * **BITMASK** = ''​REGA''​
   * **ROMSIG** = ''​REGB''​   * **ROMSIG** = ''​REGB''​
Line 137: Line 145:
 Read From 0x3200 Into Control1Bits; ​ Read From 0x3200 Into Control1Bits; ​
 Read From 0x3201 Into Control2Bits;​ Read From 0x3201 Into Control2Bits;​
 +</​code>​
 +
 +
 +==== Sequence Reading Shortcut ====
 +If you need to read a small block of contiguous memory into a set of registers, you normally have to create a block of ''​Read''​ and register copy statements. ​ 10LC has a ''​ReadEx''​ statement that provides a shortcut way of doing this.  This statement allows you to set a starting place in memory followed by a list of registers. ​ 10LC will automatically //unroll// this ''​ReadEx''​ statement into multiple ''​Read''​ and register copy statements (essentially ''​Read Into''​ statements),​ automatically incrementing the address as it goes.  Aliases and Registers can all be used for the target registers. ​ For example:
 +
 +<code c>
 +ReadEx From 0x2000 Into RegA RegB Control2Bits Reg1;
 +</​code>​
 +
 +The above code will compile into the equivalent of the following discrete ''​Read Into''​ statements:
 +
 +<code c>
 +Read From 0x2000 Into RegA;
 +Read From 0x2001 Into RegB;
 +Read From 0x2002 Into Reg2;
 +Read From 0x2003 Into Reg1;
 </​code>​ </​code>​
  
  
 ==== Sequence Writing Shortcut ==== ==== Sequence Writing Shortcut ====
-If you need to fill small block of contiguous memory with specific values, you have to create a block of ''​Write''​ statements. ​ 10LC has a ''​WriteEx''​ statement that provides a shortcut way of doing this.  This statement ​allow you to set a starting place in memory followed by a list of values. ​ 10LC will automatically //unroll// this ''​WriteEx''​ statement into multiple ''​Write''​ statements, automatically incrementing the address as it goes.  Numeric values, Aliases and Registers can all be used.  For example:+If you need to fill small block of contiguous memory with specific values, you have to create a block of ''​Write''​ statements. ​ 10LC has a ''​WriteEx''​ statement that provides a shortcut way of doing this.  This statement ​allows ​you to set a starting place in memory followed by a list of values. ​ 10LC will automatically //unroll// this ''​WriteEx''​ statement into multiple ''​Write''​ statements, automatically incrementing the address as it goes.  Numeric values, Aliases and Registers can all be used.  For example:
  
 <code c> <code c>
-WriteEx @ 0x1000 = 1 2 4 0x10 0x20 0x40 ThisIsAnAlias ​Reg4;+WriteEx @ 0x1000 = 1 2 4 0x10 0x20 0x40 Control2Bits ​Reg4;
 </​code>​ </​code>​
  
Line 156: Line 181:
 Write @ 1004 = 0x20; Write @ 1004 = 0x20;
 Write @ 1005 = 0x40; Write @ 1005 = 0x40;
-Write @ 1006 = xx    // xx Would Be Replaced With The Value Of ThisIsAnAlias+Write @ 1006 = Reg2;
 Write @ 1007 = Reg4; Write @ 1007 = Reg4;
 </​code>​ </​code>​
Line 183: Line 208:
  
 ==== Debugging Steps ==== ==== Debugging Steps ====
-A "step over pause" can be simulated by inserting code in-between each compiled statement that calls a program ​that shows the source code line number and pauses ​execution until you press Yes/Enter.  This feature is enabled and disabled by compiler directives in your code.  For example, the following code would cause cause a pause and the line number to be shown before the execution of each of the last two ''​WRITE''​ operations.+A "step over pause" can be simulated by inserting code in-between each compiled statement that calls a program ​which shows the source code line number and stops execution until you press **<​Cont>​** on the 9010A.  This feature is enabled and disabled by compiler directives in your code.  For example, the following code would cause cause a pause and the line number to be shown before the execution of each of the last two ''​WRITE''​ operations.
  
 <code c> <code c>
features.1582165436.txt.gz · Last modified: 2020/02/19 20:23 by jtwine