| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I understand that their aren't really procedures, and in NASM "procs" are just labels, but how does one translate this example from MASM to NASM? I know it does nothing. This is sample code MyProc PROC wParam WORD, wParam WORDLOCAL lpTimeBuf[12] :BYTE LOCAL lpLocalTime :SYSTEMTIME ;---------------------------- mov eax, wParam lea esi, [hTimeFormat] lea esi, [lpLocalTime] ret KeyBoardProc ENDP For scope I am trying to give the procedure to a windows function. |
|
#2
| |||
| |||
| "coyote" <spamtrap@crayne.org> wrote in message news:af0cf968-708b-4bea-a2a0-bfb9366220ac@y21g2000hsf.googlegroups.com... > I understand that their aren't really procedures, and in NASM "procs" > are just labels, but how does one translate this example from MASM to > NASM? > > I know it does nothing. This is sample code > > MyProc PROC wParam WORD, wParam WORD> LOCAL lpTimeBuf[12] :BYTE > LOCAL lpLocalTime :SYSTEMTIME > ;---------------------------- > mov eax, wParam > lea esi, [hTimeFormat] > lea esi, [lpLocalTime] > ret > KeyBoardProc ENDP > > For scope I am trying to give the procedure to a windows function. > Not real sure, but I'll give it a try. I chose to use some macro's by Mammon for the PROC and ENDP. They seemed to use a feature no longer available in NASM. I posted a fix below. The changes mean that the local variables have to be added to 'ebp' instead of being done automatically. ; for PROC and ENDP %include "mammon.inc" ; define a NASM template for SYSTEMTIME to get it's size struc SYSTEMTIME wYear: resw 1 wMonth: resw 1 wDayOfWeek: resw 1 wDay: resw 1 wHour: resw 1 wMinute: resw 1 wSecond: resw 1 wMilliseconds: resw 1 endstruc PROC MyProc, nCode, wParam ; __ll is used by Mammon's macros to allocate space %assign __ll __ll+12 ; 12 is size of lpTimeBuf LOCALVAR lpTimeBuf ; declare variable %assign __ll __ll+SYSTEMTIME_size ; is size of struct LOCALVAR lpLocalTime ;---------------------------- mov eax, [ebp+nCode] mov eax, [ebp+wParam] lea esi, [hTimeFormat] lea esi, [ebp+lpTimeBuf] lea esi, [ebp+lpLocalTime] ret ENDP hTimeFormat: db "hh:mm:ss tt", 0 You'll need Mammon's macros for the PROC and ENDP which are here: http://groups.google.com/group/alt.l...e573ddfd882156 Although his macro's were for NASM, I had a problem with two equates which needed changing: --- mammon.old 2008-09-07 20:16:42.000000000 +0000 +++ mammon.inc 2008-09-07 20:16:18.000000000 +0000 @@ -267,7 +267,7 @@ %1: %assign _i 4 %rep %0-1 - %2 equ [ebp-_i] + %2 equ -_i %assign _i _i+4 %rotate 1 %endrep @@ -293,7 +293,7 @@ %macro LOCALVAR 1 sub esp, 4 - %1 equ [ebp + __ll] + %1 equ __ll %endmacro Disclaimer: I'm not completely sure if any of that will do what you want... ;-) HTH, Rod Pemberton |
|
#3
| |||
| |||
| I will try this, thank you very much. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.