c - 汇编中的子程序

标签 c assembly pdp-11

我可以在程序集bne jsr swap上做这样的事情吗,如果不能,我该如何从C解决这个问题,提前致谢

if(start!=pivot_index){
  swap(board,start,pivot_index);
 }

我被教导说我必须写 jsrsub-routine 但是我可以做这样的事情吗 bne sub-routine

最佳答案

在汇编中通常会被翻译成这样的东西(伪汇编):

load [start]
compare [pivot_index]
branch-if-equal label1
push [pivot_index]
push [start]
push [board]
call swap
add-stack-pointer 12
label1:

即。如果控制表达式不为真,则 if 语句将转换为跳过 if 主体的跳转。

关于c - 汇编中的子程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2891544/

相关文章:

c++ - 为什么堆栈帧上保留的空间比 x86 中需要的空间多

assembly - 英特尔架构和 IEEE 754 合规性(minNum 和 maxNum)?

assembly - 初学者裸机pdp11控制台输出

assembly - pdp-11 上的时钟

c - 在 C 中访问动态数组的部分?

c - 从线程传递数组

c - PrintList 函数无法正常工作

c - 位域和对齐

c++ - 什么寄存器指向堆?