I'm experimenting with Nasm and I started with demo11 from your 2.0 distribution.
Im having problems using the latest proc macros. I'm used to Masm syntax and like the stile but have a hard time to make it work.
The example may illustrate:
entry consol
[section .bss]
fname: resb 260
lname: resb 260
age: resd 1
[section .text]
CHAR Title, "My first console program"
proc consol
LOCALS
LOCAL pTitle, dword ;local variable
ENDLOCALS
invoke printf, "Nasm Version %s%c%c", __NASM_VER__,13,10
invoke printf,"-----------------%c%c",13,10
invoke printf,"%s%c%c%c%c", Title,13,10,13,10
invoke printf, "First Name: "
invoke scanf, "%260s", fname
invoke printf, "Last Name: "
invoke scanf, "%260s", lname
invoke printf, "Age: "
invoke scanf, "%01d", age
mov eax, [age]
if eax, >=, 21
invoke printf, "Hello, %s %s! What are you having today?", fname, lname
else
invoke printf, "Sorry kid, you're only %d !%c%c", [age],13,10
endif
invoke printf, "The Address of Title: %x%c%c", Title,13,10
;This is what I try to do:
mov dword[ebp-4],fname
invoke printf,"The string pointed at: %s%c%c",[ebp-4],13,10
;This is what I thought it should be but dont work!
mov dword[pTitle],Title ;attemtet to store addr of Title in local var
invoke printf,"The string pointed at: %s%c%c",[pTitle],13,10
invoke printf, "%c%c%c%cPress any key to exit.",13,10,13,10
invoke _getch
xor eax, eax
ret
endproc
The question I have is this:
How do I address the local var by its name?
Masm syntax, lea eax pTitle don't work either
any help would be appreciated
tx Klod