【发布时间】:2013-01-19 02:00:09
【问题描述】:
对于 6502 汇编中的按位运算仍然很陌生。我想要一个字节 有 8 个标志。这将存储我的元精灵的状态。
我希望能够在不更改其他标志的情况下设置特定标志。
我知道如何使用 ORA 将它们设置为一个:
lda status
ora #%00000001 ; set bit 0 to true
sta status
我知道如何使用 EOR 来切换它们:
lda status
eor #%00000001 ; if bit 0 = true, then bit 0 = false and vise versa
sta status
最后,我知道如何检查某位是否为真:
lda status
and #%00000001 ; if bit 0 = true then set overflow flag to true
但是如何在不改变任何其他标志的情况下将特定标志设置为 0?即使我用过 并且,我将如何强制它将所需的位设置为 0?
谢谢,我确定我遗漏了一些简单的东西。
【问题讨论】: