C-LONG

C-LONG is an esoteric programming language by User:Zzo38 with long lines (it doesn't have anything to do with C programming, though.)

Each line is the same length and is filled by these characters:
 * 0 to 9 - digits
 * A to Z - letters (uppercase only)
 * _ - blank
 * . - period
 * * - special character representing newline
 * !@#$% - when used, is automatically replaced with value of register before execution of command line

The line format is:
 * LABEL: 8 characters giving line label
 * NEXT: 8 characters giving the line it will go to next (regardless of condition true/false)
 * NAME1: 8 characters giving first variable name
 * NAME2: 8 characters giving second variable name
 * COND1IS1: 1 character giving conditional to skip command unless bit in first variable is 1
 * COND1IS0: 1 character giving conditional to skip command unless bit in first variable is 0
 * COND2IS1: 1 character giving conditional to skip command unless bit in second variable is 1
 * COND2IS0: 1 character giving conditional to skip command unless bit in second variable is 0
 * CONDSAME: 1 character giving conditional to skip command unless bit in first variable is same as bit in second variable
 * CONDDIFF: 1 character giving conditional to skip command unless bit in first variable is not same as bit in second variable
 * CONDXTRA: 1 character giving conditional to skip command unless an additional condition is true
 * AXCHAR: 1 character is an additional character that might be used by some commands
 * INIT: 1 character giving operation to figure out initial value of working value, var1 (operation) var2
 * BITADJ: 4 characters telling which bits to toggle in working value
 * SHIFT: 1 character telling how many bit positions to shift left (wraps around to right) a digit 0 to 9 or letters for A=10, B=11 etc, you can use blank instead of 0 if you want to
 * SAVE1: 1 character telling operation of what to store to var 1, set var1 = var1 (operation) working value
 * SAVE2: 1 character telling operation of what to store to var 2, set var2 = var2 (operation) working value
 * SAVEREG: 5 characters telling what characters will be stored in !@#$% registers
 * COMMAND: 3 characters giving an additional command to execute, use ___ for no extra command

This shows you the fields in 1 line: ++++++++++++++++-+-+-+-+-++++-+-+++++---

Variables can be 2 types, bit-fields or command-lines. If it is a command-line with same line label as variable name then it is a command-line type that is modification of that command-line (for doing self-modifying codes). The label does not count as part of the value. A bit-field is 32 bits, any name that isn't a line label, it is initialized to zero.

The working value has the type of the first variable. If an operation is performed with incompatible types, it uses the type of the first operand, and the second operand is set to all zero bits or to all blank spaces.

Bit positions of a bit-field is labeled like this: ABCDEFGH IJKLMNOP QRSTUVWX YZ012345

In any condition (COND) field you can use _ (blank) for don't use this condition.

There are two stacks, one for bit-fields, and one for command-lines.

For bit-fields the operations are:
 * _</tt> = Always returns all bits are 0 for read, but means no change for write
 * 0</tt> = Always returns all bits are 0
 * 1</tt> = AND
 * 2</tt> = Result bits will be 1 only if first source is 0 and second source is 1
 * 3</tt> = Result is same as second source
 * 4</tt> = Result bits will be 1 only if first source is 1 and second source is 0
 * 5</tt> = Result is same as first source
 * 6</tt> = XOR
 * 7</tt> = OR
 * 8</tt> = NOR
 * 9</tt> = XNOR
 * A</tt> = NOT of first
 * B</tt> = Result bits will be 0 only if first source is 1 and second source is 0
 * C</tt> = NOT of second
 * D</tt> = Result bits will be 0 only if first source is 0 and second source is 1
 * E</tt> = NAND
 * <tt>F</tt> = Always returns all bits are 1
 * <tt>I</tt> = Add numbers together
 * <tt>J</tt> = Subtract second from first
 * <tt>Z</tt> = First source is shift left 1 space (wraps)
 * <tt>.</tt> = Input a bit-field and store that value

For command-lines the operations are:
 * <tt>_</tt> = Result is same as current command line for read, no change for write
 * <tt>0</tt> = All characters are AXCHAR
 * <tt>1</tt> = Result is same as first source
 * <tt>2</tt> = Result is same as second source
 * <tt>A</tt> = First source with all characters matching AXCHAR replaced with character in same position from second source
 * <tt>B</tt> = Second source with all characters matching AXCHAR replaced with character in same position from first source

For CONDXTRA of bit-fields variables you can use:
 * <tt>0</tt> = If both variables have same value
 * <tt>1</tt> = If both variables do not have same value
 * <tt>2</tt> = If var1 value is zero
 * <tt>3</tt> = If var1 value is not zero
 * <tt>4</tt> = If var1 value is less than var2 value
 * <tt>Y</tt> = Always true
 * <tt>Z</tt> = Always false
 * <tt>*</tt> = Always false

For CONDXTRA of command-line variables you can use:
 * <tt>0</tt> = If both variables have same value
 * <tt>1</tt> = If both variables do not have same value
 * <tt>2</tt> = If var1 value does not contain any characters matching AXCHAR
 * <tt>3</tt> = If var1 value does contain any characters matching AXCHAR
 * <tt>Y</tt> = Always false
 * <tt>Z</tt> = Always true
 * <tt>*</tt> = Always false

For a command-line value, the BITADJ field is used by the first character indicating the type and the other 3 are parameters x,y,z:
 * <tt>_</tt> = Nothing
 * <tt>0</tt> = Change all characters matching parameter x to parameter y
 * <tt>1</tt> = Change all characters matching x to y, y to x
 * <tt>2</tt> = Change all characters matching x to y, y to z, z to x
 * <tt>3</tt> = Change all characters matching x to character in position of var1
 * <tt>4</tt> = Change all characters matching x to character in position of var2
 * <tt>5</tt> = Change all characters not matching x to y
 * <tt>6</tt> = Change all characters matching x to y, and all that don't match x to z

Additional commands that can be used in COMMAND field:
 * <tt>COP</tt> = Copy NAME1 to NEXT field of var2
 * <tt>END</tt> = Program terminates
 * <tt>HEX</tt> = Set ! register to a 0-9A-F of least significant nybble in working value, set @ register to 0-9A-F of second least significant nybble, # register of third, $ register of fourth, % register of fifth. Only the registers will be set if that field in the command-line is set to <tt>*</tt> (newline)
 * <tt>INP</tt> = Input a character, store in any registers that the field in command-line is set to <tt>*</tt>
 * <tt>NEX</tt> = If working value is a command-line then it will change all registers that the field is <tt>*</tt> to the one right after that one in the working value, wraps to beginning
 * <tt>OD_</tt> = Output working value as a decimal number
 * <tt>OH_</tt> = Output working value as a hexadecimal number
 * <tt>OUT</tt> = Output the working value, either a bit-field, or if it is a command-line then only the parts that are the same position as characters in var1 matching AXCHAR
 * <tt>POP</tt> = Pop value from stack, store in var1
 * <tt>PUS</tt> = Push working value to stack
 * <tt>SYS</tt> = Interact with system. AXCHAR is the command code, working value is input, result is stored in var2

Examples
Hello world example: ++++++++++++++++-+-+-+-+-++++-+-+++++--- 0000000100000002*******8HELLO_WO_______.________!@#$%OUT 0000000200000003*******4RLD*___________.________!@#$%OUT 00000003_____________________________________________END *******8________________........________________________ *******4________________....____________________________ ++++++++++++++++-+-+-+-+-++++-+-+++++---

Beer program: ++++++++++++++++-+-+-+-+-++++-+-+++++--- START___LOOP01_____________________________________99___ LOOP01__BEER____LOOP02__RETURN___________________@8$%COP LOOP02__BEER____LOOP03__RETURN___________________@2$%COP LOOP03__LOOP04__TEXT8___TAKE_ONE_______._________@_$%OUT LOOP04__LOOP05__TEXT8____DOWN_AN_______._________@_$%OUT LOOP05__LOOP06__TEXT8___D_PASS_I_______._________@_$%OUT LOOP06__LOOP07__TEXT8___T_AROUND_______._________@_$%OUT LOOP07__DECREMENTEXT1___*______________._________@_$%OUT LOOP08__BEER____LOOP09__RETURN___________________@8$%COP LOOP09__LOOP01__TEXT2___**_____________._________@_$%OUT LOOP_Q__FINAL1__TEXT6___NO_MOR_________._____________OUT FINAL1__BEER____FINAL2__RETURN___________________R8_ECOP FINAL2_______________________________________________END DECREMENDECR01__9_00____________________1_______8@0$*NEX DECR01__DECR02__%_00__________________Z_1_______8@0*%NEX DECR02__DECR03__9_$$__________________Z_________8R0$%___ DECR03__DECR04__9_%$__________________Z_________Q@_$%___ DECR04__LOOP#!__________________________________!@#$%___ BEER____BEER1___TEXT8@__$%_BOTTL_______._________@#$%OUT BEER1___BEER2___TEXT8___ES_OF_BE_______._________@#$%OUT BEER2___RETURN__TEXT#___ER_ON_TH______Z._________@#$%OUT RETURN__________TEXT#R___E_WALL*______Z._________@#$%OUT TEXT1___________________._______________________________ TEXT2___________________..______________________________ TEXT6___________________......__________________________ TEXT8___________________........________________________ TEXT8R___________________.......________________________ TEXT2R_________________________.________________________ 9_00____________98765432109_____________________________ ++++++++++++++++-+-+-+-+-++++-+-+++++---