Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ames!ucbcad!ucbvax!hplabs!hpcea!hpccc!kevino From: kevino@hpccc.HP.COM (Kevin Owen) Newsgroups: comp.sys.ibm.pc Subject: Re: Looking for C functions to access PC memory Message-ID: <5060012@hpccc.HP.COM> Date: Tue, 10-Nov-87 23:35:16 EST Article-I.D.: hpccc.5060012 Posted: Tue Nov 10 23:35:16 1987 Date-Received: Sun, 15-Nov-87 03:28:51 EST References: <24261F3U@PSUVMB> Organization: HP Corporate Computing Center Lines: 55 / hpccc:comp.sys.ibm.pc / luis@grinch.UUCP (luis) / 8:43 pm Nov 7, 1987 / In article <447@ucdavis.ucdavis.edu> kwok@iris.UUCP (Conrad Kwok) writes: >When you are using C, you don't need any special routine to read >memory. All you need to do is to declare a pointer (near or far >depending on the address) and then you may read or write to that >location using normal assignment statements. Here is an example to >read the value at location 0xC000:0x0100 > > char far *ptr; > > ptr = (char far *) 0xC0000100L; > printf("Value at 0xC000:0x0100 is %d\n", *ptr); > >[...] Thank you for posting the example, but I have a few questions... 1. Why is there an 'L' at the end of the address? (does it stand for Long?) 2. I have been trying to access the DTR on my modem, but I don't know what the base address is. From the Technical Reference, I know that the offset is 3FE (bit 0), but can't find the base addres.. Can anyone help? ------------------------------------------------------------------------------- Luis Chanu "Live every day as if it were your last, UUCP: ...ihnp4!sun!aeras!grinch!luis because one day you will be right." UUCP: ...pyramid!wjvax!grinch!luis -Benny Hill Disk-Claimer: That's not your disk, that's my disk. ------------------------------------------------------------------------------- ---------- While I did not post the above response I thought I might take a stab at addressing your questions. You are correct that L indicates long. As for your second question - you need to use inp() and outp() to be able to access your serial port. Both serial and parallel ports on a PC are considered to reside in I/O space and cannot be accessed using memory references. A sample code fragment follows : ------------------------------------ #include unsigned port = 0x3fe; char result; result = inp(port); /* Result now contains the byte input from port 3fe */ printf("DTR is %s\n",(result & 0x01) ? "HIGH" : "LOW"); ------------------------------------ I hope this helps... Regards, Kevin Owen