Hi every one..
Please.. I need a program to calculate X power Y by assembely language.. Please friends help me .

Recommended Answers

All 4 Replies

You need a code that loops that's all.Sample this one
mov ffffh, 0
label x_pow_y
mov ax,2
mul ax,2
inc ffffh ;memory location+1 until it's equal to one
cmp [ffffh],y
je display_result ;if it has been looped continously until Y times
loop x_pow_y ;else it wiil loop
code for displaying result
Exapmle is 2 power 3
2 is moved ot ax, multipied by itself and ffffh incremented
until it is =3

x equ 2
y equ 3 /*declare the var*/
mov ax,01h
mov bx,x
mov cx,y
loop1:mul bx
loop loop1
/*ax will have the result... and if in case the result occupies more than 16 bits...then the higher word is in dx */
note: this program is written for 8086 machine......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.