Skip to content

Unexpected Q values #11

@samplx

Description

@samplx

I have been working on an emulator and have been using the previous version of these processor test files that were part of the earlier JSMoo repository. When I switched to this more recent version, I had over 50% of my opcodes fail the tests.

While performing an investigation I saw that the "q" register was different. In the previous versions of the JSON files,
and in the ares sources and in the jsmoo sources, the Q register is a flag, a single-bit value of either zero or one.
In the latest versions, the value appears to be a byte, not a bit. For example, from v1/04.json,

...

  {
    "name": "04 0001",
    "initial": {
      "pc": 59711,
      "sp": 28986,
      "a": 50,
      "b": 242,
      "c": 132,
      "d": 238,
      "e": 176,
      "f": 142,
      "h": 107,
      "l": 248,
      "i": 153,
      "r": 59,
      "ei": 0,
      "wz": 14358,
      "ix": 13969,
      "iy": 48843,
      "af_": 54814,
      "bc_": 10826,
      "de_": 57474,
      "hl_": 23694,
      "im": 1,
      "p": 1,
      "q": 142,
      "iff1": 0,
      "iff2": 1,
      "ram": [
        [
          59711,
          4
        ]
      ]
    },
    "final": {
      "a": 50,
      "b": 243,
      "c": 132,
      "d": 238,
      "e": 176,
      "f": 160,
      "h": 107,
      "l": 248,
      "i": 153,
      "r": 60,
      "af_": 54814,
      "bc_": 10826,
      "de_": 57474,
      "hl_": 23694,
      "ix": 13969,
      "iy": 48843,
      "pc": 59712,
      "sp": 28986,
      "wz": 14358,
      "iff1": 0,
      "iff2": 1,
      "im": 1,
      "ei": 0,
      "p": 0,
      "q": 160,
      "ram": [
        [
          59711,
          4
        ]
      ]
    },
    "cycles": [
      [
        59711,
        null,
        "----"
      ],
      [
        59711,
        null,
        "r-m-"
      ],
      [
        39227,
        4,
        "----"
      ],
      [
        39227,
        null,
        "----"
      ]
    ]
  },
...

Why did the definition change? Which of the 8 bits is the real Q? Is a Q of 142 set or clear? what about 160?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions