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
what are the different techniques of biasing a transistor?

Q. Explain process of File Transfer Protocol? FTP (File Transfer Protocol), a standard Internet protocol, is the simplest way to exchange files between computers on Internet. L

Explain briefly, why dynamic RAMs require refreshing? Ans: Due to the charge's natural tendency to distribute itself in a lower energy-state configuration that is, the charg

Explain the term step-wise refinement. Ans:  Step Wise Refinement  Refinement is a method of elaboration. Here one starts with a statement of function that is described a

Q. Show the Connections used in Sound cards? Sound cards must have connections to allow different functions.  One of the most significant is MIDI port (MIDI signifies Musical I

Consider the ReadRear Java method (a) Illustrate pictures that explain the data structure every time a checkpoint is reached for the problems of sizes one, two, three and four s

The commands (instructions) are native instructions to the 68HC11 and therefore it is termed a low level language program. Examining the program the instructions (mnemonics) they a

Predicates in propositional model: The predicates take a number of arguments in which for now we assume are ground terms and represent a relationship between those arguments t

Q. Explain Arithmetic Data Processing Instructions? These instructions carry outlogical and arithmetic operations on data. Arithmetic: The four fundamental operations are

You are required to make a class of WordPuzzle, which is basically a game of finding words inside a 2d-array of characters. The class needs to take rows and columns as arguments an