064-Assembly彙編01

 

 

Assembly

 

 

0.template

we have a file named template.asm

this is a template file for assembly

check it out

section .data
section .text

	global _start

_start:
	nop
	; start code here
	
	; end code here

Exit:	mov eax,1
        mov ebx,0
        int 80H
	nop

section .bss

 

 

1.adding two numbers

the code is

	mov rax, 3
	mov rbx, 4
	add rax, rbx

so the complete code is

section .data
section .text

	global _start

_start:
	nop
	; start code here
	mov rax, 3
	mov rbx, 4
	add rax, rbx
	; end code here

Exit:	mov eax,1
        mov ebx,0
        int 80H
	nop

section .bss

 

 

 

 

 

2.add three numbers

section .data
section .text

	global _start

_start:
	nop
	; start code here
	mov rax, 3
	mov rbx, 4
	mov rcx, 5
	add rax, rbx
	add rax, rcx
	; end code here

Exit:	mov eax,1
        mov ebx,0
        int 80H
	nop

section .bss

 

 

 

 

3.multiplying two numbers

section .data
section .text

	global _start

_start:
	nop
	; start code here
	mov eax, 3
	mov ebx, 4
 	mul ebx
	; end code here

Exit:	mov eax,1
        mov ebx,0
        int 80H
	nop

section .bss

 

 

 

 

4.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章