Example of input a single digit, Computer Engineering

Assignment Help:

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.


Related Discussions:- Example of input a single digit

Differentiate between qa and testing, Differentiate between QA and testing....

Differentiate between QA and testing. - Quality Assurance is more a stop thing, ensuring quality in the company and thus the product rather than just testing the product for so

Determine the negation of the statement, Determine the negation of the stat...

Determine the negation of the statement? "2 is even and -3 is negative"? Answer: 2 is odd or -3 is not negative.

Explain sequential sharing, Explain Sequential sharing. Sequential s...

Explain Sequential sharing. Sequential sharing: In this technique of sharing, a file can be shared through only one program at a time, it is file accesses by P1 and P2 are

Variable or compound expression - unification algorithm, Variable or compou...

Variable or compound expression - Unification algorithm: Here some things to note regarding this method are:  (i) There if really trying to match a constant to a different

history of databases , Write a four-page paper how relational data solutio...

Write a four-page paper how relational data solution is applied to presnt Video Store business. 1.       Describe Relational Databases   2.       Write History of databases

Rcr, how to rotate shift right

how to rotate shift right

Board coloring, In this problem you are given a board in which some of the...

In this problem you are given a board in which some of the elements are placed as shown in diagram below. Each element represents a color. Fill the other elements in the board, suc

Pruning - artificial intelligence, Pruning - Artificial intelligence Re...

Pruning - Artificial intelligence Remember that pruning a search space means deciding that particular branches should not be explored. If an agent  surly  knows that exploring

Interrupt handling - computer architecture, Interrupt handling: Handlin...

Interrupt handling: Handling Interrupts  Several  situations where the processor should avoid interrupt requests Interrupt-enable Interrupt-disable  Typical

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd