Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
82
Task/Mutual-recursion/X86-Assembly/mutual-recursion.x86
Normal file
82
Task/Mutual-recursion/X86-Assembly/mutual-recursion.x86
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
global main
|
||||
extern printf
|
||||
|
||||
section .text
|
||||
|
||||
func_f
|
||||
mov eax, [esp+4]
|
||||
cmp eax, 0
|
||||
jz f_ret
|
||||
dec eax
|
||||
push eax
|
||||
call func_f
|
||||
mov [esp+0], eax
|
||||
call func_m
|
||||
add esp, 4
|
||||
mov ebx, [esp+4]
|
||||
sub ebx, eax
|
||||
mov eax, ebx
|
||||
ret
|
||||
f_ret
|
||||
mov eax, 1
|
||||
ret
|
||||
|
||||
func_m
|
||||
mov eax, [esp+4]
|
||||
cmp eax, 0
|
||||
jz m_ret
|
||||
dec eax
|
||||
push eax
|
||||
call func_m
|
||||
mov [esp+0], eax
|
||||
call func_f
|
||||
add esp, 4
|
||||
mov ebx, [esp+4]
|
||||
sub ebx, eax
|
||||
mov eax, ebx
|
||||
ret
|
||||
m_ret
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
main
|
||||
mov edx, func_f
|
||||
call output_res
|
||||
mov edx, func_m
|
||||
call output_res
|
||||
ret
|
||||
|
||||
output_res
|
||||
xor ecx, ecx
|
||||
loop0
|
||||
push ecx
|
||||
call edx
|
||||
|
||||
push edx
|
||||
|
||||
push eax
|
||||
push form
|
||||
call printf
|
||||
add esp, 8
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
inc ecx
|
||||
cmp ecx, 20
|
||||
jnz loop0
|
||||
|
||||
push newline
|
||||
call printf
|
||||
add esp, 4
|
||||
|
||||
ret
|
||||
|
||||
|
||||
section .rodata
|
||||
form
|
||||
db '%d ',0
|
||||
newline
|
||||
db 10,0
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue