Recursive Fibonacci in Assembly

后端 未结 3 1743
旧时难觅i
旧时难觅i 2021-01-05 09:54

I\'m attempting to implement a recursive Fibonacci program in Assembly. However, my program crashes, with an unhandled exception, and I can\'t seem to pick out the problem.

3条回答
  •  旧巷少年郎
    2021-01-05 10:16

    First, you're using a stack offset of 8 from EBP, why? Don't you mean ESP? And a normal call only uses one 32-bit cell, so your arg should be at offset 4. I'm fairly sure other problems exist, but you can start on that.


    You should probably write some pseudocode so you, and we, can see what you're trying to accomplish.
    If you want to cheat, googling "nasm recursive fibonacci" takes you to a working program. But you'll be a better programmer if you solve it yourself.

提交回复
热议问题