我想编写一个程序来从按钮中读取一个值并在 LED 上显示该值。程序应该连续运行,并且随着按钮的改变,显示也会改变。我尝试了很多方法,但它没有显示任何东西可以帮助我知道问题出在哪里。
LEDS EQU $E00010 ;LEDS adress
BUTTON EQU $E00014 ;BUTTON address
ORG $400 ;start of program area
START
Loop MOVE.B #2,D0
MOVE.B BUTTON,D1 ;move the value of button to D1
MOVE.B D2,LEDS
NOT.B D1 ;take NOT to flip the value in order to present it in LEDS
MOVE.B D1,D2 ;move the value to LEDS
SUB.B #2,D0 ; if D0 =0 then loop again
BEQ Loop
SIMHALT
END START