News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Passing structure variable to procedure

Started by NUMBSKULL2, February 06, 2009, 09:54:55 PM

Previous topic - Next topic

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

jj2007

Quote from: Numbskull2 on February 09, 2009, 02:55:29 AM
I tried the following:


You didn't try hard enough.

include \masm32\include\masm32rt.inc

TickConvert        PROTO  :DWORD

Time  STRUCT
       Hour             DB ?
       Minute          DB ?
       Second         DB ?
       HourTick       DW ?
       MinuteTick    DW ?
       SecondTick   DW ?
Time  ENDS


.DATA
StartTime  Time <12, 13, 14, 0, 0, 0 >
EndTime   Time <12, 13, 14, 0, 0, 0>

                        .CODE
Start:          INVOKE TickConvert, ADDR StartTime
  movzx eax, word ptr StartTime.SecondTick
  MsgBox 0, str$(eax), "Hi", MB_OK
exit

;*****************************************************************

TickConvert        PROC NEAR  Loctime:DWORD
mov edx, Loctime
                        mov al,[edx.Time.Second]
                        mov bl, 64h
                        mul bl
                        mov [edx.Time.SecondTick], ax
                        ret
TickConvert        ENDP

End Start