Scrap Mechanic

Scrap Mechanic

Not enough ratings
TIMCpu the modpack 1
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
245.313 KB
13 Mar, 2022 @ 1:34am
1 Change Note ( view )

Subscribe to download
TIMCpu the modpack 1

In 1 collection by smailovtimofey
TimCPU and other machines
23 items
Description
Small cpu what can alot of things

Marks

marks is white acii blocks with number on it

0 - manual memory control unit
orange swich - mmcu toggle(first turn off cpu)
brown and orange buttons - go addres up or down
red button - reset current mem address
brown switch - fast memory clear(orange switch needs to be on, then press red button) - clears all addreses from current address to 0

1 - prog launcher
orange button - Run program
black button(if it has) - write value to output(2)
gray button(if it has) - write value(watch screenshot)
white button(if it has) - reset programm counter

2 - output value
orange button - reset

3 - input
numpad - write value to input - reg0
logic gate - is value written

4 - main control pannel
green button - Run program
green switch and numbers - toggle counter limit
brown and orange buttons - go limit up or down
red button - reset counter
red switch - power toggle(if power is on machine will be run programm)
purple button - Singlestep mode(on run, up counter to 1 and end)
blue switch - jump after end command(if cpu ends with task, jump to next counter position)

for normal cpu work activate red and blue swith
for like TIMCpu logic computers work, activate red, blue, and purple switch

!!!for normal timcpu work, activate limiter!!!

5 - seed changer
orange and brown buttons - change seed

seed used for communication to remote program writer

code understanding with program writer

if you want just write program on it, then use my compiller: https://github.com/timofey260/ScrapCPU

else - use this

program writer

for writing program of program writer, turn off the cpu

all buttons:
orange and brown buttons on left - change seed(seed shows on back side)
red button - write OPCODE and RESULT
yellow button - reset counter to zero
orange and brown buttons on front side - change counter position
numbers on top side - current counter address
green button - run program
blue switch - cleaner toggle
white button - clean current counter address(all numpads need to be off and blue switch needs to be on)
orange switch - run fast code cleaner(blue switch needs to be on, then press white button)
numpads - change arguments


cpu use 4 arguments - OPCODE, ARG1, ARG2, RESULT
every line of code use this arguments

code writing without compiller


OPCODE is 8-bit value
if 8-bit(128) of OPCODE is on, then ARG1 will be a value(else will be register value)
if 7-bit(64) of OPCODE is on, then ARG2 will be a value(else will be register value)
if 6-bit(32) of OPCODE is on, then cpu complete a condition
if OPCODE is 16, and ARG1, ARG2, RESULT is 0, then cpu waits for uer input

math

last 4 bytes used for operation:
if 6-bit(32) of OPCODE is off, then cpu complete a math with ARG1 and ARG2

all math operations:
0001 - add
0010 - sub
0011 - multiply
0100 - divide
0101 - exponentiation
0110 - 32-byte and
0110 - 32-byte or
0110 - 32-byte xor
0110 - 32-byte not(takes only ARG1)

then return value to RESULT register
if RESULT is 0 then returns to output(2)

REG0 for RESULT is output and for ARG1 and ARG2 is input

Example: 11000000 12 23 00000001 - adds 23 and 12 to REG1
Example: 11000001 200 15 00000000 - subs 200 and 15 to OUTPUT
Example: 11000010 2 2 00000010 - multiply 2 by 2 to REG2
Example: 01000000 2 2 00000010 - adds REG2 and 2 to REG2

condition mode
if 6-bit(32) of OPCODE is on, then cpu complete a condition between ARG1 and ARG2

all conditions:
==
!=
>
>=
<
<=

if condition is right, then program jumps to RESULT(set counter to RESULT value)
else program goes next(counter +1)

Example: 01100000 1 23 00000001 - if REG1 = 23, then jump to 1
Example: 11100000 1 1 00000011 - if 1 = 1, then jump to 3(always jumps to 3)
Example: 01100000 1 23 00000010 - if REG1 != 23, then jump to 2

Links

https://github.com/timofey260/ScrapCPU - compiller
https://github.com/timofey260/ScrapCPU/wiki - wiki