The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: ecube on January 13, 2007, 01:10:30 AM

Title: passing reg::reg
Post by: ecube on January 13, 2007, 01:10:30 AM
what does eax::ebx mean?
Title: Re: passing reg::reg
Post by: GregL on January 13, 2007, 07:08:51 AM
Check this out. Note the INVOKE with eax::edx and edx::eax.


.586
.MODEL FLAT, stdcall
OPTION CASEMAP:NONE

INCLUDE windows.inc

INCLUDE kernel32.inc
INCLUDE msvcrt.inc

INCLUDELIB kernel32.lib
INCLUDELIB msvcrt.lib

someproc PROTO STDCALL,:QWORD,:QWORD

xqword$ MACRO xqwordvalue:REQ
    ; unsigned hex qword
    LOCAL buffer
    .DATA?
        buffer BYTE 20 dup(?)
    IFNDEF xqwfmt   
    .DATA   
        xqwfmt    BYTE "%I64X", 0
    ENDIF   
    .CODE
        push  DWORD PTR [xqwordvalue+4]
        push  DWORD PTR [xqwordvalue+0]
        push  OFFSET xqwfmt
        push  OFFSET buffer
        call  crt_sprintf
        add   esp, 16
        EXITM <OFFSET buffer>
ENDM

.CODE

start:

    mov eax, 0DEADBEEFh
    mov edx, 012345678h
   
    INVOKE someproc, eax::edx, edx::eax
   
    INVOKE ExitProcess, 0

someproc PROC qw1:QWORD, qw2:QWORD
    INVOKE crt_puts, xqword$(qw1)
    INVOKE crt_puts, xqword$(qw2)
    ret
someproc ENDP

END start

Title: Re: passing reg::reg
Post by: ecube on January 13, 2007, 08:02:04 AM
ahh using it with qwords makes more sense, alright thanks a lot guys  :U
Title: Re: passing reg::reg
Post by: sinsi on January 13, 2007, 08:49:06 AM
Used to use it a lot in the 16-bit days.

strlen PROTO C string:FAR PTR BYTE
...
INVOKE strlen,ES::BX
...

Thanks for the reminder Greg :U.