Compare commits
4 commits
10d41fd6b3
...
e480dd3bcd
Author | SHA1 | Date | |
---|---|---|---|
e480dd3bcd | |||
10b1d62301 | |||
8800a012ea | |||
805d3dbbff |
5 changed files with 1400 additions and 1 deletions
|
@ -50,7 +50,7 @@ própria, sob os termos da licença [[https://bolha.dev/blau_araujo/pbn/src/bran
|
||||||
|
|
||||||
| Data | Tópico |
|
| Data | Tópico |
|
||||||
|-------+--------------------------------------------|
|
|-------+--------------------------------------------|
|
||||||
| 30/06 | 0. Sobre o curso |
|
| 30/06 | 0. [[curso/aula-00.org][Introdução à linguagem Assembly (NASM)]] |
|
||||||
| 02/07 | 1. [[curso/aula-01.org][Arquitetura de computadores]] |
|
| 02/07 | 1. [[curso/aula-01.org][Arquitetura de computadores]] |
|
||||||
| 04/07 | 2. [[curso/aula-02.org][Linguagens de montagem e a compilação]] |
|
| 04/07 | 2. [[curso/aula-02.org][Linguagens de montagem e a compilação]] |
|
||||||
| 07/07 | 3. [[curso/aula-03.org][O formato binário ELF64]] |
|
| 07/07 | 3. [[curso/aula-03.org][O formato binário ELF64]] |
|
||||||
|
|
1352
curso/aula-00.org
Normal file
1352
curso/aula-00.org
Normal file
File diff suppressed because it is too large
Load diff
24
curso/exemplos/00/salve-att.s
Normal file
24
curso/exemplos/00/salve-att.s
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# salve-att.s
|
||||||
|
# Montar com: as salve-att.s -o salve-att.o
|
||||||
|
# Linkar com: ld salve-att.o -o salve-att
|
||||||
|
|
||||||
|
.section .data
|
||||||
|
msg:
|
||||||
|
.ascii "Salve, simpatia!\n"
|
||||||
|
len = . - msg
|
||||||
|
|
||||||
|
.section .text
|
||||||
|
.global _start
|
||||||
|
|
||||||
|
_start:
|
||||||
|
# write(1, msg, len)
|
||||||
|
mov $1, %rax # syscall: write
|
||||||
|
mov $1, %rdi # stdout
|
||||||
|
lea msg(%rip), %rsi # endereço da mensagem
|
||||||
|
mov $len, %rdx # tamanho da mensagem
|
||||||
|
syscall
|
||||||
|
|
||||||
|
# exit(0)
|
||||||
|
mov $60, %rax # syscall: exit
|
||||||
|
xor %rdi, %rdi # status 0
|
||||||
|
syscall
|
23
curso/exemplos/00/salve-intel.asm
Normal file
23
curso/exemplos/00/salve-intel.asm
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
; salve-intel.asm
|
||||||
|
; Montar com: nasm -f elf64 salve-intel.asm
|
||||||
|
; Linkar com: ld salve-intel.o -o salve-intel
|
||||||
|
|
||||||
|
section .data
|
||||||
|
msg db "Salve, simpatia!", 10 ; 10 = '\n'
|
||||||
|
len equ $ - msg
|
||||||
|
|
||||||
|
section .text
|
||||||
|
global _start
|
||||||
|
|
||||||
|
_start:
|
||||||
|
; write(1, msg, len)
|
||||||
|
mov rax, 1 ; syscall número 1: write
|
||||||
|
mov rdi, 1 ; stdout
|
||||||
|
mov rsi, msg ; endereço da mensagem
|
||||||
|
mov rdx, len ; tamanho da mensagem
|
||||||
|
syscall
|
||||||
|
|
||||||
|
; exit(0)
|
||||||
|
mov rax, 60 ; syscall número 60: exit
|
||||||
|
xor rdi, rdi ; status 0
|
||||||
|
syscall
|
BIN
docs/nasmdoc-2.16.02.pdf
Normal file
BIN
docs/nasmdoc-2.16.02.pdf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue