Hi, there:
I am a new guy in assembly programming, so I'm asking a very basic question.

We can use the 'SEGMENT/ENDS' directives in MASM to define our segments, besides there are many simplified segment definition directives such as .CODE, .DATA, .STACK, etc. They have the same effects, right?And when we use all those simplified directives, we should use the .MODEL directive to specify the memory mode. My questions are:
1. Why should we use .MODEL directive?What's the use of it?
2. Why we needn't use .MODEL when we use 'SEGMENT/ENDS' directives?

Thanks very much!
Posted on 2005-01-11 08:29:46 by bitcof
1. Why should we use .MODEL directive?What's the use of it?
2. Why we needn't use .MODEL when we use 'SEGMENT/ENDS' directives?



Hi bitcof

There's NO segments in windows programming, therefore
we use the FLAT memory model.


hope this helps


regards,

The SharK
Posted on 2005-01-11 09:32:58 by The SharK
.MODEL can be replaced by:
	_TEXT SEGMENT READONLY PAGE PUBLIC FLAT 'CODE'

_TEXT ENDS

CONST SEGMENT READONLY PUBLIC FLAT 'CONST'
CONST ENDS

_DATA SEGMENT PAGE PUBLIC FLAT 'DATA'
_DATA ENDS

_BSS SEGMENT PAGE PUBLIC FLAT 'BSS'
_BSS ENDS

ASSUME CS:FLAT, DS:FLAT, SS:FLAT, ES:FLAT
Which is better, imho.
Posted on 2005-01-11 18:37:33 by bitRAKE
But what if we programming just in real mode?
Posted on 2005-01-11 19:37:24 by bitcof
For real mode you would want to use other segment names/types as well as other assumptions. What is produced internally within MASM by each MODEL directive is outlined in detail within the MASM Manual. ".MODEL" merely is a shortcut for segment definitions and assumes.
Posted on 2005-01-11 22:05:24 by bitRAKE