如何使用布尔运算将位设置为0?

Joh*_*arr 1 assembly 6502

仍然是6502装配中按位操作的新手.我想有一个有8个标志的字节.这将存储我的元精灵的状态.

我希望能够在不改变其他标志的情况下设置特定标志.

我知道如何使用ORA将它们设置为一个:

  lda status
  ora #%00000001 ; set bit 0 to true
  sta status
Run Code Online (Sandbox Code Playgroud)

我知道如何使用EOR来切换它们:

  lda status
  eor #%00000001 ; if bit 0 = true, then bit 0 = false and vise versa
  sta status
Run Code Online (Sandbox Code Playgroud)

最后,我知道如何判断一下是否属实:

  lda status
  and #%00000001 ; if bit 0 = true then set overflow flag to true
Run Code Online (Sandbox Code Playgroud)

但是如何将特定标志设置为0,而不更改任何其他标志?即使我使用了AND,我如何强制它将所需的位设置为0?

谢谢,我确定我错过了一些简单的东西.

Mec*_*cki 5

怎么样

lda status
and #%11111110 ; set bit 0 to false
sta status
Run Code Online (Sandbox Code Playgroud)

请注意,不会触及所有其他位,因为每个位1 AND X始终X都是如此.0 AND X始终只有位0发生变化0.