[net.micro.pc] microemacs 3.6 on ibm pc with lattic

by@hp-pcd.UUCP (by) (05/15/86)

Howdy!

Lattice 3.0 has a flag you can add to the large DATA and large LARGE model
compiles to keep execution speed reasonable:

	-md     -->   -mds               /* for DATA */
	-ml     -->   -mls					/* for LARGE */

What happens is that you can still use 32-bit pointers but ONLY 16-bit
offsets from those pointers. Normally, this won't be a problem--only if
the code tries to manipulate huge arrays (>64K).

Hope the -s suffix works for you.

Bill Yoder
hplabs!hp-pcd!by   (503) 757-2000 

jrv@siemens.UUCP (06/04/86)

>... and if you ever plan on writing programs for the i80286, don't
>"normalize" pointers.  To paraphrase some Microsoft documentation:
>
>	When a program loads a segment register on an 8086, it is
>	actually loading a displacement value.  On the 80286, what
>	is loaded is actually a segment number indexing to an entry
>	in the master segment table.  The actual displacement value
>	is loaded from that table.  There is NO relation between
>	segment N and segment N+1 (ie N+1:0 != N:10h).
>
>I assume that they're talking about the protected mode of the 286.  Since
>DOS presently doesn't use the protected mode, you're OK for now.  Still,
>any programming practice which counts on two segment:offset pairs pointing
>to the same place in memory will need to be changed before DOS 5.0.
>If segment:offset pairs are used properly, normalization is not needed.
>
>-- Skip Addison
>   {lll-crg, decwrl, ihnp4}!amdcad!cae780!ubvax!skip


Lattice's handling of 4 byte pointers has advantages which allows you to
do things which other implementations of C on the 8086 family do not.
The one thing which has saved me on a number of occassions is the ability
to have an array which goes beyond the 64k segment size. This array must
be dynamically allocated at run time but it can be as big as all of the
available memory.

When using large data model without the '-s' option the normalizing of
pointers is a side effect of Lattice's pointer handling. For any arithmetic
operations on a pointer Lattice will convert the pointer(s) in question
to real 20 bit addresses perform the calculation or comparision and then
provide a normalized 4 byte pointer as a result. These operations are all
done by compiler functions. (I once attempted to rewrite all these functions
so that any NULL pointer references could be trapped. NULL pointer
references in large data model can have disastrous effects, i.e. crash
hard disks with a single store.) Presumably, a compiler for the 286
protected mode would have to perform the proper real address computation
using the values in the master segment table.

Because of the architecture of the 8086 and 80286 I know of no other
way to do the pointer operations to get access to data which exceeds the
size of one segment. Is there another "proper" way to use segment:offset
pairs? (An Intel rep suggested that I wait until the 386 is available!)


Jim Vallino
Siemens Research and Technology Lab.
Princeton, NJ
{allegra,ihnp4,seismo,philabs}!princeton!siemens!jrv