News:

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

udb$ MACRO

Started by Neil, June 10, 2009, 07:29:47 AM

Previous topic - Next topic

Neil

Anyone know how to pass the byte value to this macro, I've tried numerous ways & can't get it to work :(

hutch--

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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Neil

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.

UtillMasm

 :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 . . .

Neil

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.

UtillMasm

don't mind, it's not for you, because you are using masm32 verson 10.
:wink