The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Neil on June 10, 2009, 07:29:47 AM

Title: udb$ MACRO
Post by: Neil on June 10, 2009, 07:29:47 AM
Anyone know how to pass the byte value to this macro, I've tried numerous ways & can't get it to work :(
Title: Re: udb$ MACRO
Post by: hutch-- on June 10, 2009, 07:53:22 AM
Neil,

Give this a blast.


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    include \masm32\include\masm32rt.inc
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

    .data?
      value dd ?

    .data
      item dd 0

    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
    inkey
    exit

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

main proc


    LOCAL mybyte :BYTE

    mov al, 104
    print udb$(al),13,10

    mov mybyte, 99
    print udb$(mybyte),13,10

    ret

main endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end start
Title: Re: udb$ MACRO
Post by: Neil on June 10, 2009, 08:14:47 AM
Great! thanks hutch  :U I like Macros they can save you a lot of work, that's if you have learned how to use them correctly. There is not a lot of documentaion on Macros, at least I haven't found it yet & it can lead to a lot of head scratching, but with the great help available on this Forum maybe it's not necessary.
Title: Re: udb$ MACRO
Post by: UtillMasm on June 10, 2009, 08:15:44 AM
 :U@echo off
\masm32\bin\ml.exe /c /coff /Fotest.obj /nologo test.asm
\masm32\bin\link.exe /subsystem:console /out:test.exe test.obj /nologo
pause
Assembling: test.asm
test.asm(25) : error A2006: undefined symbol : udb$
print(2): Macro Called From
 test.asm(25): Main Line Code
test.asm(25) : error A2114: INVOKE argument type mismatch : argument : 1
print(2): Macro Called From
 test.asm(25): Main Line Code
test.asm(28) : error A2006: undefined symbol : udb$
print(2): Macro Called From
 test.asm(28): Main Line Code
test.asm(28) : error A2114: INVOKE argument type mismatch : argument : 1
print(2): Macro Called From
 test.asm(28): Main Line Code
LINK : fatal error LNK1181: cannot open input file "test.obj"
Press any key to continue . . .
Title: Re: udb$ MACRO
Post by: Neil on June 10, 2009, 08:31:48 AM
UtillMasm,
Are you saying you can't get it to work?
It works for me. The reason I'm using it is that it does the same as print ustr$ (eax) but you can do away with the instruction movzx eax,al, which should be quicker unless the Macro is slower, but then again it still simplifies things a little.
Title: Re: udb$ MACRO
Post by: UtillMasm on June 10, 2009, 08:36:15 AM
don't mind, it's not for you, because you are using masm32 verson 10.
:wink