Skip to content

Instantly share code, notes, and snippets.

@0x61nas
Created February 6, 2024 09:06
Show Gist options
  • Save 0x61nas/4317d45a1e0ade153a24ce69f7dd9283 to your computer and use it in GitHub Desktop.
Save 0x61nas/4317d45a1e0ade153a24ce69f7dd9283 to your computer and use it in GitHub Desktop.
section .data
section .text
global .start
start:
; When you want to put the value 0 into a register, the fastest way is to use XOR.
; XORing a value againsnt it self yields 0.
xor rbx, rbx
; Yes, you could use `mov rbx, 0` instnad, but that has to go out to memory to load the immediate value 0
; XORing register against it self doesn't go out of the CPU for either the source or the destination, so its a little bit faster.
xor rcx, rcx
mov rax, 067feh
mov rbx, rax
mov cl, bh
mov ch, bl
xchg cl, ch
section .bass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment