Re: Localized Parameter Directive?
- From: "Jim Carlock" <anonymous@xxxxxxxxxxxxx>
- Date: Thu, 14 Jul 2005 22:37:30 GMT
"Betov" <betov@xxxxxxx> posted:
> Why don't you use a real Assembler, like FASM or RosAsm,
> instead?
<g> Trying to learn the MASM way of things. I didn't run into
any problems in VB or C or Pascal or javascript in the past
with such things. In fact there are 10 or 20 API declarations
in one particular program where hWnd is used quite a lot in
each of the declarations. Those other compilers tend to keep
the localized variables seperated from the global variables, if
there's a duplicate definition, ie they'll use one or the other,
without complaining during the compile process.
I'm seeing where in another project, there is no PROTO for
WndProc. So I can only guess that the compiler never requires
a PROTO "declaration". Is there a directive to turn on requiring
PROTO declarations?
I don't see a compiler directive in the 1991 and 1992 books.
Nothing in the CP/M Assembly Language from 1986 either.
I'll wait to see if anyone here can offer a suggestion or
comment.
Couple questions for Betov, how would you declare the
hWnd as being a parameter for the procedure, rather than
it referencing the global variable? And what do all those @
"at" symbols mean before the variable names? And what
about the ampersand symbols "&" in front, as in &NULL?
And what about all those, "D$variablename"? It looks alot
like... DS:variablename. But you'll have to explain what it
really means. I didn't think the segment stuff was used used
anymore with Win32.
--
Jim Carlock
Please post replies to newsgroup.
"Jim Carlock" <anonymous@xxxxxxxxxxxxx> écrivait:
> Using RadASM which in turn is using MASM to compile.
> C:\Masm32\Bin\ML.EXE /c /coff /Cp /nologo /I"C:\Masm32\Include"
> "TEST.asm"
>
> : error A2005: symbol redefinition : hWnd
>
> <the_code>
> .586
> .model flat,stdcall
> option casemap:NONE
> include Test.Inc
>
> WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
> WndProc proto :DWORD,:DWORD,:DWORD,:DWORD
>
> .data
> ClassName db "cTest",0
> AppName db "Test",0
>
> .data?
> hInstance HINSTANCE ?
> CommandLine LPSTR ?
> hWnd dd ?
>
> .code
>
> start:
> invoke GetModuleHandle, NULL
> mov hInstance,eax
> invoke GetCommandLine
> mov CommandLine,eax
> invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
> invoke ExitProcess,eax
>
> WinMain proc
> hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
> ret
> WinMain endp
>
> WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
>
> ret
> WndProc endp
>
> end start
> </the_code>
>
> casemap:NONE means it's all case sensitive, right?
>
> I'm must be misinterpreting what's going on.
Here is the translation of your
Source, in RosAsm syntax:
-----------------------------------------------
[ClassName: 'cTest', 0 AppName: 'Test', 0]
[hInstance: ? CommandLine: ? hWnd: ?]
Main:
call 'KERNEL32.GetModuleHandleA', &NULL
mov D$hInstance eax
call 'KERNEL32.GetCommandLineA'
mov D$CommandLine eax
call WinMain, D$hInstance, &NULL, D$CommandLine, &SW_SHOWDEFAULT
call 'KERNEL32.ExitProcess' eax
Proc WinMain:
Arguments @hInst, @hPrevInst, @CmdLine, @CmdShow
; ...
EndP
Proc WndProc:
Arguments @hWnd, @uMsg, @wParam, @lParam
; ...
mov eax D§hwnd ; Global Data 'hwnd'
mov ebx D@hwnd ; '@hwnd' Stack Local
EndP
----------------------------------------
Betov.
< http://rosasm.org >
.
- Follow-Ups:
- Re: Localized Parameter Directive?
- From: Betov
- Re: Localized Parameter Directive?
- From: randyhyde
- Re: Localized Parameter Directive?
- References:
- Localized Parameter Directive?
- From: Jim Carlock
- Re: Localized Parameter Directive?
- From: randyhyde
- Re: Localized Parameter Directive?
- From: Jim Carlock
- Re: Localized Parameter Directive?
- From: Betov
- Localized Parameter Directive?
- Prev by Date: Re: Localized Parameter Directive?
- Next by Date: Re: Local Symbols in Macros (#2)
- Previous by thread: Re: Localized Parameter Directive?
- Next by thread: Re: Localized Parameter Directive?
- Index(es):
Relevant Pages
|