Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPSR Z Flag Not Setting to 1 Despite muls Instruction Resulting in 0 #19

Open
fkuzume opened this issue May 5, 2024 · 0 comments
Open

Comments

@fkuzume
Copy link

fkuzume commented May 5, 2024

Even when the result of the muls instruction is 0, the CPSR's Z flag does not become 1.

When r0=r1=65536,

muls r0, r1, r0

is executed, the Z flag does not become 1.

The likely cause is within
ARMv7_CPU.prototype.mul = function(inst, addr){}
in arm-js/js/armv7-cpu.js, where the comparison (ret === 0) is made while ret includes the upper 32 bits, causing the issue.

When modified to something like
this.cpsr.z = (ret.low === 0) ? 1 : 0;
it behaves as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant