===== Operational Statements ===== Here we cover the statements that are used for creating code units and performing operations within the 9010A unit and the UUT. Usually these are the 10LC equivalents to the keypresses you would use when manually operating the 9010A interactively. ==== Program ==== The ''Program'' statement marks the start of a callable unit of code. Programs in 10LC are normally referenced by symbolic name and are converted to numeric identifiers that the 9010A uses. A Program's numeric identifier is automatically assigned by the compiler. If necessary, you can force use of a specific program number as well. Programs can call other programs via the ''Execute'' statement, and up to 10 nested calls are supported. Note that recursion is not supported at any call level. The syntax of the ''Program'' statement is: ''Program ;'' or ''Program ;'' Program MyProgramName; Program OtherProgram 42; Programs can be referenced by other programs before they are actually created. During the final phases of compilation, a check is performed that ensures that all referenced programs have actually been compiled. Programs are "closed" by the ''EndProgram'' statement. ==== EndProgram ==== The ''EndProgram'' statement marks the end of a callable unit of code. EndProgram; ==== Execute ==== The ''Execute'' statement allows one program to call another as a //subroutine//. When this happens, the state of Registers ''0'' through ''7'' are saved and later restored when the called program exits. Any changes made to those registers by the called program are lost when the called program returns. Those registers are also set to zero before the called program starts execution. These registers are called **local registers**, because their values are local to the program being executed. Registers ''8'' through ''F'' are not saved and restored - they are passed to the called program intact and any changes made to them by the called program remains intact when the called program returns. This allows those registers to be used to pass information to and from other called programs. These registers are called **global registers**, because their values are global to all programs being executed. The syntax of the ''Execute'' statement is: ''Execute ;'' or ''Execute ;'' Execute OtherProgram Execute 42 Note that programs are not allowed to call themselves either recursively nor reentrantly. This means a program cannot call itself, and called programs cannot call into a program that is already in their history (or //call stack//). For example, if Program 1 calls Program 2, Program 2 cannot call Program 1. If Program 2 calls Program 3, Program 3 cannot call Program 1 or Program 2. If you create a program that is never referenced by any other program, a warning is issued. This can be benign if the program in question is your main program, or the first program that will be getting called. This warning can be suppressed by using a compiler directive that indicates that no warning should be issued. ==== Labels ==== A //label// is a point in a program that can be referenced by a ''Goto'' statement. When used with an ''If'' test, if the test expression evaluates to true, the Goto is executed the code //jumps// to the specified label. A program can have up to 16 labels (internally numbered 0x0 through 0xF). Labels are created in a program by placing a colon followed by the label name. For example: :ThisIsALabel Note that there is no space between the colon and the label name, and a label is **not** terminated with a semicolon. If you create a label but never reference it from a ''Goto'' statement, a warning is emitted. If you reference a label but never actually create it, an error is emitted. ==== Display ==== The ''Display'' statement is the most basic operational statement on the 9010A. It is used to provide audio and visual feedback on the 9010A's display and is also used to receive user input. The following characters are supported for the ''Display'' statement: | '''' | ''A-Z'' | ''0-9'' | | ''_ '' | '';'' | ''@'' | | ''='' | ''<'' | ''>'' | | '','' | ''.'' | ''?'' | | ''#'' | ''+'' | ''-'' | | ''%%'%%'' | ''"'' | ''%'' | | ''*'' | ''/'' | ''\'' | | ''$'' | (Lowercase characters are allowed by 10LC but will be converted to uppercase.) The following characters have special functions in a ''Display'' statement: | ''#'' | Causes the 9010A to beep | | ''$'' | When followed by a register identifier causes the value of the register to be displayed in hexadecimal | | ''@'' | When followed by a register identifier causes the value of the register to be displayed in decimal | | ''/'' | When followed by a register identifier causes the 9010A to pause and await user input of a hexadecimal value and store it in the specified register | | ''\'' | When followed by a register identifier causes the 9010A to pause and await user input of a decimal value and store it in the specified register | | ''?'' | When followed by a register identifier causes the 9010A to pause, display a question mark and await the user pressing either the **** or the **** keys and will place ''1'' or a ''0'' into the specified register corresponding to which key was pressed | | ''%'' | When followed by a register identifier causes the 9010A to enable or disable asynchronous input and if enabled will store received input into the specified register | | ''+'' | When the first character in the string, it causes the remaining string to be appended to any data currently being displayed | To display a special character normally, double it. The number of printable characters is limited to 32, which is the number of characters the 9010A's display can show without scrolling. A trailing space in the display string is handled correctly by 10LC - you do not have to manually place an underscore for a trailing space to work correctly, like you would need to with 9LC. This statement supports single character Register identifiers (''0-9'' and ''A-F''), proper Register names (e.g. ''REG4''), and register Aliases. Support for register aliases is preliminary and although it works in my tests, there may be the occasional snag. The syntax of the statement is: ''Display %%"%%%%"%%;'' Alias UseLongRAMTestFlag = Reg8; Display "# - Hello World - "; Display "Place you name, $$ I got"; Display "Are you OK?A"; Display "Are you Sure?Reg4"; Display "Use Long RAM Tests?UseLongRAMTestFlag"; **Note:** The only catch is that //currently// in 10LC a register identifier must terminated by a space or the end of the display string. For example: Display "RegA is $A@RegA"; // This Will Not Work Display "RegA is $ACurrently"; // This Will Not Work Display "RegA is $A @RegA"; // This Will Work Display "RegA is $A Currently"; // This Will Work ==== Read ==== The ''Read'' statement is used to read from a memory location and optionally copy the read value into another register. The first form of the ''Read'' statement is the basic read memory operation that stores the result into Register E (''REGE''). This is equivalent to the standard ''READ'' statement in 9LC. The second form is the ''Read Into'' form and is used to perform a read from memory and then copy the read value from ''REGE'' to whatever other register you like. The syntax of the ''READ'' statement is: ''Read From
;'' or ''Read From
Into ;'' Read From 0x200; Read From 0x200 Into RegB; Read From 0x201 Into MemLocation1; // MemLocation1 Is An Alias For REG4 Note that if you use the ''Read Into'' form and specify Register E as the destination, the copy portion will be optimized away and a warning will be emitted. Also, the ''Into'' functionality is accomplished by having the compiler insert a register to register copy immediately after the read operation completes. For example, Read From 0x200 Into RegB; Compiles into the equivalent of: Read From 0x200; RegB = RegE; ==== ReadStatus ==== The ''ReadStatus'' statement is used to read status values from the UUT's CPU status lines and place that information into Register C (''REGC'') value into another register. The first form of the ''Read'' statement is the basic read memory operation that stores the result into Register E (''REGE''). This is equivalent to the standard ''READ STS'' statement in 9LC. Like the ''Read'' statement, a second form is supported using the ''Into'' modifier and is perform a read operation and then copy the read value from ''REGC'' to whatever other register you like. The syntax of the ''ReadStatus'' statement is: ''ReadStatus;'' or ''ReadStatus Into ;'' ReadStatus; ReadStatus Into RegB; ReadStatus Into MemLocation1; // MemLocation1 Is An Alias For REG4 Note that if you use the ''ReadStatus Into'' form and specify Register C as the destination, the copy portion will be optimized away and a warning will be emitted. ==== Write ==== The ''Write'' statement is used to write data to a memory location. This is equivalent to the standard ''WRITE'' statement in 9LC. The syntax of the ''Write'' statement is: ''Write @
= ;''. Write @ 0x100 = 0x22; Write @ 1024 = Value2; A warning will be emitted if you write a directly specified or constant value that exceeds the word-size of the configured Pod's CPU. For example, if you have the Z80 Pod configured and the following code is compiled: Write @ 3200 = 0x220; A warning will be emitted because the value 0x220 exceeds the maximum value of an 8-bit word. ==== WriteEx ==== The ''WriteEx'' 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. The syntax of the ''WriteEx'' statement is: ''WriteEx @
= , [...];''. WriteEx @ 0x1000 = 1 2 4 0x10 0x20 0x40 ThisIsAnAlias Reg4; The above code will compile into the equivalent of the following discrete ''Write'' statements: Write @ 1000 = 1; Write @ 1001 = 2; Write @ 1002 = 4; Write @ 1003 = 0x10; Write @ 1004 = 0x20; Write @ 1005 = 0x40; Write @ 1006 = xx; // xx Would Be Replaced With The Value Of ThisIsAnAlias Write @ 1007 = Reg4; ==== WriteCtrl ==== The ''WriteCtrl'' statement is used to set control lines to a specific value. This is equivalent to the standard ''WRITE CTL'' statement in 9LC. The syntax of the ''WriteCtrl'' statement is: ''WriteCtrl ;'' WriteCtrl 11000100; WriteCtrl 0x3F; WriteCtrl Reg5; ==== Learn ==== The ''Learn'' statement is used to cause the 9010A to start the Learn operation on an address range of the UUT. This is equivalent to the ''LEARN'' statement in 9LC. The syntax of the ''Learn'' statement is: ''Learn'' or ''Learn From
To
;''. Learn; Learn From Value To Value2; Learn From 4096 To 0x1FFF; If you use the default version of the ''Learn'' statement, the default learn range will be the address range of the specified Pod (see [[Setup Statements#SetupPod]]) or the Pod that is connected at runtime. ==== AutoTest ==== The ''AutoTest'' statement performs a sequence of tests on the UUT. If your 9010A's firmware version is less than **2C**, the test sequence is: - Bus Test - ROM Test - Short RAM Test - IO Test But if the version is **2C** or later, the sequence is: - Bus Test - Short RAM Test - ROM Test - IO Test This is equivalent to the ''AUTO TEST'' statement in 9LC. The syntax of the ''AutoTest'' statement is: ''AutoTest;'' AutoTest; ==== BusTest ==== The ''BusTest'' statement performs the Bus Test on the UUT, using the address indicated by the specified Pod (see [[Setup Statements#SetupPod]]) or the Pod that is connected at runtime. This address is also specified by the [[Setup Statements#SetupBusTestAddress]] statement: This is equivalent to the ''BUS TEST'' statement in 9LC. The syntax of the ''BusTest'' statement is: ''BusTest;'' BusTest; ==== LongRAMTest ==== The ''LongRAMTest'' statement is used to perform a more extensive RAM test than the ''ShortRAMTest'' statement. In addition to the same tests performed by ''ShortRAMTest'' it also performs pattern-sensitivity tests. This is equivalent to the ''RAM LONG'' statement in 9LC. The syntax of the ''LongRAMTest'' statement is: ''LongRAMTest From To ;'' The address range can be omitted if RAM areas are present in the address map. LongRAMTest; LongRAMTest From 0x1000 To 0x1400; ==== ShortRAMTest ==== The ''ShortRAMTest'' statement is used to perform basic RAM tests that can help identify hardware problems with RAM as well as uncover stuck bits and decoding errors. This is equivalent to the ''RAM SHORT'' statement in 9LC. The syntax of the ''ShortRAMTest'' statement is: ''ShortRAMTestFrom To ;'' The address range can be omitted if RAM areas are present in the address map. ShortRAMTest; ShortRAMTest From 0x0A00 To 0x1A00; ==== ROMTest ==== The ''ROMTest'' statement is used to confirm that a specified address range is readable and also calculates a signature value based on the data contained in that range. It can also be used to compare the calculated checksum against a known value. This is equivalent to the ''ROM TEST'' statement in 9LC. The syntax of the ''ROMTest'' statement is: ''ROMTest From To CSum ;'' The address and range can be omitted if ROM areas are present in the address map. The checksum can also be omitted to inhibit the checksum compare. ROMTest; ROMTest From 0x2000 To 0x2400 CSum 0xF1C3; ROMTest From 0x2000 To 0x2400; ==== IOTest ==== The ''IOTest'' statement is used to test read/write bits in I/O areas/registers. This is equivalent to the ''IO TEST'' statement in 9LC. The syntax of the ''IOTest'' statement is: ''IOTestFrom To Bits ;'' The address and range can be omitted if I/O areas are present in the address map. IOTest; IOTest From 0x3000 To 0x3004 Bits 0x28; ==== Ramp ==== The ''Ramp'' statement performs a sequence of write operations at the specific location. The first write is ''0x00'' (all bits set to zero) and successive writes are made after incrementing this value until all bits are set to one. For example, on an 8-bit architecture, the range of values would be ''0x00'' to ''0xFF''. This is equivalent to the ''RAMP'' statement in 9LC. The syntax of the ''RAMP'' statement is: ''RAMP @
;'' RAMP @ 0x4242; ==== Walk ==== The ''Walk'' statement performs a sequence of write operations at the specific location, but instead of incrementing a value, it rotates the bits of the value. first write is the specified value and then the bits in the value are rotated once and the write is repeated. This repeats until all bits have been rotated through all possible positions. This is equivalent to the ''WALK'' statement in 9LC. The syntax of the ''WALK'' statement is: ''WALK @
;'' WALK @ 0x4242 0xA5; ==== ToggleAddress ==== The ''ToggleAddress'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== ToggleData ==== The ''ToggleData'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== ToggleCtrl ==== The ''ToggleCtrl'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== Stop ==== The ''Stop'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== RunUUT ==== The ''RunUUT'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== Register Modification Operations ==== Registers can be modified values via standard assignment statements, or via unary operators. The ''Template'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template; ==== Template ==== The ''Template'' statement is... This is equivalent to the ''TEMP'' statement in 9LC. The syntax of the ''Template'' statement is: ''Template;'' Template;