News:

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

multiple code segment

Started by paja, September 01, 2008, 11:25:16 AM

Previous topic - Next topic

paja

Hi all :bg
I'm a student and I'm learning assembly x86 working with the masm environment.

I have the following question: manipulating the .model directive I can choose the memory model for my program, but why should I use multiple code (or data) segments?
For example, what are the benefits to have n different code segments?

Thanks a lot! :wink

BogdanOntanu

In 32bit windows assembly you only use .model FLAT
This means that you have .code , .data and .data? "segments" And all segments are  sharing the same FLAT super group.

Do not confuse the segments that are used by MASM or assemblers or compilers to divide the program with the segments used by CPU when in real mode or the selectors used by the CPU in protected mode... they are NOT the same thing.

Using other models is for older environments like DOS/BIOS etc.

Multiple code segments can be used to group code in certain order in the same group. However those kind of things are either old and specific to DOS/BIOS programming or mixing 16 bits code with 32 bits code at system initialization... and are much to complicated to be understood or to be of real use to a beginner in assembly (OS programming)

For a start learn to write programs in win32 environment with FLAT model using MASM32.

Forget about old DOS and segmentation and 16 bits tutorials for a while. When you become experienced you can come back and turn the light onto those dark dusty places and clean them up.



Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

paja

Ok, thanks a lot for your suggestions! :bg