ToroCraft / Minecoprocessors

Increase your redstone possibilities and learn assembly programming at the same time with the Minecoprocessors Minecraft Mod!
https://minecraft.curseforge.com/projects/minecoprocessors
GNU General Public License v3.0
33 stars 10 forks source link

Add more instructions #34

Closed frodare closed 7 years ago

frodare commented 7 years ago

Candidates:

(memory instructions will be included in another issue)

Meh?

XCH - instruction loads the accumulator with the byte value of the specified operand while simultaneously storing the previous contents of the accumulator in the specified operand.

Unlikely

SWAP - instruction exchanges the low-order and high-order nibbles within the accumulator. No flags are affected by this instruction.

XRL - instruction performs a logical exclusive OR operation between the specified operands. The result is stored in the destination operand. (too close to XOR)

josephcsible commented 7 years ago

Thoughts:

I like the rest of them.

frodare commented 7 years ago

Great points, I updated the list of candidates.

josephcsible commented 7 years ago

It looks like with CLR, "CLR whatever" is the same as "MOV whatever, 0", which doesn't really seem to be worth it. What I meant to add was a CLRB to do just the opposite of SETB.

frodare commented 7 years ago

The TNT command! How horrible would that be, bwhahahah.

josephcsible commented 7 years ago

I don't really see the point to SEZ, CLZ, SEC, CLC, and it's easy enough to cause a fault by doing "DIV 0", so we really don't need HLT. Are they really worth having?

frodare commented 7 years ago

They were easy to add didn't take much code, so don't see a reason not to have them. I figured HLT might useful so that the processor could be clearly stopped without throwing an error. Right now the other four instructions are the only way to directly update the flags, not that I can think of a reason for doing so.

josephcsible commented 7 years ago

How does HLT not throw an error? It looks like it just sets "fault" to true, which is the exact same thing that happens if you do "DIV 0". (And I've never heard of an assembly language that lets you directly set those flags.)

frodare commented 7 years ago

In the end it more about clarity if you were sharing programs with other players. Right now the NEXT box on the GUI shows the first line that failed to parse in red, in the future I would like it to show the line it failed during run time too, for instance DIV 0.