SHL - The Shift Left Command

The SHL command is a bitwise operation that takes the value in the accumulator and moves all of the bits to towards the MSB (to the left). The bit in the MSB is placed into the Carry Flag and a zero value is placed in the LSB.
After 8 SHL commands the value will be zero.
You can use this in conjunction with the BCC and BRC commands to interrogate individual bits without destroying their contents.
This command is the opposite of the SHR command.

Visual representation of the SHL command

Syntax

SHL
Notice that there are no values attached to the command. It simply moves everything one spot left putting the MSB in the Carry Flag and clearing the LSB.

The SHL command has the byproduct of multiplying the value by 2.

Examples

Example 1

Task1()
{
    Name="Dipswitch checker"    //Branches on the highest dipswitch set
    LDA ^59,0           //Get the dipswitch port
    SHL                 //Move Dipswitch 8 into the carry flag
    BRC DipSwitch8Set   //If carry flag is set branch.
    SHL                 //Move Dipswitch 7 into the carry flag
    BRC DipSwitch7Set   //If carry flag is set branch.
    ...
}

Example 2

This task uses the X Reg for a jump table

Task2()
{
    Name="Linear Preset Jump Table"
Start(0x1c,10,x,0x65,x,x,x) //Start on an area 10 linear preset message
Copy @0,~0,7                //Copy the message to user ram
LDA ~2          //Load the preset number into the accumulator
SHL             //Multiply the value by 2.
SHL             //Multiply the value by 2. This creates an offset of 4 for the jump table.
TAX             //Transfer the value in the accumulator to the x register
BRA PJumper,x   //Jump to the label plus the value in the x register
Null
PJumper:        //This is the jump table. The task will jump to the specified row.
    BRA P1
    BRA P2
    BRA P3
    BRA P4
    BRA P5
Null
      P1:
      //Do something for Preset 1
      Null
      ...
}