Please perform the following steps exactly as you see them:
- 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]
- 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
- 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
- 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]
- 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
- Next, type the following:
; loop example
loopstarter:
mov rcx,0x9
xor rax,rax
looper:
inc rax
loop looper
- 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.