features
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
features [2020/02/15 22:26] – [Checksum Calculation] adminz | features [2020/02/26 17:15] (current) – [Enhanced Semantic Checks and Warnings] jtwine | ||
---|---|---|---|
Line 23: | Line 23: | ||
Write @ 0x3F33 = 227; | Write @ 0x3F33 = 227; | ||
</ | </ | ||
+ | |||
+ | ==== Enhanced Semantic Checks and Warnings ==== | ||
+ | I like to think that 10LC is a little smarter than 9LC and because of that, there some additional checks that 10LC can perform during the compilation and post-compile steps that might help spot bugs in your code. | ||
+ | |||
+ | For example, if you have a the Z80 Pod specified (an 8-bit CPU), and perform a '' | ||
+ | |||
+ | Also, address ranges are validated against the specified Pod as well. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | < | ||
+ | ScriptFile.s(45, | ||
+ | ScriptFile.s(51, | ||
+ | ScriptFile.s(74, | ||
+ | ScriptFile.s(230, | ||
+ | ScriptFile.s(231, | ||
+ | ScriptFile.s(237, | ||
+ | |||
+ | You can check out the full list of [[Warnings]] and [[Errors]] that can be emitted by 10LC. | ||
==== Enhanced Symbolic Names for Programs and Labels ==== | ==== Enhanced Symbolic Names for Programs and Labels ==== | ||
Line 29: | 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. | As an example, because 9LC did not prefix hexadecimal values (see above), you could not create symbolic identifiers that consisted solely of hexadecimal digits. | ||
- | Lastly, note that all symbols in 10LC are case-insensitive. | + | Lastly, note that all symbols in 10LC are //case-insensitive// so '' |
<code c> | <code c> | ||
- | Program CodeToTestInputs | + | Program CodeToTestInputs; |
- | Program DisplayTest | + | Program DisplayTest; |
- | Program DeadBeef | + | Program DeadBeef; |
: | : | ||
Line 45: | Line 64: | ||
Additionally, | Additionally, | ||
- | 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 | + | 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 |
<code c> | <code c> | ||
- | Program TestInputs | + | Program TestInputs; // Create Program TestInputs, Defaults To Program 0 |
- | Program TestDisplay 5 // Create Program TestDisplay, | + | Program TestDisplay 5; // Create Program TestDisplay, |
- | Program DEADBeef | + | Program DEADBeef; // Create Program DEADBeef, Defaults To Program **1**, Not 6 |
- | </ | + | |
- | + | ||
- | ==== Constant Values ==== | + | |
- | You can create constant values that work like register Aliases but are strictly for constant numeric values and can be used anywhere a numeric value would be allowed. | + | |
- | + | ||
- | <code c> | + | |
- | Const JoystickNone | + | |
- | Const JoystickUp | + | |
- | Const JoystickDown | + | |
- | Const JoystickLeft | + | |
- | Const JoystickRight = 0x08; | + | |
- | </ | + | |
- | + | ||
- | ==== Global Constant Values ==== | + | |
- | You can also create //global// constant values that work like the above normal constant values, but are visible to **all** programs being compiled after the global constant has been declared. | + | |
- | + | ||
- | They work the same as '' | + | |
- | + | ||
- | <code c> | + | |
- | Global MemMapCtrlsP1 = 0x3400; | + | |
- | Global MemMapCtrlsP2 = 0x3401; | + | |
- | Global VideoMemStart = 0x2800; | + | |
- | Global ColorMemStart = 0x2C00; | + | |
</ | </ | ||
==== Register Aliases ==== | ==== Register Aliases ==== | ||
- | Aliases allow you to refer to the standard register set ('' | + | Aliases allow you to refer to the standard register set ('' |
* **BITMASK** = '' | * **BITMASK** = '' | ||
* **ROMSIG** = '' | * **ROMSIG** = '' | ||
Line 86: | Line 82: | ||
* **PDBAT** = '' | * **PDBAT** = '' | ||
- | One of the differences between 10LC's Alias statement and 9LC's ASSIGN statement is that an Alias can be created anywhere within a Program - they do not have to be all grouped together in a dedicated section at the top of the file. Once an Alias has been defined | + | One of the differences between 10LC' |
<code c> | <code c> | ||
Line 92: | Line 88: | ||
Alias Control2Bits = Reg2; | Alias Control2Bits = Reg2; | ||
</ | </ | ||
+ | |||
+ | Aliases can be //Global// or // | ||
+ | |||
+ | ==== Constant Values ==== | ||
+ | You can create constant values that work like register Aliases but are strictly for constant numeric values and can be used anywhere a numeric value would be allowed. | ||
+ | |||
+ | Like Aliases, Constants can be //Global// or // | ||
+ | |||
+ | <code c> | ||
+ | Const JoystickNone | ||
+ | Const JoystickUp | ||
+ | Const JoystickDown | ||
+ | Const JoystickLeft | ||
+ | Const JoystickRight = 0x08; | ||
+ | </ | ||
+ | |||
==== Less-Than and Less-Than-Or-Equals Tests ==== | ==== Less-Than and Less-Than-Or-Equals Tests ==== | ||
Line 133: | Line 145: | ||
Read From 0x3200 Into Control1Bits; | Read From 0x3200 Into Control1Bits; | ||
Read From 0x3201 Into Control2Bits; | Read From 0x3201 Into Control2Bits; | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== 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 '' | ||
+ | |||
+ | <code c> | ||
+ | ReadEx From 0x2000 Into RegA RegB Control2Bits Reg1; | ||
+ | </ | ||
+ | |||
+ | The above code will compile into the equivalent of the following discrete '' | ||
+ | |||
+ | <code c> | ||
+ | Read From 0x2000 Into RegA; | ||
+ | Read From 0x2001 Into RegB; | ||
+ | Read From 0x2002 Into Reg2; | ||
+ | Read From 0x2003 Into Reg1; | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Sequence Writing Shortcut ==== | ||
+ | If you need to fill small block of contiguous memory with specific values, you have to create a block of '' | ||
+ | |||
+ | <code c> | ||
+ | WriteEx @ 0x1000 = 1 2 4 0x10 0x20 0x40 Control2Bits Reg4; | ||
+ | </ | ||
+ | |||
+ | The above code will compile into the equivalent of the following discrete '' | ||
+ | |||
+ | <code c> | ||
+ | Write @ 1000 = 1; | ||
+ | Write @ 1001 = 2; | ||
+ | Write @ 1002 = 4; | ||
+ | Write @ 1003 = 0x10; | ||
+ | Write @ 1004 = 0x20; | ||
+ | Write @ 1005 = 0x40; | ||
+ | Write @ 1006 = Reg2; | ||
+ | Write @ 1007 = Reg4; | ||
</ | </ | ||
Line 158: | 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 | + | A "step over pause" can be simulated by inserting code in-between each compiled statement that calls a program |
<code c> | <code c> |
features.1581827211.txt.gz · Last modified: 2020/02/15 22:26 by adminz