Example of input a single digit, Computer Engineering

Q. Example of Input a Single Digit?

Input a Single Digit for example (0,1, 2, 3, 4, 5, 6, 7, 8, 9)

 CODE SEGMENT

  ...

; Read a single digit in BL register with echo. No error check in the Program 

  MOV AH,  01H

                         INT 21H

; Assuming that the value entered is digit, then its ASCII will be stored in AL. 

; Suppose the key pressed is 1 then ASCII '31' is stored in the AL. To get the 

; Digit 1 in AL subtract the ASCII value '0' from the AL register.

; Here it store 0 as ASCII 30, 

; 1 as 31, 2 as 32.......9 as 39

; To store 1 in memory subtract 30 to get 31 - 30 = 1  

MOV BL, AL

SUB   BL, '0'; '0' is digit 0 ASCII

           ; OR

SUB BL, 30H

; Now BL contain the single digit 0 to 9

; The only code missing here is to check whether the input is in the specific

; Range.

...

CODE ENDS.

Posted Date: 7/31/2013 5:35:14 AM | Location : United States







Related Discussions:- Example of input a single digit, Assignment Help, Ask Question on Example of input a single digit, Get Answer, Expert's Help, Example of input a single digit Discussions

Write discussion on Example of input a single digit
Your posts are moderated
Related Questions
Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

In this part you are required to review and critique a website of a café or a restaurant of your choice. Your report should be a minimum 500 words with a maximum of 1000 words. You

In8085 are of the following statements is not true.A) Co-processor is interfaced in max mode. B) Co-processor is interfaced in MIN mode C )Co-processor is interfaced in max/min mod

Explain in details the various standard I/O interfaces. The various standard I/O interfaces are:  1. The Peripheral component interconnect(PCI) bus is a standard that suppor

Q. Show the instruction execution by using the micro-operations? A simple instruction can require: Instruction fetch: fetching instructions from the memory. Instruc

Let's provide you a fundamental illustration by which you may be able to define the concept of instruction format.  Let us consider the instruction format of a MIPS computer. MI

Internal Structure of Agents: We have looked at agents in terms of their external influences and behaviors: they put in from the surroundings and perform rational actions to a

Q. Explain working of Supercomputer? Supercomputers, capable of executing in excess of one billion floating-point operations per second (FLOPS), are very powerful, extremely hi

What is the difference among adding routes, to a webforms application and to an mvc application? Ans) To add routes to a webforms application, we use MapPageRoute() process of