🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #796

Re: How can I write to a PC port through dos

#796
From: Jack Klein
Date: Mon, 28 Dec 1998 00:00
48 lines
3173 bytes
On Sun, 27 Dec 1998 19:12:25 -0800, James Connell <mikeyyou@suck.ass> wrote:

> 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.
> 

<Jack>

Using [bp] for fetches will quite possibly give terribly wrong results in a
Win32 program, and assembler or not it will cause NT to shut down the program
instantly.

Exactly what did you think was wrong with Lawrence Kirby's assertion that the
C language provides no way to do this?  The recommendation for
comp.os.msdos.programmer is actually quite appropriate.  Other appropriate
groups would be compiler specific support groups, like
news:borland.public.cpp.language or news:microsoft.public.vc.language.

But any newsgroup which discusses standard C is not the proper place.

</Jack>

> 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
> > -----------------------------------------
Technical Details
Message-ID: <368a27dc.130154851@netnews.worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <914778641.26356.0.nnrp-12.c2dea518@news.demon.co.uk> <914788363snz@genesis.demon.co.uk> <3686F719.327E6798@ipns.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1014db,3e22ec85252b9f7c
X-Google-Attributes: gid1014db,public
X-Google-Thread: f58d1,3e22ec85252b9f7c
X-Google-Attributes: gidf58d1,public
X-Google-Thread: fdcad,3e22ec85252b9f7c
X-Google-Attributes: gidfdcad,public
X-Google-Thread: 114592,3e22ec85252b9f7c
X-Google-Attributes: gid114592,public
X-Google-Thread: f9822,3e22ec85252b9f7c
X-Google-Attributes: gidf9822,public
From: jackklein@att.net (Jack Klein)
Subject: Re: How can I write to a PC port through dos
Date: 1998/12/28
Message-ID: <368a27dc.130154851@netnews.worldnet.att.net>
X-Deja-AN: 426367105
Content-Transfer-Encoding: 7bit
References: <914778641.26356.0.nnrp-12.c2dea518@news.demon.co.uk> <914788363snz@genesis.demon.co.uk> <3686F719.327E6798@ipns.com>
Content-Type: text/plain; charset=us-ascii
Organization: AT&T WorldNet Services
Mime-Version: 1.0
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c,fr.comp.lang.c,fr.comp.lang.c++,han.comp.lang.c