Beside he fact that all programs are mathematical approaches of problems to solve, this section is dedicated to more real mathematical problems and the associated difficulties in stack management, especially when it comes to recursive algorithms. Although they are easier to program in higher programming languages, they are more difficult to implement in assembler and are not as efficient as they seem. An example is given here with the Fibonacci numbers. This has been made both recursive and iterative. Most of them have a time indication so that we have an idea about the duration of an algorithm.


BIN=facrec fiboiter fibrec minmax

NASM=/usr/bin/nasm
NASMOPTS=-felf64 -Fdwarf
LDOPS=-melf_x86_64 -g

.PHONY: all clean

all: $(BIN)

clean:
	rm -rf $(BIN)

%: %.asm
	$(NASM) $(NASMOPTS) -o $@.o $<
	$(LD) $(LDOPS) -o $@ $@.o
	rm -f $@.o