Dear Forum
I have a couple of questions.
1. What is the difference between the following
three statements and when would you use them:-
#include FileName
#include "FileName"
#include <FileName>
2.How does the following macro work? It seems to me
that the first instruction, line 3 says jump to lbl:,line 5,
so how does line 4 ever get a go?
1 szText MACRO Name, Text:VARARG
2 LOCAL lbl
3 jmp lbl
4 Name db Text,0
5 lbl:
6 ENDM
Regards,
seaview
#include is a resource file command--
Quote#include
#include (filename)
The #include directive causes Resource Compiler to process the file specified in the filename parameter. This file should be a header file that defines the constants used in the resource-definition file.
Parameter
filename
Specifies the name of the file to be included. If the file is in the current directory, the string must be enclosed in double quotation marks; if the file is in the directory specified by the INCLUDE environment variable, the string must be enclosed in less-than and greater-than characters (<>). You must give a full path enclosed in double quotation marks if the file is not in the current directory or in the directory specified by the INCLUDE environment variable.
The macro just creates some inline text data. It jumps over it because is shouldn't be executed. Later in the code you can refer to the string variable by the name you gave it. e.g. szText ABC,"This is it." will produce in your code-
jmp lbl ; jump over the text I want created here. (lbl will be one of the funny id macros creates)
ABC db "This is it.",0
lbl:
seaview,
The phrase "inline text data" means that the data is embedded in the code segment, rather than in the data segment where it would normally go.
szText MACRO Name, Text:VARARG
2 LOCAL lbl
3 jmp lbl
4 Name db Text,0
5 lbl:
6 ENDM
MASM assembles line 4 when the macro is expanded. Because line 4 defines data rather than executable instructions, the execution path must be directed around it.
To MichaelW and Jimg,
Many thanks for taking the time to explain the above.
I have one other question and that is with regard to paths.
Why do you use sometimes a back slash '\' and sometimes a forward slash '/'.
regards,
seaview.
For Windows the norm for both local paths and UNC paths is a back slash, but I think Windows NT/2000/XP etc will accept a forward slash in an UNC path.
Why is "LOCAL lbl" used? Is it really needed? ::)
Yes, LOCAL lbl is necessary. See Defining Local Symbols in Macros here:
http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_09.htm