Article View: alt.comp.lang.learn.c-c++
Article #795Re: How can I write to a PC port through dos
From: James Connell
Date: Sun, 27 Dec 1998 00:00
Date: Sun, 27 Dec 1998 00:00
37 lines
2647 bytes
2647 bytes
actually DOS has nothing to do with it! the Intel prossor has an in and an out instruction to write a byte or word (also strings) to one of 64K IO ports pointed to by the DX register ( or by an 'Immediate' operand for the first 256). while not opsys dependant it is system dependant. check the documentation of the compiler you're useing for the functions inp(),inpw(),outp(),outpw() or some such. if you can't find any of these than look up the section on 'mixed lanuage' programming because you're going to need to write them yourself in assembler. the function are easy to do if you pay attention to the memory model used for the [bp] fetches. Lawrence Kirby wrote: > > In article <914778641.26356.0.nnrp-12.c2dea518@news.demon.co.uk> > sar@sar-home.demon.co.uk "Spencer Anthony Robinson" writes: > > >Please could somebody help me I am trying to find out how to use C to read > >and write to the ports of a PC though DOS. Any examples would be appreciated > > The C language itself provides no way to do this. You'll need to use > DOS related extensions so ask in a newsgroup such as > comp.os.msdos.programmer. Incidentally why did you cross-post this > to non-English language newsgroups? > > -- > ----------------------------------------- > Lawrence Kirby | fred@genesis.demon.co.uk > Wilts, England | 70734.126@compuserve.com > ----------------------------------------- -- James Connell Do not Fold, Spindle, or Mutilate. The opinions expressed herein do not necessarily reflect those of the author.
Technical Details
Message-ID:
<3686F719.327E6798@ipns.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<914778641.26356.0.nnrp-12.c2dea518@news.demon.co.uk> <914788363snz@genesis.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f58d1,3e22ec85252b9f7c X-Google-Attributes: gidf58d1,public X-Google-Thread: 114592,3e22ec85252b9f7c X-Google-Attributes: gid114592,public X-Google-Thread: fdcad,3e22ec85252b9f7c X-Google-Attributes: gidfdcad,public X-Google-Thread: f9822,3e22ec85252b9f7c X-Google-Attributes: gidf9822,public X-Google-Thread: 1014db,3e22ec85252b9f7c X-Google-Attributes: gid1014db,public From: James Connell <mikeyyou@suck.ass> Subject: Re: How can I write to a PC port through dos Date: 1998/12/27 Message-ID: <3686F719.327E6798@ipns.com> X-Deja-AN: 426322683 Content-Transfer-Encoding: 7bit References: <914778641.26356.0.nnrp-12.c2dea518@news.demon.co.uk> <914788363snz@genesis.demon.co.uk> Content-Type: text/plain; charset=us-ascii X-Trace: news2.giganews.com 914814892 208.129.192.112 (Sun, 27 Dec 1998 21:14:52 CDT) Organization: jConn Inv. MIME-Version: 1.0 NNTP-Posting-Date: Sun, 27 Dec 1998 21:14:52 CDT Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c,fr.comp.lang.c,fr.comp.lang.c++,han.comp.lang.c