Arquitetura de Computadores

Processadores

MOS 6502

Intel 8008

Intel 80386

Intel Core

Computadores

Commodore C64 (6502)

Amiga 500 (68000)

PC XT (8088)

MSX

Arquitetura

North Bridge & South Bridge

ISA BUS


Chips

8 bit RAM chip

27c512 EPROM

ATMega328p Datasheet

ATMega328p Instruction set

Primeiro código ASM


start:

MOV A, 10

CALL .loop

HLT


.loop:

DEC A

CMP A, 0

JNZ .loop

RET


ASM Hello World (Bios)


; Prints "hello world" to the screen.

;

; Build with:

; nasm -f macho hello.asm

; ld -o hello hello.o

;

; Run with:

; ./hello

;

; Author: PotatoMaster101


SECTION .data ; initialised data section


Msg: db "hello world", 10 ; message to print

MsgLen: equ $ - Msg ; length of message



SECTION .text ; code section


global start

start:


; printing message, use write()

; system call 4 syntax:

; user_ssize_t write(int fd, user_addr_t cbuf, user_size_t nbyte)

push dword MsgLen ; length of message to print

push dword Msg ; message to print

push dword 1 ; FD of 1 for standard output

sub esp, 4 ; OS/X requires extra 4 bytes after arguments

mov eax, 4 ; 4 - write() system call

int 80H ; perform system call

add esp, 16 ; restore stack (16 bytes pushed: 3 * dword + 4)


; program exit, use sys_exit()

push dword 0 ; exit value of 0 returned to the OS

sub esp, 4 ; OS/X requires extra 4 bytes after arguments

mov eax, 1 ; 1 - sys_exit() system call

int 80H ; perform system call

; no need to restore stack, code after this line will not be executed

; (program exit)