Tesla-P48D8 Micro Micromanagement Computer
Description:
The T-P48D8 is the smallest computer on Powder Toy at 54x54 pixels in size.
The P48D8 has eleven unique instructions, and partially works on RISC principles.
Physical:
The T-P48D8 has nine registers, A, and GP registers r0 to r7. Registers r0-r7 may also be referred to as simple RAM.
The P48D8 has one flag, the carry ('c') flag.
The P48D8 does not have a Program Counter. Instead, the P48D8 has a pointer on a 16-byte, 3 bank tape.
ROM:
The P48D8 has three 8-bit, 16 byte banks of embedded Read Only Memory tape.
The active bank switches when a command is interpreted at address F, or the BS instruction is encountered. NOTE: this means that even if a JP (jump) command is encountered as the last byte in a bank, the bank will still automatically switch. Meaning a JP command at address 0xF won't jump to an address in the current bank, it will jump to that address on the bank that is being switched to.
With every bank switch, it always increments from 0 to 1, from 1 to 2, and from 2 back to 0.
The ROM is stored in a 24-bit format, with the low byte for bank 0, the middle byte for bank 1, and the high byte for data in bank 2.
Example:
If you wanted to store an '18' in bank 2, a '2C' in bank 1, and a '8F' in bank 0, you would write an "182C8F" to the first pixel of the drive.
Pinout:
The T-P48D8 has two I/0 ports
The input port, located on the top right, takes an 8-Bit raw spectra number.
The output port, located on the bottom right, outputs an 8-Bit raw spectra number.
Commands:
bs
Bank Switch
ld
Load a value into a register or RAM.
Add
Add a value to A. The result is stored in A.
Inv
Toggle a flag
cpl
Two's compliment (invert)
jp
Jump execution to an address on the tape
Command structure
|Condition bit
||Instruction value
|| |Alt. bit
|| ||Parameter bits
|[-]|[-]
00000000
If the condition bit is set, the opcode will run if the c flag is set. If not, the Control Unit executes the next byte instead. If the bit is not set, the instruction runs regardless.
The Alt. bit determines if the Control Unit will use a command's Alt. function instead of its primary function.
Opcodes:
|Decimal
| |Hexidecimal
| | |Binary
| | | |Byte length
| | | | |Effects flag
| | | | | |Mneumonic
| | | | | | |Alt. effects flag
| | | | | | | |Alt. mneumonic
| | | | | | | | |Notes
|00|0|000|1|0|bs |0|bs |Increments the current bank. Tape position is not destroyed.
|01|1|001|2|1|ld A,d8 |1|ld A,d8 |Loads an 8-bit value into register A. Only opcode that is two bytes long.
|02|2|010|1|0|ld (r3),A|0|ld (r3),A|Loads a byte from addressed RAM into A. Bits 2-0 in the opcode are used as the address of the byte in RAM.
|03|3|011|1|1|ld A,(r3)|1|ld A,(r3)|Loads register A into addressed RAM. Bits 2-0 in the opcode are used as the address of the byte in RAM.
|04|4|100|1|0|jp a4 |0|jp a4 |Moves the reader head to a specific position on the tape. Since the parameter of this command is four bits, it uses the three parameter bits and the Alt. bit; hence, this opcode has no Alt. function.
|05|5|101|1|1|inv c |c|cpl A |Inv c simply toggles the c flag, setting the condition bit turns the function into 'res c'. Cpl a inverts every bit in A, sets the c flag if bit 7 in A was set prior to the command.
|06|6|110|1|c|add (r3) |c|add d3 |Adds either a byte in RAM or a 3-bit immediate value to A. The address in RAM/the immediate value are in bits 0-2 in the opcode.
|07|7|111|1|0|output A |1|Input A |Pulse A out of the Output port or load the last value received on the Input port into A. The input port is zeroed on read.
Flags:
0:Does not toggle flag
c:Toggles flag based on state
1:Toggles flag
Opcode Examples:
"Add A,5" (Add A,d3) in memory would be %01101101 in binary or $6D in hexidecimal.
Bit 7 (the leftmost bit) is reset (0) as the command is not conditional
Bits 6-4 are 110 (6 in decimal) because that is the command's opcode
Bit 3 is set because "Add A,d3" is an alternative function of "Add A,(r3)", so the "Alt. Bit" should be set
Bits 2-0 are 101 (5 in decimal) because that is the value added to A
Note, though the P48D8 is lacking in many standard operations, a few can be emulated through variations of Add A,d3. Ex: "inc A" can be subtituted with "Add A,1" and "NOP" can be substituted with "Add A,0"
Or you can take the time to learn the fundamentals of computer science/design. There is no way for you to program a computer in either assembly or machine code without understanding what a register is and how binary is used to represent numbers in a computer, amongst other things.
I have to agree with chemlab, this is a poorly written manual.
And before you retort with the CS excuse, i've done work with x86-64
Nevermind about that.
This is impossible
He made a save about it if you would look at it.
Dang, what'd I change in this manual to make it so bad?