News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

A stupid question.

Started by IAO, August 20, 2005, 09:29:22 PM

Previous topic - Next topic

IAO

Hi..

I don't write well English. But:

In my eternal search, of modularity. I modified example 11 of Iczelion.


.386
.model flat,stdcall
option casemap:none

include Ejem11.inc

.code
start:

WinMain proc ........
.
.
WinMain endp

WndProc proc .......
.
.
WndProc endp

include DlgProc.asm      <------------------------Here
end start


Is an ugly form of programming.?
As other programmers see this code?


It works well.

If you want download .ZIP.  Send me a commentary, any thing.

Thanks.
By(t)e ('_').


[attachment deleted by admin]
"There is no way to peace. Peace is the way."    Mahatma Gandhi

PBrennick

IAO,

Very nice.  I can't wait to see what you do next!

BTW:  I think you forgot to ask your question...

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Jeff

i think the question was: "is it good practice to 'include' the source of a file into another file?"

i personally would not "include" source code as i dont think that was what it was intended for.  for truly "modular" code, i would assemble/compile each module individually and link them together.  much more efficient IMO.

jojo

Quote from: Jeff on August 21, 2005, 05:25:03 AM
i think the question was: "is it good practice to 'include' the source of a file into another file?"

i personally would not "include" source code as i dont think that was what it was intended for.  for truly "modular" code, i would assemble/compile each module individually and link them together.  much more efficient IMO.

Including the *.asm will cost some milliseconds more, but it saves you the effort of a separate batch file for each source that you want to link with x others... unless you turn the include.asm into a private library that you can include in the source.

Mark Jones

Personally I find it cumbersome to have code in multiple files. This might be necessary for large projects, but for a beginner it might be easier just to keep everything in one file. :) There are a few syntaxial rules about including other .ASM files also. If memory serves me:

; MyInclude.asm v1.0.0
include masm32rt.inc   <--- will cause an error if already defined
.data
    MyVar1 dd 0  <--- if MyVar already defined, will cause error
.code
start:   <--- control blocks in included .asm's not allowed
MyProc proc local   <--- local procs are not accessible from other modules
    invoke ExitProcess,0
MyProc endp
end start   <--- no control block

Be sure to see the MASM32\help\ASMINTRO.HLP file - it details a lot of this. :)

Douzou yoroshiku,
Maruku (^_^)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

IAO

Hi...

I don't write well. But:
The questions are in green color. I wrote bad. Surely.
Thanks to all.  I read all post.  I read the ASMINTRO.HLP.

Asking again.
It is an ugly programming?.                                         -Esp-- (¿Es una forma fea de programar?)
To do that, is valid?.                                                   -Esp-- (¿Es válido hacer eso?)
Professional programmers, What can say, if I do that?.   -Esp--Programadores profesionales, ¿Qué dirían si hago eso?.

I like this.
;====================================
Quote from: jojo on August 21, 2005, 09:56:04 AM
Including the *.asm will cost some milliseconds more, but it saves you the effort of a separate batch file for each source that you want to link with x others...
;====================================


In language C:
I make file.h, and I call them from Main().                             -Esp-- Hago un archivo.h, y lo llamo desde Main().

I like that main(), remains single. Without so many functions and prototypes around.  -Esp-- Me gusta que main(), permanezca solo. Sin tantas funciones y prototipos alrededor. 
 
I want to do something similar in Masm32.  It is possible?         -Esp--Quiero hacer algo parecido en Masm32. ¿Es posible?

Send me a commentary, any thing.
Please, post in English, to avoid conflicts. Thanks.
By(t)e ('_').

"There is no way to peace. Peace is the way."    Mahatma Gandhi

PBrennick

IAO,
There is nothing wrong with your programming method.  There are a lot of different styles used by different people for various reasons.  I happen to agree with Mark, it is best to keep things simple (all in one file.  Next best would be your method of including modules.  Lastly, would be to assemble all the modules separately and then link them together.  Personally, the only time I use this method is when building a library.

Still, everyone has their favorite method and as long as the created EXE works correctly, who really cares?  IAO, what you have to do is decide, for yourself, which way you feel most comfortable with.  In terms of getting help from the community, we all can work with any of the methods so help is always available to you no matter what you decide.

BTW:  IAO?  Is that how chaio sounds when said while holding your tongue with your fingers?

hth,
Paul
The GeneSys Project is available from:
The Repository or My crappy website

ThoughtCriminal

I tried that style once but it seems to mess up the debugging info in VS.  If you don't care about debugging info its fine.


Personally I use the same method as Jojo seing as VS makes that method easy.


IAO

Hi...

Thank Paul. I understand.

I imagine, I must think in Masm32, and not in C.   It is better to keep things simple. (Ok, but Hmmm).

According to some sects:
IAO = It is a secret pronunciación. It is used for Prosperity. That was what I read.
The pronunciación is: iiiii aaaaa ooooo.  (That I read it. I do not know.)

Thanks.
By(t)e ('_').
"There is no way to peace. Peace is the way."    Mahatma Gandhi

Mark Jones

Maybe record you saying it and post the .wav file? :)
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

IAO

Hi...

Thanks,  ThoughtCriminal:
Yes, I don't care about debugging info. You are right.
I will be pending, on this topic. (in the future)


Mark Jones:
I will try to record it, and send to you, this week.



By(t)e ('_').
"There is no way to peace. Peace is the way."    Mahatma Gandhi

IAO

#11
Hi..
I don't write well. But:

Mark Jones:
Here this .wav (the sound is a little ugly).

When I was young (15)  (today=41) . I saw a film.
The father of the Douglas family (Kirck?). Singing a song said:
La, la, ...... IA, IA, O.  I think that it is a song of Cowboy or Mountain.
But I non remember much, single IAO.
It represented a Cowboy, playing with a banjo.

Esp:
Cuando era joven. (15 Años) (Hoy día 41). Vi una película.
El padre de la familia Douglas (Kirck?). Cantaba una canción diciendo:
La, la,.......... IA, IA, O. Pienso que es una canción de vaqueros o de montaña.
Pero no recuerdo mucho, solo IAO.
El representó un vaquero, tocando el banjo.


I hope understands my explanation.
By(t)e ('_').
"There is no way to peace. Peace is the way."    Mahatma Gandhi

Tedd

Old MacDonald had a farm
E-I-E-I-O
:cheekygreen:
No snowflake in an avalanche feels responsible.