Copy a string: Difference between revisions

Content added Content deleted
Line 2,325: Line 2,325:
jne _getsize ;; nope, jump back and check again
jne _getsize ;; nope, jump back and check again


mov tb, ecx ;; tb = Total bytes
mov tb, ecx ;; tb = Total bytes, Keep a copy of the size of the string
lea rsi, s ;; Copy the address of s into the source index(rsi)
lea rsi, s ;; Copy the address of s into the source index(rsi)
lea rdi, d ;; Copy the address of d into the destination index(rdi)
lea rdi, d ;; Copy the address of d into the destination index(rdi)
Line 2,333: Line 2,333:
mov dp, rax ;; Copy it from RAX to dp
mov dp, rax ;; Copy it from RAX to dp
mov rbx,rdi ;;preserve registers, cause over writes due to ABI calls T_T
mov rbx,rdi ;; Make a copy of RDI, cause over writes due to ABI call args T_T
invoke printf, CSTR("-> s (0x%x) = %s",10), rsi, addr s
invoke printf, CSTR("-> s (0x%x) = %s",10), rsi, addr s
invoke printf, CSTR("-> d (0x%x) = %s",10), rbx, addr d
invoke printf, CSTR("-> d (0x%x) = %s",10), rbx, addr d