-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathpower.asm
59 lines (46 loc) · 861 Bytes
/
power.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; Code for Program to Calculate power(a,b) i.e a^b in Assembly Language
.MODEL SMALL
.DATA
BASE DB ?
POW DB ?
NL1 DB 0AH,0DH,'ENTER BASE:','$'
NL2 DB 0AH,0DH,'ENTER POWER:','$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
ENTER_BASE:
LEA DX,NL1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV BL,AL
MOV BASE,AL
ENTER_POWER:
LEA DX,NL2
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV CL,AL
DEC CL
MOV AX,00
MOV AL,BASE
LBL1:
MUL BL
LOOP LBL1
MOV CL,10
DIV CL
ADD AX,3030H
MOV DX,AX
MOV AH,02H
INT 21H
MOV DL,DH
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN