Fix for [sp+n] instruction length, DIV EXtension, EX evaluation order and option for shift behaviour#49
Fix for [sp+n] instruction length, DIV EXtension, EX evaluation order and option for shift behaviour#49orlof wants to merge 4 commits intoHerobrinesArmy:masterfrom orlof:master
Conversation
…5 bit values as in java, or do whatever length as dcpu spec implies
|
Can you explain the reasons for each of the changes (are they corrections to incorrect emulation behaviour; if so, what was wrong, etc.)? Also, it looks like, in "fixed instruction length for sp+n", on line 235, you put "atype == 26" when it looks like you probably meant to put "btype == 26". Then again, I don't know what the change was for in the first place, so maybe it's supposed to be that way. :P Also, my applause to you for diving into a bunch of mostly-undocumented code to try to improve it. I know that's always fun. :P |
|
(edited to clarify text) Here are my excuses... :) Sorry for the low quality PR - I wasn't expecting anyone to process it as last commits were couple of years back :) I should have done better job with both code and documentation. Anyway I was utilizing your emulator code and felt that I should point out defects that I felt were present. Fix for [sp+n] instruction length I didn't have test case for this, but by reviewing the code it seemed that the if expressions for detecting [SP + next word] were missing. However, if that is already handled somewhere else, my fix is wrong. In line 236 my fix is defect - it should be btype, just as you pointed out. Fix for EX and operand b evaluation order
Cleanup of switch structure I have also unified the case statements. I changed them all to use the same format. They all use Feature - configurable shift behaviour Java specification states explicitly that "only the five lowest-order bits of the right-hand operand are used as the shift distance". In DCPU specification there is no such statement. My interpretation is that shift distance is then defined with 16 bits. However, the community de facto implementation seems to follow the Java standard. Correct implementation was not clear to me, so I made a switch SHIFT_DISTANCE_5_BITS to change the behaviour. Fix for DIV instruction |
No description provided.