如果小于的话,哪个是分支的正确分支指令
我昨天写了一个答案: 您见过或做过的最酷的黑客是什么? 我真的很努力地记住我的 6502 程序集,但我一辈子都不记得如何分支,如果小于...
:1
lda $C010
cmp #$80
bcc :1 ; branch if less than? I forget how to do that.
lda $C000
jsr $FDF0 ;output the accumulator value to the screen
有人知道指令是什么吗? BNE 和 BEQ 相等,BCC 用于进位,而 CMP 基本上是 SBC,会影响进位,但我不确定它在这种情况下是否有效。
I wrote an answer yesterday to this:
What's the coolest hack you've seen or done?
and I was trying really hard to remember my 6502 assembly, and I couldn't for the life of me remember how to branch if less than...
:1
lda $C010
cmp #$80
bcc :1 ; branch if less than? I forget how to do that.
lda $C000
jsr $FDF0 ;output the accumulator value to the screen
Anybody know what the instruction is?
BNE and BEQ are equals, BCC was for carry, and a CMP is basically an SBC and that affects the carry, but I'm not sure if it works in that case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
BCC小于则为分支; 如果 BCS 大于或等于,则分支。 这里有一个很好的教程。
然而,stu 的代码可以在没有 CMP 的情况下写得更简洁:
BCC is branch if less than; BCS is branch if greater than or equal. There's a nice tutorial here.
However stu's code can be written more concisely without CMP:
第一个 Google 搜索:http://en.wikibooks.org/wiki/6502_Assembly#Branch
First Google hit: http://en.wikibooks.org/wiki/6502_Assembly#Branch