Question: There is a need to write a program which computes the cube of the number entered from the keyboard. The number can be any number

There is a need to write a program which computes the cube of the number entered from the keyboard. The number can be any number between 0 and 9. For example, if the number entered from the keyboard is 4, the result should be computed as 43-64. If the entered character is not in between 0 and 9, the program should recheck the key press. The computation should be based on the LOOK-UP TABLE approach. The program should also store the result into the data segment area with variable named as "Output", Interrupt services 01 and 00 should be used to check key press and get the character, respectively. The ASCII codes of numbers 0, 1, .9 are 30H, 31H, 39H, respectively. Service 01: MOV AH, 01 Service 00: MOV AH, 00 INT 16H INT 16H Service 01: When a key is pressed,

.MODEL SMALL

.DATA

DATA1 DB blank

DATA2 DW 0, 1, 8, 27, 64, 125, 216, 343, 512, 729

OUTPUT DB blank

blank

MOV AX, @DATA

MOV DS, AX

blank

blank

Again:

INT 16H

JZ Again

MOV AH, 0

blank

blank

JB Again

CMP AL, 39H

blank

blank

Lut: MOV BX, CX

CMP AL, [BX + Offset DATA1]

JAE Exit

blank

Exit: MOV AX, [BX + Offset DATA2]

blank

MOV AH, 4CH

.CODE CMP AL, 30H LOOP Lut MOV AH, 01 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 JA Again MOV CX, 9 INT 16H MOV OUTPUT, AX 10 DUP (?) SUB AL, 30H

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!