2023-09-15 11:40:57 +00:00
|
|
|
BITS 64
|
|
|
|
SECTION .text
|
|
|
|
global main
|
|
|
|
|
2023-09-15 11:55:12 +00:00
|
|
|
; all the different ways to set registers to 0.
|
|
|
|
|
2023-09-15 11:40:57 +00:00
|
|
|
main:
|
2023-09-15 11:55:12 +00:00
|
|
|
xor eax, eax ; xor with itself
|
|
|
|
lea rbx, [0] ; load effective address into rbx
|
2023-09-15 11:40:57 +00:00
|
|
|
; ecx usually starts with a high value, loop decrements this
|
|
|
|
; so this makes it all a bit faster
|
|
|
|
mov ecx, 10
|
2023-09-15 11:55:12 +00:00
|
|
|
loop $ ; loop until ecx hits 0. `$` is this instruction.
|
|
|
|
mov rdx, 0 ; move 0 into rdx
|
|
|
|
and esi, 0 ; bitwise-and esi with 0
|
|
|
|
sub edi, edi ; substract from itself
|
|
|
|
push 0 ; put 0 on the stack
|
|
|
|
pop rbp ; pop stack into rbp
|