The MASM Forum

Miscellaneous => 16 bit DOS Programming => Topic started by: StillLearningMasm on September 28, 2019, 05:41:50 AM

Title: Using a Macro
Post by: StillLearningMasm on September 28, 2019, 05:41:50 AM
Please help.

I have an fragment of a program that is using a macro called mne. I am trying to understand how this macro works. In this case the macro expands and creates more data in its segment. How can I see the data that is created by the macro? Also since this macro seems to call itself what causes the macro to stop? Can anybody tell me how the catstr instruction works in this case? I am still trying the learn macros.

Thank you for any help.


;--- mne macro, used for the assembler mnemonics table

mne macro val2:REQ, dbytes:VARARG
ASMDATA segment
CURROFS = $
ifnb <dbytes>
db dbytes
endif
ASMDATA ends
dw CURROFS - asmtab
MN_&val2 equ $ - mnlist
tmpstr catstr <!">,@SubStr(val2,1,@SizeStr(val2)-1),<!",!'>,@SubStr(val2,@SizeStr(val2)),<!'>,<+80h>
db tmpstr
endm

.8086

_TEXT segment dword public 'CODE'
org 100h
start:
_TEXT ends

CONST segment word public 'DATA'
CONST ends

ASMDATA segment word public 'DATA'
asmtab label byte
ASMDATA ends

_DATA segment dword public 'DATA'
_DATA ends

_ITEXT segment word public 'I_TEXT'
_ITEXT ends

_IDATA segment word public 'I_DATA'
patches label word
_IDATA ends

DGROUP group _TEXT, CONST, ASMDATA, _DATA, _ITEXT, _IDATA
Title: Re: Using a Macro
Post by: aw27 on September 28, 2019, 06:38:57 PM
People here is not at your service, don't post "fragments", remove the irrelevant crap, check for nonsense in what you write  and post something that can be built .
You may even find the solution while doing that.
Title: Re: Using a Macro
Post by: felipe on September 29, 2019, 05:06:23 AM
Quote from: StillLearningMasm on September 28, 2019, 05:41:50 AM
Can anybody tell me how the catstr instruction works in this case?

It's not an instruction, it's an assembler directive. Check this link of microsoft documenting this directive: https://docs.microsoft.com/en-us/cpp/assembler/masm/catstr?view=vs-2019 (https://docs.microsoft.com/en-us/cpp/assembler/masm/catstr?view=vs-2019)