Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.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 用LC-3汇编语言编写绝对值函数_Assembly_Lc3_Absolute Value - Fatal编程技术网

Assembly 用LC-3汇编语言编写绝对值函数

Assembly 用LC-3汇编语言编写绝对值函数,assembly,lc3,absolute-value,Assembly,Lc3,Absolute Value,我正在自学一本书中的LC-3组装。其中一个练习是为绝对值函数编写汇编代码 这是我用python编写的代码: #code def ABS(x): if(x < 0): return -x return x #代码 def ABS(x): 如果(x

我正在自学一本书中的LC-3组装。其中一个练习是为绝对值函数编写汇编代码

这是我用python编写的代码:

#code
def ABS(x):
    if(x < 0):
        return -x
    return x
#代码
def ABS(x):
如果(x<0):
返回-x
返回x
我应该如何在LC-3汇编中编写这篇文章

现在,我可以为堆栈设置、拆卸和加载x变量编写代码。但我不确定如何对该值求反。

提示:
-x==非(x)+1