News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

help to create a .inc file

Started by shaikkareem, June 22, 2014, 01:40:14 PM

Previous topic - Next topic

shaikkareem

hi every one......,

i need some help over here to create an include file that will includes standard declarations or code. i also need all information about creation of a .inc file that either contains declaration or masm code.

dedndave

include files are plain text files
you can create one with NotePad

whatever you place in the include file will be "expanded" at the location
where the INCLUDE directive is located in the source file

shaikkareem

Quote from: dedndave on June 22, 2014, 01:47:26 PM
include files are plain text files
you can create one with NotePad

whatever you place in the include file will be "expanded" at the location
where the INCLUDE directive is located in the source file

well i need to know the inner structure of .inc file and what i must obey to make it happened(restrictions, using opcodes etc) , i know that i can't simply place the declaration or code inside it (actually i tried but errors got). so i think i need an example...

dedndave

the same restrictions apply as to the source file

let me guess what happened
you tried to put some code (a PROC maybe) in an INC file
and you got an error message about "blocks" or illegal segments or something of that nature

to use the code instruction set, it must lie inside a .CODE section
and, before that, you should declare the processor, model, and (for win32) OPTION CaseMap:None

here is one example

        INCLUDE    \masm32\include\masm32rt.inc       ;examine this file to see what gets expanded

        .CODE

Start:
        print   chr$('Hello World'),13,10
        inkey
        exit

        END     Start


there are many INC files in the masm32\examples folder to look at

Vortex

Hi shaikkareem,

A similar thread :

http://masm32.com/board/index.php?topic=3304.0

Gunther

Quote from: shaikkareem on June 22, 2014, 02:09:30 PM
well i need to know the inner structure of .inc file ...

You can use any file from masm32\include as a pattern.

Gunther
You have to know the facts before you can distort them.

nidud

#6
deleted

dedndave

i generally use project INC files for constants (EQUates), structure definitions, and macro definitions only
however, for larger projects, i have used them for data and code, as well

Hutch likes to break up his code with INC files, even for small projects
so, there are a number of programs written that way in the examples folder

nidud

#8
deleted

jj2007

Quote from: nidud on June 23, 2014, 01:18:30 AM
There are few (if any) using modules with a common include file.

Splitting our typical tiny projects into modules is hilarious in 99% of all cases. If noobs attach a hello world proggie distributed over a dozen "project" files, the archive goes straight to the recycle bin.

Splitting becomes an option if
- the modules are REALLY meant for reuse in other projects (rarely seen...)
- and you are well beyond, say, ten thousand lines of code, and your editor becomes a bit sluggish.

In all other cases, you are just complicating your life by having to manage more than one file. Simple example: Try changing the name of MyReal4 to MyReal8 over several modules.

Gunther

Jochen,

Quote from: jj2007 on June 23, 2014, 02:11:21 AM
[Splitting becomes an option if
- the modules are REALLY meant for reuse in other projects (rarely seen...)
- and you are well beyond, say, ten thousand lines of code, and your editor becomes a bit sluggish.

That's my approach, too.

Quote from: jj2007 on June 23, 2014, 02:11:21 AM
Simple example: Try changing the name of MyReal4 to MyReal8 over several modules.

That's not complicated with search and replace.

Gunther
You have to know the facts before you can distort them.

jj2007

Quote from: Gunther on June 23, 2014, 03:12:06 AMThat's not complicated with search and replace.

In VB maybe, but in QE I can't see the option "replace in all modules"...

Gunther

Jochen,

Quote from: jj2007 on June 23, 2014, 03:19:59 AM
In VB maybe, but in QE I can't see the option "replace in all modules"...

You should indeed work with a good editor. I can recommend TEA, which is available under several operating systems. The work is very convenient.

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

help to create an inc file ?

;--------------------------------------
; write here files to include
;--------------------------------------
           include     \...\...\thisFile.???
           ...
;--------------------------------------
; write here your EQU/MACROS
;--------------------------------------
NEWEQU       =25

.data
;--------------------------------------
; write here some data def
;--------------------------------------
thisstring        db "this string",0
.code
;-------------------------------------
; write here some procedures
;-------------------------------------
ProcX              proc
                      ...
                       ret
ProcX              endp
;------------------------------------
; save it like ThisInc.inc
; and put this into your .asm
;
; include       ThisInc.inc
;------------------------------------

To solve the problem "replace in all ..." i wrote
an .exe that do this, but i rarely use it now.
:t


nidud

#14
deleted