Scrap Mechanic

Scrap Mechanic

评价数不足
TIMCpu the modpack 2 calculator code
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
28.110 KB
2022 年 3 月 28 日 上午 5:39
1 项改动说明 ( 查看 )

订阅以下载
TIMCpu the modpack 2 calculator code

在 smailovtimofey 的 1 个合集中
TimCPU and other machines
23 件物品
描述
calculator for TIMCpu the modpack 2

instructions:
0 make sure what TIMCpu and code has same seed
1 output shows one, then enter first number
2 output shows two, then enter operation
(1 - +, 2 - -, 3 - *, 4 - /, else jump to zero)
3 output hows three, then enter second number
4 output shows result

code:
CONS ADD 5 also i can place here any comments
MARK START
COPY 1 OUT
WAIT for user input
COPY INP REG1
COPY 2 OUT
WAIT
COPY INP REG2 operation 1 - + 2 -- 3 -* 4 - /
COPY 3 OUT
WAIT
COPY INP REG3
COPY 0 OUT

TEST REG2 = 1 AD
TEST REG2 = 2 SB
TEST REG2 = 3 ML
TEST REG2 = 4 DV
JUMP START
MARK AD
ADDI REG1 REG3 REG4
JUMP SOL
MARK SB
SUBI REG1 REG3 REG4
JUMP SOL
MARK ML
MULI REG1 REG3 REG4
JUMP SOL
MARK DV
DIVI REG1 REG3 REG4
MARK SOL
COPY REG4 OUT

code compilled:
| num|| OPCODE || ARG1 || ARG2 || RESULT |
| 0||11000000(192)|| 1|| 0|| 00000000( 0)|
| 1||00010000( 16)|| 0|| 0|| 00000000( 0)|
| 2||01000000( 64)|| 0|| 0|| 00000001( 1)|
| 3||11000000(192)|| 2|| 0|| 00000000( 0)|
| 4||00010000( 16)|| 0|| 0|| 00000000( 0)|
| 5||01000000( 64)|| 0|| 0|| 00000010( 2)|
| 6||11000000(192)|| 3|| 0|| 00000000( 0)|
| 7||00010000( 16)|| 0|| 0|| 00000000( 0)|
| 8||01000000( 64)|| 0|| 0|| 00000011( 3)|
| 9||11000000(192)|| 0|| 0|| 00000000( 0)|
| 10||01100000( 96)|| 2|| 1|| 00001111( 15)|
| 11||01100000( 96)|| 2|| 2|| 00010001( 17)|
| 12||01100000( 96)|| 2|| 3|| 00010011( 19)|
| 13||01100000( 96)|| 2|| 4|| 00010101( 21)|
| 14||11100000(224)|| 0|| 0|| 00000000( 0)|
| 15||00000000( 0)|| 1|| 3|| 00000100( 4)|
| 16||11100000(224)|| 0|| 0|| 00010110( 22)|
| 17||00000001( 1)|| 1|| 3|| 00000100( 4)|
| 18||11100000(224)|| 0|| 0|| 00010110( 22)|
| 19||00000010( 2)|| 1|| 3|| 00000100( 4)|
| 20||11100000(224)|| 0|| 0|| 00010110( 22)|
| 21||00000011( 3)|| 1|| 3|| 00000100( 4)|
| 22||01000000( 64)|| 4|| 0|| 00000000( 0)|

https://github.com/timofey260/ScrapCPU compiller
https://github.com/timofey260/ScrapCPU/wiki/TM-Demos other demos