Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 汇编中的乘法矩阵_Assembly_Matrix_Easy68k - Fatal编程技术网

Assembly 汇编中的乘法矩阵

Assembly 汇编中的乘法矩阵,assembly,matrix,easy68k,Assembly,Matrix,Easy68k,这是使用easy68K。嗨,我把两个矩阵相乘。我在代码底部以线性方式声明常量,但基本上我有两个矩阵,2x2。我保存在矩阵D中,它有一个定义的存储。在第二个循环中,当我进入一个地址时,我得到一个错误: 地址错误:1028处的指令访问地址1063执行 停止 这是一张图片: 这是我的密码: r EQU 2 ;number of rows c EQU 2 ;number of columns ORG $1000 START: MOVEA.L #A,

这是使用easy68K。嗨,我把两个矩阵相乘。我在代码底部以线性方式声明常量,但基本上我有两个矩阵,2x2。我保存在矩阵D中,它有一个定义的存储。在第二个循环中,当我进入一个地址时,我得到一个错误:

地址错误:1028处的指令访问地址1063执行 停止

这是一张图片:

这是我的密码:

r   EQU     2   ;number of rows
c   EQU     2   ;number of columns
    ORG    $1000
START:  MOVEA.L     #A,A0
        MOVEA.L     #B,A1
        MOVEA.L     #D,A2

        MOVE.W      #r,D3   ;used for rows
        CLR.W       D0  ;offset for A
        CLR.W       D1  ;offset for B
        CLR.W       D2  ;offset for D
        CLR.W       D5  ;calculating the sum
        CLR.W       D6  ;calculaing the multiplication
        CLR.W       D7  ;used for number of repeats
L2      MOVE.W      #c,D4   ;used for columns mainly for first matrix 
L1      CLR.W       D5
        MOVE.W      (A0,D0.W),D5
        MULU        (A1,D1.W),D5
        ADD.W       D5,D6
        ADD.W       #1,D0
        ADD.W       #c,D1   ;we are moving down a column and thus are adding column to the offset in B
        SUB.W       #1,D4
        BNE         L1
        MOVE.W      D6,(A2,D2.W)
        ADD.W       #1,D2   ;increment counter for C
        ADD.W       #1,D7   ;increment repeat
        CMP.W       #c,D7   ;number of repeats  should be equal to column number
        BNE         RE
        CLR.W       D7      ;clear repeats because we are moving on to a new row
        CLR.W       D1      ;set offset for B to 0
        SUB.W       #1,D3   ;find out through how many rows we went through
        BNE         L2
        STOP        #$2700

RE      SUB.W      #c,D0    ;got at the beginning of a row in A
        MOVE.W      D7,D1
        CLR.W       D6
        BSR        L2

* Put program code here

    SIMHALT             ; halt simulator

* Put variables and constants here
A   DC.W    1,2,0,1
B   DC.W    1,0,2,1
D   DS.W    4

    END    START        ; last line of source
请帮忙!我对装配略知一二,但这很难。
提前谢谢

你有了这个工具,用它单步执行你的代码,看看它是如何以错误的地址结束的。检查每一条指令是否符合你的要求。我做了检查。我一步一步地看了一遍,一步一步地看了一遍,我只是不明白这是怎么回事,地址可能是错的。也许我的移位是错误的,就单词而言,或者按单词或长单词?一个单词是2字节,地址使用字节。因此,您需要将指针增加2.A0,D0。我认为,wx2是增加索引规模的语法。事实上,您将递增1,然后尝试从奇数位置访问一个单词。请记住,单词必须是2字节对齐的,并且长度必须是4字节。您可能还想看看addq说明。谢谢大家!迈克和杰斯特你们说得对。这就是修正我程序的原因。有趣的是,我的老师甚至找不到问题。非常感谢你!