알고리즘
-
2진 검색(binary search) - MASM알고리즘 2013. 6. 5. 19:32
TITLE Binary Search Procedure (Bsearch.asm) ; INVOKE BinarySearch, ADDR array, ARRAY_SIZE, eax .386.MODEL flat,stdcall.STACK 4096 .codeBinarySearch PROC USES ebx edx esi edi,pArray:PTR DWORD,; pointer to arrayCount:DWORD,; array sizesearchVal:DWORD; search value LOCAL first:DWORD,; first positionlast:DWORD,; last positionmid:DWORD; midpoint movfirst,0; first = 0moveax,Count; last = (count - 1)de..
-
integer2string알고리즘 2013. 5. 27. 19:27
.equ ST_VALUE, 8.equ ST_BUFFER, 12 .globl integer2string.type integer2string, @functioninteger2string:pushl %ebpmovl %esp, %ebp movl $0, %ecxmovl ST_VALUE(%ebp), %eaxmovl $10, %ediconversion_loop:movl $0, %edxdivl %edi addl $'0', %edxpushl %edxincl %ecxcmpl $0, %eaxje end_conversion_loopjmp conversion_loop end_conversion_loop:movl ST_BUFFER(%ebp), %edxcopy_reversing_loop:popl %eaxmovb %al, (%edx..