Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!ucsfcgl!cgl.ucsf.edu!kneller From: kneller@cgl.ucsf.edu (Don Kneller) Newsgroups: comp.sys.ibm.pc Subject: Re: Where is the paralell port??? Message-ID: <11272@cgl.ucsf.EDU> Date: 13 Dec 88 23:32:29 GMT References: <10690@s.ms.uky.edu> <424@megatek.UUCP> Sender: daemon@cgl.ucsf.edu Reply-To: kneller@socrates.ucsf.edu.UUCP (Don Kneller) Organization: UCSF Computer Graphics Lab Lines: 33 In article <424@megatek.UUCP> hollen@spot.megatek.uucp (Dion Hollenbeck) writes: >> In article <464@octopus.UUCP> pete@octopus.UUCP (Pete Holzmann) writes: >>>be ignored. LPT1 is at whatever I/O address is stored in the 16 bits at >>>40:8, LPT2 at 40:0a, etc. >>> >>>unsigned far *lpts = 0x00400008L; /* Define a pointer to the LPT ports */ >>>unsigned LPT1Base = lpts[0]; >>> >> >FAR or HUGE >pointers are stored by MSC and TURBO C as 16bits of segment >and 16bits of offset, hence 0x0040:0008 make up the segment:offset >far pointer. > Both MSC and TURBO C provide a relatively easy method of producing far pointers without you having to know the internal details of how the pointers are broken down. For example, with MSC you can build the above pointer with: #include FP_SEG(lpts) = 0x0040; FP_OFF(lpts) = 0x0008; I don't know the syntax for TURBO, but they have a "make_far_ptr" macro which takes a segment and offset and does the bite-twiddling for you. Using these macros is much more transparent (i.e. "better programming style") than hard coding the internal representation of far pointers into the constant. ----- Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller INTERNET: kneller@cgl.ucsf.edu BITNET: kneller@ucsfcgl.BITNET