• mindbleach@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    Even on 6502, the BIT command is useless 99% of the time, and AND ~which_bit is the right answer.

    Interestingly the Intel MCS-51 ISA did have several bit-addressable bytes. Like a weird zero page.

    • jsomae@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      23 hours ago

      Only because 6502 has no BIT immediate – only BIT zero page and BIT absolute. But the contemporary z80 and gameboy cpu too have dedicated bit instructions, e.g. BIT c,6 (set z flag to bit 6 of register c).

      • mindbleach@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        ·
        20 hours ago

        I think it’s intended for checking the same bit in multiple bytes. You load the mask instead of the data.

        So much 6502 ASM involves turning your brain inside-out… despite being simple, clever, and friendly. Like how you can’t do a strided array sensibly because there’s no address register(s). There is no “next byte.” Naively, you want separate varied data at the same index is separate arrays. Buuut because each read address is absolute, you can do *(&array+1)[n], for free.

        What I really miss on NES versus Game Boy is SWAP.