Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!necntc!gkb From: gkb@necntc.NEC.COM (Greg Busby) Newsgroups: comp.sys.ibm.pc Subject: Re: ASM segment questions Message-ID: <10953@necntc.NEC.COM> Date: Fri, 13-Nov-87 10:07:49 EST Article-I.D.: necntc.10953 Posted: Fri Nov 13 10:07:49 1987 Date-Received: Sun, 15-Nov-87 08:51:14 EST References: <585@ihnet.ATT.COM> <700@rlgvax.UUCP> Reply-To: gkb@necntc.UUCP (Greg Busby) Organization: NEC Electronics Inc. Natick, MA 01760 Lines: 52 In article <700@rlgvax.UUCP> dennis@rlgvax.UUCP (Dennis.Bednar) writes: >So my question is this, given the following ASM statement: > > label segment para public 'CODE' > >how does the linker use label (if at all) and CODE (if at all)? >Please post replies to the net, as I am sure others would be interested. >FullName: Dennis Bednar label is the name of hte segment. this means that any other segment declarations with the name 'label' will be part of the same segment as far as the linker is concerned. segment is the masm command that says this is a segment :-). para is the linkage attribute, which says the segment must start on an even paragraph (multiple of 10H) when loaded. this is retained by the linker. public is the combination type, which tells the linker how to allocate memory for this segment. public means that the information in this segment will be combined such that the segment size is equal to the total size of all segments named 'label' in class 'CODE' in all modules linked, and that the info will be placed in memory n the order it is encountered n the different modules. this is the most common combination type. CODE is the class name. you can have segments of the same name (eg. label) but in different classes, and they are NOT in the same hardware segment (although in some memory models they will happen to be) unless they are GROUPed together. (Isn't this fun?). class information is retained in the final .exe file, and can be used by some programs to locate addresses for producing rommable code, etc. for example, in a C program the _DATA segment and some others (ie. _CVTSEG, _SCNSEG in turboc) will all be (or should all be) in the 'DATA' class. _TEXT will be in the 'CODE' class. _DATA, _BSS, _BSSEND, _STACK will all be in the group DGROUP, which is the hardware segment DS (again, small model). There are lots of tricks which can be employed in setting up segments, but if you don't know them you probably don't need them. the simple segment definition that you gave at the top iwll work just fine for most assembly programs, with one code and one data segment. if you are using more than 64k code and 64k data, use C and don't worry about it :-). GKB -- * I'm not sure what upsets me more -- that people are so unwilling to * accept responsibility for their own actions, or that they are so * willing to regulate everyone else's -- Anon.