recreate project as DLL
This commit is contained in:
39
test_cases/backwards.asm
Normal file
39
test_cases/backwards.asm
Normal file
@@ -0,0 +1,39 @@
|
||||
format ms64 coff
|
||||
|
||||
section '.text' code readable executable
|
||||
|
||||
use64
|
||||
|
||||
public _loop
|
||||
_loop:
|
||||
xor eax, eax
|
||||
inc eax
|
||||
mov rbx, rdx ; RDX is overwritten by mul
|
||||
@again:
|
||||
cmp rbx, 0
|
||||
je @loop_end
|
||||
mul rcx
|
||||
dec rbx
|
||||
jmp @again
|
||||
@loop_end:
|
||||
ret
|
||||
|
||||
public _tail_recursion
|
||||
_tail_recursion:
|
||||
test ecx, ecx
|
||||
je @is_0
|
||||
mov eax, ecx
|
||||
dec ecx
|
||||
@loop:
|
||||
test ecx, ecx
|
||||
jz @tr_end
|
||||
|
||||
mul ecx
|
||||
dec ecx
|
||||
|
||||
jnz @loop
|
||||
jmp @tr_end
|
||||
@is_0:
|
||||
mov eax, 1
|
||||
@tr_end:
|
||||
ret
|
||||
Reference in New Issue
Block a user