Ad
  • Default User Avatar

    I believe this test case if wrong: { "mov d 100", "dec d", "mov b d", "jnz b -2", "inc d", "mov a d", "jnz 5 10", "mov c a" }
    When the code reaches the "jnz 5 10" no registers has the value 5.\

    Breakdown:
    mov d 100 -> d is 100
    dec 9 -> d is 99
    mov b d -> botb b and d are 99
    jnz b -2 -> we decrease the value of d then copy d's value to b until d is 0, so d and b is 0 when we reach the "inc d" instruction
    inc d -> d is 1 b is 0
    mov a d -> d and a are 1, b is 0
    jnz 5 10 -> no register has 5 as value