07-08-2013, 01:00 AM
Hello there! I have recently been working on a CPU known as the SNO CPU (Link here: http://openredstone.org/forums/showthrea...86#pid3686 ), and because many people like to program computers, I thought I would show you the language(Assembly 6081) for the SNO CPU.
REGISTER NAMES:
AO - ALU OUTPUT
R1 - REG 1
R2 - REG 2
AR1 - ALU REG 1
AR2 - ALU REG 2
COMMANDS:
NULL
READ
WRITE
END
JUMP
JUMP IF =
JUMP IF >
JUMP IF <
INP
OUT
COMCHANGE
USES OF COMMANDS:
NULL- Skips line
END- Ends a command
READ AND WRITE- Uses Read, Write, and the end command. When starting a read, put the location to read from, and when you dont need to read, use the end command. EXAMPLE:
What it will do: It will enable the AO to the bus, Write it to register 1, and Disable the AO.
JUMPS- Your simple jump command with conditional branching.
INP- Inputs 16 bit word directly from CPU
COMCHANGE - changes the command that the ALU is performing (Choices are add, subtract, XOR, XNOR, AND, NAND)
EXAMPLE PROGRAM:
What it does:This program takes an input, and multiplys it by 2. The way it multiplys is by adding it to itself.
EXAMPLE:
INPUTS: 0101 0110 0110 0101(22,117 in decimal)
OUTPUTS: 1010 1100 1100 1010(44,234 in decimal)
REGISTER NAMES:
AO - ALU OUTPUT
R1 - REG 1
R2 - REG 2
AR1 - ALU REG 1
AR2 - ALU REG 2
COMMANDS:
NULL
READ
WRITE
END
JUMP
JUMP IF =
JUMP IF >
JUMP IF <
INP
OUT
COMCHANGE
USES OF COMMANDS:
NULL- Skips line
END- Ends a command
READ AND WRITE- Uses Read, Write, and the end command. When starting a read, put the location to read from, and when you dont need to read, use the end command. EXAMPLE:
Code:
READ AO
WRITE REG1
END WRITE
END READ
What it will do: It will enable the AO to the bus, Write it to register 1, and Disable the AO.
JUMPS- Your simple jump command with conditional branching.
INP- Inputs 16 bit word directly from CPU
COMCHANGE - changes the command that the ALU is performing (Choices are add, subtract, XOR, XNOR, AND, NAND)
EXAMPLE PROGRAM:
Code:
INP
WRITE AR1
END WRITE
WRITE AR2
END WRITE
END INP
COMCHANGE ADD
READ AO
WRITE R1
END WRITE
END READ
OUT R1
EXAMPLE:
INPUTS: 0101 0110 0110 0101(22,117 in decimal)
OUTPUTS: 1010 1100 1100 1010(44,234 in decimal)