2009-02-04 61 views
2

我昨天写了一个答案: What's the coolest hack you've seen or done? 我一直在努力记住我的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,并且影响进口,但我不确定它是否适用于这种情况。

回答

5

BCC是分支,如果小于;如果大于或等于BCS,则BCS是分支。有一个很好的教程here

然而STU的代码可以更简洁的书面无CMP:

BIT $C010  ;clear the keyboard strobe 
:1 
LDA $C000  ;check for a keypress 
BPL :1  ;taken if no keypress 
JSR $FDFO  ;print the key 
0
+0

骗子。 :-)我正在寻找一些来自像我这样的老小孩的热烈的6502讨论,带来更美好的回忆。 :-) – stu 2010-09-23 14:20:25

+0

首先谷歌命中没有对问题的直接回应 – 2016-06-20 21:10:56