DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   Macros anyone? (http://www.daniweb.com/forums/thread123820.html)

Demonoid2008 May 12th, 2008 6:19 am
Macros anyone?
 
the assignment is:
Create a macro named mWriteNumber that writes a signed integer to the console output.
Use the WriteInt procedure in the Irvine32 library. The argument passed to the macro can
be a byte, word, or doubleword. Use conditional oeprators so that the macro adapts to
the different sizes of the argument. Write the main code to test the macro, passing
arguments of different sizes.
i'm not asking for codes but just ideas on how to approach it. any suggestions? thanks.

kermitaner May 12th, 2008 8:00 am
Re: Macros anyone?
 
hi,

check the macros that come with the masm package: /macros/macros.asm,

there is one named 'issize' that does something similar...

Demonoid2008 May 13th, 2008 10:31 pm
Re: Macros anyone?
 
i could not find the 'issize' macro..

kermitaner May 14th, 2008 5:12 am
Re: Macros anyone?
 
strange, don't u have the latest package of masm32 ?
anyway:

;---------------------------------------------------

    issize MACRO var:req, bytes:req
        LOCAL rv
        rv = regsize(var)
        IFE rv ; if not a register use SIZE
            IF SIZE var EQ bytes
                EXITM <1>
            ELSE
                EXITM <0>
            ENDIF
        ELSE  ; it's a register     
            IF rv EQ bytes
                EXITM <1>       
            ELSE
                EXITM <0>
            ENDIF   
        ENDIF
    ENDM


All times are GMT -4. The time now is 8:49 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC