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

use and benefits of object-oriented programming, The Chocolate Delights Ca...

The Chocolate Delights Candy Company requires to add the following functionality to its cash register: When a customer is checking out, the cash register requires keeping the ne

Swing, how to make a dfd of simple calculator?

how to make a dfd of simple calculator?

What is clear operation, Clear operation The clear operation compares w...

Clear operation The clear operation compares words present in A and B and produces an all 0's result if two numbers are equal. This operation is achieved by the exclusive-OR mi

What is an html tag, An HTML tag is a syntactical construct in the HTML lan...

An HTML tag is a syntactical construct in the HTML language that abbreviates particular instructions to be implemented when the HTML script is loaded into a Web browser. It is like

How do we prevent selected parameters of a module, How  do  I  prevent  sel...

How  do  I  prevent  selected  parameters  of  a  module  from  being  overridden  during instantiation? If a specific parameter within a module must be prevented from being ov

Security, We now consider the relation between passwords and key size. For ...

We now consider the relation between passwords and key size. For this purpose consider a cryptosystem where the user enters a key in the form of a password. Assume a password consi

Determine the basic machine language instructions, Determine the basic Mach...

Determine the basic Machine language instructions Machine language instructions and data are in terms of 0s and 1s and are stored in the memory. It isn't possible to distinguis

show bank type , Describe an abstract class 'Bank' having abstract methods...

Describe an abstract class 'Bank' having abstract methods as 'CreateAccount' 'depositAmount' & 'withDrawAmount'.Add method definitions for 'CalculateInterest' and 'SetInterest' as

Differentiate between protection and security, Differentiate between protec...

Differentiate between protection and security. Operating system contains a collection of objects, software or hardware. All objects have a unique name and can be accessed by

What is the vertical organizational structure, What is the Vertical Organiz...

What is the Vertical Organizational Structure? This is a traditional approach that is typified by a functional approach to work in that departments work onto tasks relevant to

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