inline assembly getting user input.(djgpp)

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2005
Posts: 18
Reputation: reyhan12 is an unknown quantity at this point 
Solved Threads: 0
reyhan12 reyhan12 is offline Offline
Newbie Poster

inline assembly getting user input.(djgpp)

 
0
  #1
Dec 2nd, 2006
How do i get user input in assembly? after getting the input, i'd like for the inputted value to be stored in a char array in c.
i'm new to assembly and i am having a hard time trying to figure this out.
i've tried a code like this and obviously it's wrong. lol

  1. printf("Enter a 16 bit Hexadecimal number:");
  2. __asm__ ("leal edx,%0;"
  3. "movl ah, 0ah;"
  4. "int 21h;"
  5. : "=r" ( val )
  6. );

anyway, any help would be great. thanks!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,625
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1496
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: inline assembly getting user input.(djgpp)

 
0
  #2
Dec 2nd, 2006
you can't use interrupts in 32-bit protected-mode programs (e.g. windows or *nix programs). Easiest way is to call os C functions and let them deal with all the dirty stuff in protected mode. If you don't know how to do that there is another thread that will show you how to call ms-windows win32 api functions.
Last edited by Ancient Dragon; Dec 2nd, 2006 at 6:36 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Assembly
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC