This x86 Assembly Language program takes users input in 8086 Microprocessor Assembly Language and prints the cube of it.
To run this x86 Assembly Code you need to Download emu8086 software. Copy the following 8086 microprocessor Assembly Language code and paste this code to emu8086 and hit the play button.
TITLE PUCHTAA
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 0AH, 0DH, "ENTER A NUMBER TO FIND CUBE OF IT: $"
OUT1 DB 0AH, 0DH, "CUBE OF $"
OUT2 DB " IS $"
QUIT DB 0AH, 0DH, "CONTINUE? Y FOR YES ELSE FOR NO: $"
.CODE
MAIN:
MOV AX, @DATA
MOV DS, AX
AGAIN:
LEA DX, MSG
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
PUSH AX
CMP AL, 39H
JG AGAIN
CMP AL, 30H
JL AGAIN
PUSH AX
PUSH AX
SUB AL, 30H
MOV BL, AL
MUL BL
AAM
MOV BX, AX ; BH = 06, BL, 04 ; IF ENTERED 08
POP AX
SUB AL, 30H
MUL BL
AAM
MOV CL, AL ; FIRST RESULT
MOV CH, AH ;CARRY
POP AX
SUB AL, 30H
MOV BL, AL
MOV AL, BH
MUL BL
AAM
ADD AL, CH
AAA
MOV BX, AX
LEA DX, OUT1
MOV AH, 09H
INT 21H
POP DX
MOV AH, 02H
INT 21H
LEA DX, OUT2
MOV AH, 09H
INT 21H
MOV DL, BH
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, BL
ADD DL, 30H
MOV AH, 02H
INT 21H
MOV DL, CL
ADD DL, 30H
MOV AH, 02H
INT 21H
LEA DX, QUIT
MOV AH, 09H
INT 21H
MOV AH, 01H
INT 21H
OR AL, 20H
CMP AL, 'y'
JE AGAIN
MOV AH, 04CH
INT 21H
END MAIN
OUTPUT
TAGS:
- assembly language
- emu8086
- assembly code
- assembly language programming
- x86 assembly
- assembly language example
- cube of number assembly language
1 comment:
Post a Comment