簡體   English   中英

摩托羅拉68k地址錯誤

[英]Motorola 68k Addressing errors

所以,基本上,我在星期三有考試,並且我從星期五開始學習68k匯編,因為我一直在努力學習星期五通過的數學考試(我知道您不在乎,但是我這么說您不認為我是個******。)無論如何,我正在嘗試編寫一個子程序,該程序將[i]與數字#12進行比較。 如果[i] =#12,則內存偏移量($ 8200 + [i])= D3-#1,否則ELSE內存偏移量($ 8100 + [i])= 2 * D3。 當我嘗試組裝(使用ASIMTOOL)時,它給了我這些錯誤

ERROR in line 10: Displacement out of range

ERROR in line 12: Displacement out of range

ERROR in line 15: Invalid syntax

ERROR in line 16: Invalid syntax   

我知道這段代碼是s * it的負載,但是我沒有人提供幫助,我正在嘗試自己完成這項工作。 如果您能提供幫助,那就太好了,謝謝。 這是代碼:

            ORG     $8000
START       MOVE.l      #0,D3
            MOVEA.l  #$8200,a0
            MOVEA.l  #$8100,a1
            CMP.w       #12,i
            BEQ.s       VERO
            JMP     FALSO   

VERO:       SUB.w       #1,D3
            MOVE.l      D3,i(a0)
FALSO:      MULU.w  #2,D3
            MOVE.w  D3,i(a1)
            STOP        #2000
i           DC.w        12
x           DC.w        #4
y           DC.w        #3
            END         START    

您可能要下載《 M68000程序員參考手冊》。 這是該文檔中尋址方式的摘要( “表2-4。有效尋址方式和類別” ):

Addressing Modes             Syntax  
Register Direct
  Data                        Dn    
  Address                     An    

Register Indirect
  Address                     (An)  
  Address with Postincrement  (An)+
  Address with Predecrement   -(An)
  Address with Displacement   (d16,An)

Address Register Indirect with Index
  8-Bit Displacement          (d8,An,Xn)
  Base Displacement           (bd,An,Xn)

Memory Indirect
  Postindexed                 ([bd,An],Xn,od)
  Preindexed                  ([bd,An,Xn],od)

Program Counter Indirect
  with Displacement          (d16,PC) 

Program Counter Indirect with Index
  8-Bit Displacement         (d8,PC,Xn)
  Base Displacement          (bd,PC,Xn)

Program Counter Memory Indirect
  Postindexed                ([bd,PC],Xn,od)
  Preindexed                 ([bd,PC,Xn],od)

Absolute Data Addressing
  Short   (xxx).W
  Long    (xxx).L

Immediate      #<xxx>

MOVE.l D3,i(a0)匹配的尋址模式是“間接寄存器,地址隨位移” 問題是您似乎正在嘗試從變量中加載值,並將其用作單個指令中的位移。 位移必須是一個立即常數,所以這就是它不起作用的原因。 相反,您可以使用ADDAi的值添加到a0 ,然后執行move.l d3,(a0)

您可能應該從DC.w s中刪除#號。

暫無
暫無

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

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