simon987 / Much-Assembly-Required

Assembly programming game
GNU General Public License v3.0
930 stars 87 forks source link

Implement setcc instructions#184 #191

Closed kevinramharak closed 5 years ago

kevinramharak commented 5 years ago

! Needs feedback and additional changes before being merged !

This is a PR to get some feedback on the changes in architecture before implementing the whole family of instructions + tests.

The changes are kept to a minimal:

Because the @Override encode(...) function has no other method of knowing its mnemonic than getMnemonic the SETcc family needs its aliases to extends the base SetccInstruction. This will provide the correct return value to getMnemonic when the assembler calls encode on an instruction. This will have no impact on the CPU executing the instruction since the CPU always looks up an instruction based on its opcode.

The SetccInstruction does a bit to much for my liking but spreading the logic to each sub class will (IMO) not improve the readability. I am also not sure if this is possible with the current Assembler and CPU implementations.

kevinramharak commented 5 years ago

Ok, I added all tests. Found a few bugs while writing them. The PR is getting huge but im not done yet. I will still have to make changes to the front end editor. Ill try to get that done in the weekend. Once thats finished this PR should be ready to go.

kevinramharak commented 5 years ago

@simon987 I added the syntax highlighting and editor support. The front end is a bit of a mess, but thats another issue.

This is a lot of commits and files tough a lot is boiler plate. If this PR gets merged ill update the wiki where applicable

simon987 commented 5 years ago

thank you

kevinramharak commented 5 years ago

wups i think i forgot to add the aliases to the default instruction set. I can fix this at thr end of today