How to do it...

Please perform the following steps exactly as you see them:

  1. In your text editor, type the following:
; ch03-ia64-practice
; by <insert your name here>
; Date - <insert the date here>

global _start

section .text

_start:
; MOV examples
mov rax,rbx
mov rcx,0x1122334455667788
mov dl,0x11
mov rax,[r8]
  1. Next, type the following and examine your work:
    ; LEA and XCHG examples
lea rax,[rcx+8]
xchg rdi,rsi

; PUSH and POP examples
push rdi
pop r12

; XOR, AND, OR examples
xor rax,rax
and rbl,al
or bx,bx
or cx,0xfff
  1. Type the following, paying close attention to the syntax:
; ADD examples
add ebx,eax
add bx,ax
add rax,rbx
add cl,0x2

; SUB examples
sub edx,ecx
sub dx,cx
sub rdx,rcx
sub cl,0x2

; MUL examples
mul rdi
mul bx
mul cl
mul 0x1122334455667788

; DIV examples
div bx
div ecx
div cl
  1. Type the following on a new line in the text editor:
    ; INC examples
inc eax
inc rdx
inc al
inc [ax]

; DEC examples
dec ebx
dec rbx
dec bl
dec [bx]
  1. Starting on a new line, type the following:
    ;jump example
jmp caller

; label/procedure examples
engager:
pop rcx
mov rax,[rip+8]

caller:
call engager
secret: db "This is a secret message!" ; this is NASM specific
  1. Next, type the following:
; loop example
loopstarter:
mov rcx,0x9
xor rax,rax
looper:
inc rax
loop looper
  1. When you're finished, feel free to close the text editor. It's not necessary to save this file since this recipe just demonstrates how to use some of the required instructions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.150.55