Textmode / TMVM

Textmode's Virtual Macaroni: A VM for, er...we'll get back to you.
Other
4 stars 0 forks source link

Improper decoding of MNZ instruction #13

Closed Boolsheet closed 13 years ago

Boolsheet commented 13 years ago

It seems to me that his function has some errors.

machine.lua:158 [0x0e]=function(self) -- MNZ RET, R, &nn # free-register conditional move to literal address local a, b = convreg(self, self.memory[self.IP+1])

    if a then
        self.memory[self.memory[self.IP+1]] = self[b]
    end
    return 3;
end;

'if a then' will always be true.
And on the next line, shouldn't that be 'self.IP+2'?

Textmode commented 13 years ago

Oh...oh wow...thats very, embarrassingly wrong!

Fixed, but not closing until I've had a chance to confirm the fix (created issue #14)

Textmode commented 13 years ago

The opcode passes the test-case.