簡體   English   中英

組裝Motorola 68k,如果測試位為零,如何分支?

[英]Assembly Motorola 68k, how to branch if a tested bit is zero?

我正在使用easy68k編寫匯編程序,我正在尋找一種方法,如果測試位等於零[SR中的Z = 0],則可以進行分支。

我搜索了很多,但沒有得到答案,

例如,我有這行:

  BTST #0,D2 ;Testing the LSB bit in data register 0

現在我想要一種方法,或者如果存在的話,可以在SR中檢查Z,因此我可以知道測試的位是否為零。

測試條件代碼和基於它們的分支的指令通常稱為Bcc 這些條件轉移指令的單獨名稱基於如果緊接在前的指令是CMP含義。

但是,他們自己所做的只是測試條件代碼並進入分支。 因此,您可以執行以下操作:

BTST #0,D2 ;Testing the LSB bit in data register 0
BEQ LabelForZSet
;Code for Z clear

在Z標志上分支:

btst #0,d2
beq bitIsCleared
; or
bne bitIsSet

Z標志注冊:

btst #0,d2
sne  d0
; d0 (byte only) will now be 0xFF if bit was set, 0x00 otherwise)
; if a word is required add ext.w d0
; if a long is required add also ext.l d0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM