Xref: utzoo comp.lang.c:15798 comp.sys.ibm.pc:23783 Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!tut.cis.ohio-state.edu!uccba!uceng!mfinegan From: mfinegan@uceng.UC.EDU (michael k finegan) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: Microsoft C 5.1 question Summary: Medium model far pointer question Keywords: Printf formats Message-ID: <617@uceng.UC.EDU> Date: 26 Jan 89 03:10:50 GMT References: <104@rpi.edu> <198@broadway.UUCP> <6951@june.cs.washington.edu> <8816@alice.UUCP> Organization: Univ. of Cincinnati, College of Engg. Lines: 19 I have been having a problem with far pointer conversion in MSC 5.1, using the medium memory model. It goes like this: in medium model code pointers are 32 bits, while data pointers are 16 bits. There is an exception to the data pointer size, and that is done using the keyword far. What I am trying to do is put an address into a far data pointer (unsigned char far * ptr), which works okay at first, but when the global pointer gets accessed in a subroutine, low and behold - it is different! It appears that the high order word is zeroed out ... My question: has anyone out there in net land put addresses into far pointers in medium model with success? Is there a trick? The people at MSC claim it should work, but they haven't tried to code it ... (By the way - I am using buildptr(segment,offset) from the LIM specs. to instantiate the pointers: the far pointer is treated as an unsigned long, and the segment is shifted left 16 and added to the offset to create the far ptr) Thanks, Mike Finegan mfinegan@uceng.uc.edu