inp input parameter type

In Watcom library the definition of inp(port) takes hardware port address.
In case if the port address we convert into int for example port address
0x8a0 is convert into 2208( int ) and called inp(2208),
the code could not read the port address correctly?

Am i missing something in this logic??

How is it taken internally?? by inp

“radha krishnan” <radha.nk@geind.ge.com> wrote in message
news:cp1omj$blq$1@inn.qnx.com

In Watcom library the definition of inp(port) takes hardware port address.
In case if the port address we convert into int for example port address
0x8a0 is convert into 2208( int ) and called inp(2208),

the code could not read the port address correctly?

What do you mean by “could not read the port address correclty”.

Am i missing something in this logic??

inp takes a binary number, where you express that value as hexadecimal,
decimal or octal is irrelavent;

inp ( 0x80a );
inp ( 2208 );
inp ( 04250 );

will all result in the same operation.

How is it taken internally?? by inp

It seems to me you are missing some basic understanding of data
representation in C


I will make a wild guess here? Are you getting sigsegv when inp is
executed, if you do then you are probably just missing option -T1 when
linking the executable, the program must then run under root.

Mario Charest wrote:


“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp1omj$blq$> 1@inn.qnx.com> …

In Watcom library the definition of inp(port) takes hardware port address.
In case if the port address we convert into int for example port address
0x8a0 is convert into 2208( int ) and called inp(2208),

the code could not read the port address correctly?

What do you mean by “could not read the port address correclty”.
The actual value to be read from hw is E0, But by using inp(2208) reading

256, whereas when using inp(0x8a0) reading E0
Why?
i read at the sametime, so cannot expect change in hardware value!

Am i missing something in this logic??

inp takes a binary number, where you express that value as hexadecimal,
decimal or octal is irrelavent;

inp ( 0x80a );
inp ( 2208 );
inp ( 04250 );

will all result in the same operation.


How is it taken internally?? by inp


It seems to me you are missing some basic understanding of data
representation in C



I will make a wild guess here? Are you getting sigsegv when inp is
executed, if you do then you are probably just missing option -T1 when
linking the executable, the program must then run under root.

“radha krishnan” <radha.nk@geind.ge.com> wrote in message
news:cp9s28$jgo$1@inn.qnx.com

Mario Charest wrote:


“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp1omj$blq$> 1@inn.qnx.com> …

In Watcom library the definition of inp(port) takes hardware port
address.
In case if the port address we convert into int for example port
address
0x8a0 is convert into 2208( int ) and called inp(2208),

the code could not read the port address correctly?

What do you mean by “could not read the port address correclty”.

The actual value to be read from hw is E0, But by using inp(2208) reading
256, whereas when using inp(0x8a0) reading E0

inp(2208) and inp(0x8a0) are exactly the same think.

Why?

You must be doing something wrong somewhere else in your code.

Mario Charest wrote:

“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp9s28$jgo$> 1@inn.qnx.com> …
The actual value to be read from hw is E0, But by using inp(2208) reading
256, whereas when using inp(0x8a0) reading E0

inp(2208) and inp(0x8a0) are exactly the same think.

Also, inp() should never return 256. It only reads one byte, and a byte
cannot have a value greater than 255.

Mario Charest postmaster@127.0.0.1 wrote:

“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp9s28$jgo$> 1@inn.qnx.com> …
Mario Charest wrote:


“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp1omj$blq$> 1@inn.qnx.com> …

In Watcom library the definition of inp(port) takes hardware port
address.
In case if the port address we convert into int for example port
address
0x8a0 is convert into 2208( int ) and called inp(2208),

the code could not read the port address correctly?

What do you mean by “could not read the port address correclty”.

The actual value to be read from hw is E0, But by using inp(2208) reading
256, whereas when using inp(0x8a0) reading E0

inp(2208) and inp(0x8a0) are exactly the same think.

Why?

You must be doing something wrong somewhere else in your code.

I was about to say that. From the watcom docs:

The inp() function reads one byte from the 80x86 hardware port whose
number is given by port.

How could you possibly get “256” as the result of a one byte read???

Cheers,
-RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~museum/

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:

Mario Charest wrote:
“radha krishnan” <> radha.nk@geind.ge.com> > wrote in message
news:cp9s28$jgo$> 1@inn.qnx.com> …
The actual value to be read from hw is E0, But by using inp(2208) reading
256, whereas when using inp(0x8a0) reading E0

inp(2208) and inp(0x8a0) are exactly the same think.

Also, inp() should never return 256. It only reads one byte, and a byte
cannot have a value greater than 255.

You beat me to it! :slight_smile:

Cheers,
-RK


[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~museum/