954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Newbie here with a quick question

Hi guys. I've been working on some assembly programs for school and I'm having a couple of minor issues that are putting my progress to a halt.

My first question: how does one perform something similar to a scanf function in assembly? I just need to scan a single character from the keyboard. It would also be helpful if I knew where it was stored. I've looked in my text under keyboard interrupts but after trying most of the ones that appeared they might be what I was using, I've had no luck.

Many thanks in advance.

ECETiger
Newbie Poster
2 posts since Jul 2007
Reputation Points: 17
Solved Threads: 0
 

when you invoke int 16 the key is stored in the al register. You must save it someplace else if you need it later. The standard keyboard buffer can contain a maximum of 32 characters and its address is at 0x0000:0x041E.

>>perform something similar to a scanf function in assembly
assembly has no such function.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

well brother look and read for INT 21H with data moving to DX(for output or printf) and AL(for input or scanf) to use scanf and printf as you use in C.. Strings are handled in different way that a simple integer here in assembly. I would recommend you to read this ebook : IBM PC ASSEMBLY LANGUAGE PROGRAMMING.
HAVE A NICE DAY !! (mytime19)

mytime19
Junior Poster in Training
50 posts since Dec 2006
Reputation Points: 10
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You