A small recursive macro demo which outputs the Hanoi Problem solution.
Assemble with: nasm -E hanoi.asm
Also, Is there any way i can supress the "%line" lines from the preprocessor output ??
;; hanoi.asm - Hanoi tower solution using NASM's recursive macro feature
;; Needs NASM 2.10rc2 or above.
;; Assemble with : nasm -E hanoi.asm
%irmacro HANOITOWER 4
%push HANOI
%if %1 > 0
%assign %$noofdisks %1 - 1
HANOITOWER %$noofdisks, %2, %4, %3
DISK MOVED FROM %2 TO %4
HANOITOWER %$noofdisks, %3, %2, %4
%endif
%pop
%endmacro
%push MAINCTX
%assign %$DISKS 3 ;; ***Change Disks here***
NO OF DISKS = %$DISKS
HANOITOWER %$DISKS,"A","B","C"
%pop