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.

Recommended Answers

All 2 Replies

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.

commented: Happy Independence Day! :) +15

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.