-
Notifications
You must be signed in to change notification settings - Fork 14
/
jump.asm
27 lines (16 loc) · 821 Bytes
/
jump.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
; This program shows how an unconditional jump works.
global asm_func
section .text
asm_func: ; this is our entry point
mov rax, 1024 ; set RAX to 1024
jmp a_place_to_jump ; Jump to label a_place_to_jump.
; try to comment this jmp line and see what happens.
this_is_not_executed: ; this has been skipped...
mov rax, 512 ; so RAX is not altered
another_jump: ; we will jump here later...
inc rax ; increment RAX
ret ; and exit the program.
a_place_to_jump: ; the first jump land us here...
add rax, rax ; we double RAX
jmp another_jump ; and now we jump to the
; label another_jump above