Here is a quick example of nested functions :
.386
.model flat,stdcall
option casemap:none
includelib \PellesC\lib\Win\kernel32.lib
includelib msvcrt.lib
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
TestFunc PROTO :DWORD,:DWORD
.data
s1 db 'Result = %u',0
retx MACRO a
db 0C2h,a,0
ENDM
.code
start:
invoke TestFunc,98,3
invoke printf,ADDR s1,eax
invoke ExitProcess,0
ret
TestFunc PROC x:DWORD,y:DWORD
push y
push x
call Substract
shl eax,1 ; z=2*(x-y)
ret
Substract: ; PROC a:DWORD,b:DWORD
mov eax,DWORD PTR [esp+4]
sub eax,DWORD PTR [esp+8]
retx 8
; Substract ENDP
TestFunc ENDP
END start