; Listing1-4.asm
;
; Simple program that demonstrates the _bswap32
; and _bswap16 macros.

_bswap32    macro   value
            local   txtValue
txtValue    textequ %((value shr 24) and 0ffh) + \
                      ((value shr 8) and 0ff00h) + \
                      ((value shl 8) and 0ff0000h) + \
                      (value and 0ffh) shl 24
            exitm   txtValue
            endm
                      
_bswap16    macro   value
            local   txtValue
txtValue    textequ %((value shr 8) and 0ffh) + \
                      (value and 0ffh) shl 8
            exitm   txtValue
            endm
                      
tt textequ %_bswap32(01020304h)
%echo tt
                      
tt textequ %_bswap16(0102h)
%echo tt
            end