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.

Recommended Answers

All 3 Replies

hi,

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

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

i could not find the 'issize' macro..

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.