Re: I can't understand the program structure



spamtrap@xxxxxxxxxx wrote:

I have already studied the c language
...
But assemble language let me have a problem.

prognam segment
mian proc far
assume cs;
start:
.....


main endp
prognam ends
end start

could I convert it into this style:

prognam segment
mian proc far
assume cs;
start:
.....

end start
prognam ends
main endp

because i realize this is better understood...

Better understood by whom?

You can't make that change, because it is wrong. The "end" directive tells
MASM "this is the end of the source code you have to assemble. Everything
following this line can be ignored." Thus, it would never see the ends or
endp, and you would get assembly errors. The "end" line needs to be the
very last line.

The "end start" line is not paired with the "start:" line in the same way
that segment/ends and proc/endp are paired. The "end" line is special. If
your program is split into several .asm files, only ONE of the files can
have a name on the "end" line. That tells the linker and the operating
system where your program should start executing.

Since all you need is a symbol, you could say "end main" and skip the
start: line.
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

.