The following is a list of all CHS-8 instructions, their details, and their 8-bit binary codes. If something is red it isn't added yet.
Flags are OUZS
INSTRUCTION - CODE - FORMAT - DETAILS
LDA - 00000001 - LDA <num-8bit OR adr-8-16bit> - sets the A register to an 8 bit number or the value at an address
STA - 00000010 - STA <adr-8-16bit> - sets the value at an address (or X or Y) to the value in A
ADD - 00000011 - ADD <num-8bit OR adr-8-16bit> - Adds <num-8bit> to the A register. If the result goes over 255 the O (overflow) flag is set to 1.
SBT - 00000100 - SBT <num-8bit OR adr-8-16bit> - Subtracts <num-8bit> from the A register. If the result goes below zero, the U (underflow) flag is set to 1.
CLO - 00000101 - CLO - sets the overflow flag to 0.
SEO - 00000110 - SEO - sets the overflow flag to 1.
CLU - 00000111 - CLU - sets the underflow flag to 0.
SEU - 00001000 - SEU - sets the underflow flag to 1.
BRK - 00001001 - BRK - stops program execution.
JMP - 00001010 - JMP <num-16bit OR adr-16bit> - sets the Program Counter to line <num-16bit> or the program. If you use $ (addressing) it will assume a 16-bit address and jump to whatever 16-bit number is stored in the two bytes after (inclusive) that address.
LDX - 00001011 - LDX <num-8bit OR adr-8-16bit> - Sets the X register to an 8 bit value or the number at an address.
STX - 00001100 - STX <adr-8-16bit> - sets the value at an address (or A or Y) to the value in X
LDY - 00001101 - LDY <num-8bit OR adr-8-16bit> - Sets the Y register to an 8 bit value or the number at an address.
STY - 00001110 - STY <adr-8-16bit> - sets the value at an address (or X or A) to the value in Y.
INA - 00001111 - INA - increases A by 1.
DEA - 00010000 - DEA - decreases A by 1.
INP - 00010001 - INP <optional num-8bit> - checks inputs, loads them to INP_RAM_POS for 8 bytes in the order LEFT, RIGHT, UP, DOWN, Z, X, C, ENTER. If <optional num-8bit> isn't 0, it sets A to the corresponding input (starting at 1) so INP,00000001 sets A to LEFT.
JMH - 00010010 - JMH <Header 8bit> - Jumpts to a header defined by <Header 8bit> in HED <Header 8bit>
BNE - 00010011 - BNE <num-16bit OR adr-16bit> - if the Zero flag is not set, JMP to <adr-16bit> with all the same logic as JMP.
BEQ - 00010100 - BEQ <num-16bit OR adr-16bit> - if the Zero flag is set, JMP to <adr-16bit> with all the same logic as JMP.
CMP - 00010101 - CMP <num-8bit OR adr-8-16bit> - compares <num-8bit OR adr-8-16bit> to the value in A. if equal, Zero flag is set to 1, if not, Zero flag is set to 0.
SEZ - 00010110 - SEZ - sets the zero flag to 1.
CLZ - 00010111 - CLZ - sets the zero flag to 0.
UDS - 00011000 - UDS <optional 8/16-bit address> - updates the screen's display starting from display ram, but if another address is provided it starts from there.
PXL - 00011001 - PXL <num-8bit OR adr-8-16bit> - sets a pixel at (X,Y) to a 4-bit color (only 3 bits of color right now) <num-8bit OR adr-8-16bit>.
INX - 00011010 - INX - increases X by 1
INY - 00011011 - INY - increases Y by 1
DEX - 00011100 - DEX - decreases X by 1
DEY - 00011101 - DEY - decreases Y by 1
HED - 00011110 - HED <num-8-16bit> or HED,hed name - defines 2 bytes in Hed Ram that give a line in program memory. If inputting a number <num-8bit> must be even and different from all other HED commands. HEDs are stored at Hed Ram and there can be 128 in any program. If inputting a name, the name CANNOT BE THE SAME AS A VARIABLE.
PRT - 00011111 - PRT "string" - a debugging command for development, prints string. dont use in actual programs.
CLT - 00100000 - CLT <num-8bit OR adr-8-16bit> - same as CMP but sets Z flag if less than
CGT - 00100001 - CGT<num-8bit OR adr-8-16bit> - same as CMP but sets Z flag if greater than
SKP- 00100010 - SKP- sets the S flag to the Z flag, if the S flag is 1 when an instruction would be executed the line is skipped. Execution only resumes after a CLS. Basically runs the line after SKP only if the last comparison was false.
HNE - 00100011 - HNE <Header 8bit> - Jumpts to a header defined by <Header 8bit> in HED <Header 8bit> if Z flag is 0
HEQ - 00100100 - HEQ <Header 8bit> - Jumpts to a header defined by <Header 8bit> in HED <Header 8bit> if Z flag is 1
TAX - 00100101 - TAX - sets X to A
TAY - 00100110 - TAX - sets Y to A
TXA - 00100111 - TAX - sets A to X
TYA - 00101000 - TAX - sets A to Y
TXY - 00101001 - TAX - sets Y to X
TYX - 00101010 - TAX - sets X to Y
RUN- 00101011 - RUN- sets the S flag to the opposite of the Z flag, if the S flag is 1 when an instruction would be executed the line is skipped. Execution only resumes after a CLS. Basically runs the line after RUN only if the last comparison was true.
TPS - 00101100 - TPS <8 or 16 bit number / address> - sets the max tps (or cycles/ticks per second) of the program to (argument * 100)
ENF - 00101101 - ENF - ends the frame early, program execution continues as normal but updates all the text and stuff. This increases lag DRASTICALLY because it decreases the amount of processing done per frame. This can be used to make sure the program doesn't freeze during long bits of computing.
VAR - 00101110 - VAR,name - makes a "variable" which is kinda like a label for a place in memory. When the assembler finds "VAR" it just replaces any instance of "name" with an automatically-assigned address starting at Variable Ram position (see Home ) and sets the var flag. For more details go to Variables .
SES- 00101111- SES - sets the skip flag to 1.
CLS- 00110000 - CLS - sets the skip flag to 0.