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

Quality of life tweaks #53

Closed vddCore closed 6 years ago

vddCore commented 6 years ago

So I thought I'd add a few cents myself, since I'm using this mod like there's no tomorrow. The list of chages are as follows.

Additional conditonal jumps

JE/JNE - Aliases for JZ/JNZ JG/JGE - Jump if Greater / or Equal JL/JLE - Jump if Lesser / or Equal

Additional push/pop instructions

PUSHA - Pushes all GPRs onto stack in the following order: A B C D POPA - Pops 4 values from the stack into GPRs in the following order: D C B A

CMP instruction

The CMP instruction works like it does in x86 architecture, i.e. allows for JG/JL jumps; doesn't break existing code relying on JZ/JNZ.

New behavior of CMP a, b:

a == b -> ZF = 1, CF = 0
 a < b -> ZF = 0, CF = 1
 a > b -> ZF = 0, CF = 0

Code book tweaks

Code book now has a primitive indentation support for tab key - inserts 2 spaces at the current cursor position.

Processor fault codes

When a processor sets its fault flag it also sets a fault code that can be seen when hovering the mouse cursor over the fault flag in GUI. image

Processor fault codes are as follows: 0x00 - Division by zero. 0x01 - Stack underflow (pop when stack empty). 0x02 - Stack overflow. 0x03 - Undefined instruction pointer location. 0x04 - Code load error. 0x05 - Out of bounds error. 0xFE - Processor stopped using HLT instruction. 0xFF - Processor operating correctly (default state).

frodare commented 6 years ago

These look like nice changes, thanks! When I get a chance, I am going to look over this PR to see if I have any questions and probably merge it soon after.

frodare commented 6 years ago

@Ciastex I have uploaded these changes to curse, version 1.12.2-5, thanks again!