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

Find farthest distance from exchange where subscriber locate, An exchange u...

An exchange uses a -40 V battery to drive subscriber lines. A resistance of 250 ohms is placed in series with the battery to protect it from short circuits. The subscribers are req

Stencil duplicating, Stencil Duplicating Equipment Required Stenci...

Stencil Duplicating Equipment Required Stencil Duplicator Thermal copier (optional) Electronic stencil cutter Materials Stencil COPY paper Ink Clean

What is digital versatile disk, Digital versatile disk (DVD) This is an...

Digital versatile disk (DVD) This is an optical system for storing data. It's similar to CD though typically can hold 4.7 Gbyte of data compared to only 700 MB of data on a CD.

Why floating point numbe process than integer, Why floating point number mo...

Why floating point number more difficult to represent and process than integer? In floating point numbers we have to show any number in three fields sign, exponent and mantissa

E brokerage facilitates search & retrieval of information, E Brokerage faci...

E Brokerage facilitates search & retrieval of Information The success factor of a brokerage is its ability to retain existing clients and to enhance their satisfaction by effec

Shell script, shell script for addnames that has to be called as class list...

shell script for addnames that has to be called as class list in the name of the class list file and username is a particular student''s username

What is knowledge representation and reasoning, Artificial Intelligence Kno...

Artificial Intelligence Knowledge show (KR) is an area of artificial intelligence research aimed at showing knowledge in symbols to facilitate inferrencing from those knowledge ele

Hypothetical reliable data transfer protocol, the c code for hypothetical r...

the c code for hypothetical reliable data transfer protocol

Swing, how to make a dfd of simple calculator?

how to make a dfd of simple calculator?

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