Path: utzoo!mnetor!uunet!husc6!bbn!mit-eddie!ll-xn!ames!nrl-cmf!ukma!psuvm.bitnet!ahs From: AHS@PSUVM.BITNET Newsgroups: comp.sys.ibm.pc Subject: Re: Segmented vs linear architectures. Message-ID: <34208AHS@PSUVM> Date: 22 Feb 88 03:19:45 GMT Organization: The Pennsylvania State University - Computation Center Lines: 56 Friedl I prefer to program my utilities in assembler (and my applications in APL). Hooking extensions to the OS of a 8085 (a 64k linear memory microprocessor) was not fun because I had to constantly recompile to relocate the code in memory if another extension was already there. (I mean extensions such as: keyboard remapper, data compressor, keyboard macro, xmodem, special disk access, commandline editor, etc). For me, the 80x86 8088 (a segmented microprocessor) was a great relief because each COM program owns its 64k absolute address space starting at address 0000. That is, you program as if the memory was empty and you always start at address 0000 or (0100). The OS then takes care of loading an *exact* copy of the program somewhere in memory (at the first free starting point among the 64,000+ possible starting points for a COM program segment). There is no need to recompile (or dynamically patch) for each new position of the program in memory because the OS loads an *exact* copy of the program in the segment (with segments and COM programs, there is no need to dynamically patch the code as *must* be done in a linear memory scheme). These are the reasons why I am very fond of segments: they totally eliminate the relocation problem without any loss of loading speed, or of execution speed, or of flexibility, and without any programming effort. Note that I program in assembler, and that a 64k assembler *program* is a huge program that I doubt few people have ever written. Note also that a COM program can access the full address space of 8086/8088 (ie,1-Meg) and therefore can use for *data* *ALL* the free memory, even above 640k if there is some memory there (such as the video memory). To access this free memory is exactly what the DS and ES segment registers are for. As a last note, I program using the A86/D86 assembler/debugger which designed for writing COM program and using modular blocks of assembly code (or libraries of source code). (It does not use libraries of OBJ modules because it assembles code faster that a linker can link OBJ modules, and with the added benefit that source modules can be edited (or set by equates) for exact array sizes while OBJ cannot be edited). Since the assembler deals only with COM files, it is free of all the complications and speed degradation needed to generate linkable code (ie, OBJ) that are used (in conjunction with an OBJ library) to either create EXE programs or to be linked into other language OBJ modules that need assembly program modules for speed or flexibility. Note also that with a 80386, the size of a segment can be as large as the full address space. That should take care of people writing compilers who need large blocks of linear memory to make their programming life easier. If one does not program in assembler, the benefits of segments are harder to use and appreciate. Michel PS: Wordstar, DBase, TurboPascal, TurboBasic, and probably TurboC were written in assembler. --e-o-f--