add files
[idlebox.git] / power.s
blob66df379a0a11a909eb8c67007d64698ce6a978c1
1 .section .data
2 .section .text
3 .globl _start
5 _start:
6 pushl $3
7 pushl $2
8 call power
9 addl $8, %esp
10 pushl %eax
11 push $2
12 push $5
13 call power
14 add $8, %esp
15 popl %ebx
17 add %eax, %ebx
18 movl $1, %eax
19 int $0x80
22 .type power, @function
23 power:
24 pushl %ebp
25 movl %esp, %ebp
26 subl $4, %esp
27 movl 8(%ebp), %ebx
28 movl 12(%ebp), %ecx
29 movl %ebx, -4(%ebp)
31 power_loop_start:
32 cmpl $1, %ecx
33 je end_power
34 movl -4(%ebp), %eax
35 imull %ebx, -4(%ebp)
36 decl %ecx
37 jum power_loop_start
39 end_power:
40 movl -4(%ebp), %eax
41 movl %ebp, %esp
42 popl %ebp
43 ret