Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.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 我怎样才能让这个MARIE程序为底片工作?_Assembly - Fatal编程技术网

Assembly 我怎样才能让这个MARIE程序为底片工作?

Assembly 我怎样才能让这个MARIE程序为底片工作?,assembly,Assembly,我写了这个程序,将两个数字相乘,但现在我需要使它适用于负数,有人有什么建议吗 org 100 Input a /first factor Store a /store first factor Input b /second factor Store b /store second factor Load a /load first factor Skipcond 800 /checks if number is greater than zero Jump End /skips to the

我写了这个程序,将两个数字相乘,但现在我需要使它适用于负数,有人有什么建议吗

org 100
Input a /first factor
Store a /store first factor
Input b /second factor
Store b /store second factor
Load a /load first factor
Skipcond 800 /checks if number is greater than zero
Jump End /skips to the end if zero
load b /load second factor
Skipcond 800 /checks if number is greater than zero
Jump End /skips to the end if zero
Loop, Load b /reloads second factor
Subt One /subtracts one from the second factor
Store b /store the new value of the second factor
Load productAB /load the product of the two number; initially zero
Add a /add first factor to the product
Store productAB /store new value to product
Load b/ load second factor again
Skipcond 400 /end loop if b is equal to 0
Jump Loop /repeats the loop
Load productAB /load the value of productAB; no longer 0
End, output /print out results
Halt /end of program

a, Dec 0
b, Dec 0
productAB, Dec 0 /product of the first two numbers
One, Dec 1
使用伪代码

neg = 0
if (a < 0)
    a = -a
    neg = 1
if (b < 0)
    b = -b
    neg ^= 1
productAB = a * b
if (neg)
    productAB = -productAB
neg=0
if(a<0)
a=-a
负=1
if(b<0)
b=-b
负^=1
产品AB=a*b
如果(负)
productAB=-productAB
使用伪代码

neg = 0
if (a < 0)
    a = -a
    neg = 1
if (b < 0)
    b = -b
    neg ^= 1
productAB = a * b
if (neg)
    productAB = -productAB
neg=0
if(a<0)
a=-a
负=1
if(b<0)
b=-b
负^=1
产品AB=a*b
如果(负)
productAB=-productAB
使用伪代码

neg = 0
if (a < 0)
    a = -a
    neg = 1
if (b < 0)
    b = -b
    neg ^= 1
productAB = a * b
if (neg)
    productAB = -productAB
neg=0
if(a<0)
a=-a
负=1
if(b<0)
b=-b
负^=1
产品AB=a*b
如果(负)
productAB=-productAB
使用伪代码

neg = 0
if (a < 0)
    a = -a
    neg = 1
if (b < 0)
    b = -b
    neg ^= 1
productAB = a * b
if (neg)
    productAB = -productAB
neg=0
if(a<0)
a=-a
负=1
if(b<0)
b=-b
负^=1
产品AB=a*b
如果(负)
productAB=-productAB

根据其工作方式,它可能已经做了正确的事情。不“加宽”的无符号乘法和有符号乘法如果使用2的补码负数,结果是相同的。当然,这会使负数变大,所以在这个简单的乘法中,这意味着大量的加法。这取决于它的工作方式,它可能已经做了正确的事情。不“加宽”的无符号乘法和有符号乘法如果使用2的补码负数,结果是相同的。当然,这会使负数变大,所以在这个简单的乘法中,这意味着大量的加法。这取决于它的工作方式,它可能已经做了正确的事情。不“加宽”的无符号乘法和有符号乘法如果使用2的补码负数,结果是相同的。当然,这会使负数变大,所以在这个简单的乘法中,这意味着大量的加法。这取决于它的工作方式,它可能已经做了正确的事情。不“加宽”的无符号乘法和有符号乘法如果使用2的补码负数,结果是相同的。当然,这会使负数变大,所以在这个简单的乘法中,这意味着大量的加法。你不能在MARIE中这样编程。没有办法说b=-b@user3003064我说过这是伪代码。你会做
b=0-b
?你不能在MARIE中那样编程。没有办法说b=-b@user3003064我说过这是伪代码。你会做
b=0-b
?你不能在MARIE中那样编程。没有办法说b=-b@user3003064我说过这是伪代码。你会做
b=0-b
?你不能在MARIE中那样编程。没有办法说b=-b@user3003064我说过这是伪代码。你能做
b=0-b