All of lore.kernel.org
 help / color / mirror / Atom feed
* extended assembly
@ 2005-07-06 19:18 Martin Fflores
  2005-07-06 19:35 ` Frank Kotler
  2005-07-07  2:12 ` Herbert Poetzl
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Fflores @ 2005-07-06 19:18 UTC (permalink / raw)
  To: linux-assembly

hi! everyone, i have a rare problems here, i dont know if i do somethign 
wrong or the compiler have some problems, when i read a value from a port(a 
byte) the first time it's retun to me a byte so i catch and use printf to 
show this value, the secon time its return to me a integer value or a dont 
know, let me give you a example:

char value=0;
__asm__ __volalile__("cli;inb $0x60,%0;sti;":"=r"(value));
printf("%x",value);// the first time usually return 1c
// this is the second time
__asm__ __volalile__("cli;inb $0x60,%0;sti;":"=r"(value));
printf("%x",value);// this print in teh screen ffffffa ainteger value

i'm expecting a ACK response for the keyboard ACK is in the ffffffa the 
first byte buti cant never know ir caouse when i ask for ack it inst ack in 
ffffffa and it is bigger than a byte why iot happend??????????????????''

Take Care Folks.

Martin Flores

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: extended assembly
  2005-07-06 19:18 extended assembly Martin Fflores
@ 2005-07-06 19:35 ` Frank Kotler
  2005-07-07  2:12 ` Herbert Poetzl
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Kotler @ 2005-07-06 19:35 UTC (permalink / raw)
  To: linux-assembly

Martin Fflores wrote:

> char value=0;

Would "unsigned char" help? I'm pretty clueless on C or inline asm, but 
that's what I'd try...

Best,
Frank


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: extended assembly
  2005-07-06 19:18 extended assembly Martin Fflores
  2005-07-06 19:35 ` Frank Kotler
@ 2005-07-07  2:12 ` Herbert Poetzl
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Poetzl @ 2005-07-07  2:12 UTC (permalink / raw)
  To: Martin Fflores; +Cc: linux-assembly

On Wed, Jul 06, 2005 at 07:18:48PM +0000, Martin Fflores wrote:
> hi! everyone, i have a rare problems here, i dont know if i do somethign 
> wrong or the compiler have some problems, when i read a value from a port(a 
> byte) the first time it's retun to me a byte so i catch and use printf to 
> show this value, the secon time its return to me a integer value or a dont 
> know, let me give you a example:
> 
> char value=0;
> __asm__ __volalile__("cli;inb $0x60,%0;sti;":"=r"(value));
> printf("%x",value);// the first time usually return 1c
> // this is the second time
> __asm__ __volalile__("cli;inb $0x60,%0;sti;":"=r"(value));
> printf("%x",value);// this print in teh screen ffffffa ainteger value
> 
> i'm expecting a ACK response for the keyboard ACK is in the ffffffa the 
> first byte buti cant never know ir caouse when i ask for ack it inst ack in 
> ffffffa and it is bigger than a byte why iot happend??????????????????''

man 3 printf

       o,u,x,X   The unsigned int argument is converted to unsigned 
		     ~~~~~~~~~~~~~~~~~~~~~
		 octal (o), unsigned decimal (u), or unsigned hexadecimal
		 (x and X) notation. 

The length modifier
       hh        A following integer conversion corresponds to a 
		 signed char or unsigned char argument, or a
              	 following n conversion corresponds to a pointer 
		 to a signed char argument.

the 'char' value is signed, and is implicitely converted
to an int, which in turn is printed as unsigned hex 'x'

 0xfa (-5) -> 0xfffffffa

best,
Herbert

> Take Care Folks.
> 
> Martin Flores
> 
> _________________________________________________________________
> Don't just search. Find. Check out the new MSN Search! 
> http://search.msn.com/
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-07  2:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-06 19:18 extended assembly Martin Fflores
2005-07-06 19:35 ` Frank Kotler
2005-07-07  2:12 ` Herbert Poetzl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.