;new version of nagoa.inc no need more of sizef know is automatic !

;http://194.65.3.199/win32asm/

;here an example:
;============

%include '\lab\vasm\inc\nagoa.inc'






;declaring here the function we made
;------------------------------------

def WinMain
def WndProc

..start:
call GetModuleHandle, NULL
var Instance, 4
mov dword, eax
call WinMain, , NULL, NULL, SW_SHOWDEFAULT
call ExitProcess, eax


; the funct parameters and locals (stack) used , are preceded by a point

funct WinMain, hInstanceARG, hPrevInstance, lpCmdLine, nCmdShow

local hwnd, 4,msg,MSG ; var using the stack
var wc, WNDCLASSEX ; data declared var


mov dword, WNDCLASSEX_size
mov dword, CS_VREDRAW | CS_HREDRAW
mov dword,WinProc
mov dword, NULL
mov dword, NULL
m2m dword,[.hInstanceARG]
mov dword,COLOR_WINDOW+1
mov dword, NULL
var ClassName , "Nagoa window",source ;-----> string data declared
mov dword, ClassName
call LoadIconA, NULL, IDI_APPLICATION
mov dword, eax
mov dword, eax
call LoadCursor, NULL, IDC_ARROW
mov dword, eax
call RegisterClassEx, wc
call CreateWindowEx, NULL,ClassName, "Aplication", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,, NULL
mov dword[.hwnd], eax
call ShowWindow, [.hwnd], [.nCmdShow]
call UpdateWindow, [.hwnd]

.Messageloop
lea eax,[.msg] ; get the effective adress
call GetMessageA,eax, NULL, 0, 0
test eax, eax
je .Fim
cmp eax, -1
je .erro
lea eax,[.msg]
call TranslateMessage,eax
lea eax,[.msg]
call DispatchMessageA,eax
jmp .Messageloop

.Fim
mov eax, [.msg+MSG.wParam]
return
.erro
endfunct

funct WinProc, hWnd, uMsg, wParam, lParam

local hdc, 4
local ps, PAINTSTRUCT
local hfont, 4

;=============================================
mov eax, dword[.uMsg]
cmp eax, WM_PAINT
JE .WM_PAINT
cmp eax, WM_DESTROY
je .WM_DESTROY
;=============================================
call DefWindowProc, [.hWnd], [.uMsg], [.wParam],[.lParam]
return
;=============================================
.WM_DESTROY:
call PostQuitMessage, 0
return
;==============================================
.WM_PAINT:
lea eax, [.ps]
call BeginPaint, [.hWnd], eax
mov dword[.hdc], eax
call CreateFont, 24,16,0,0,400,0,0,0,OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SCRIPT,"script"
call SelectObject, [.hdc], eax
mov dword[.hfont], eax
RGB 200, 200, 60
call SetBkColor, [.hdc],eax
RGB 0, 10, 200
call SetTextColor, eax
call TextOut, [.hdc],0,0,"Nasm Rocks", 11
call SelectObject, [.hdc], [.hfont]
lea eax, [.ps]
call EndPaint, [.hWnd], eax
return
;============================================
endfunct
Posted on 2003-03-06 12:18:48 by Nguga
Hi all!!!.

for the people that dont know what are saying (this is NASM), is a develop of a macro that i start for a "simple" questions (in the board from nasm site and nagoa site), also i start with the manipulation of local vars without the hardcoded versions and how to make them automatic and i continue to the develop for a macro for manipulate functions, ok this is a good version and loable i think :), also nguga added the no use of sizef that i use for tell how many size store for the locals vars, this is automatic now, but the only thing i find is you need declare all the local vars at the first time , then you can use normally, also with the use of sizef, you can declare a local var elsewhere inside a function or to called proc :) and no need be in the start of the funct ;) **

later i will upload**** a know bug :), but can be handled ;), only put at the end ,source, or ,local, this is only for the values that pass a string (the error is: a unterminated/ or: to long/ string)

also i need to say i am like a noob***, :) in this world of asm, but i think i can catch :) and this is done,.. whoaa!!! :D, also, i will add a feature for use the version modificated by nguga or use the sizef (only for declare locals elsewhere, more near from the place you gona use).

also, i will add in the future a no generate the the stack frame, and i will see how to handle this vars from the esp :) i think :D

Also thx for nguga (for test and suport)and fbkotler that answer my first post in help thx a lot, i learn good thx :).. a yea.. and the people that are out there :D

** i need to say you, you first need write in ahrdcore for later use a macro and know what is what is doing ;)
***for what i say.. yea i am, and i think if i can do, then you can learn too :D, is easy :D go :alright:
****in a little site i have (for free), now i am trying develop a good feel :) (sorry dudes, this site is gona be in espa?ol)
*****this is a extra: also you can know my name :) lol.. ooooo i am easy to find now in the world now :D.. i can't write my crazy ideas about some things.. and culture and world affairs.. and my affairs lol.. nah... i can and i gonna do jeje ;)

have a nice day.
Posted on 2003-03-11 01:34:34 by rea