Skip to content

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

Open
@fkuzume

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions