Erinevus lehekülje "Assembler" redaktsioonide vahel

Allikas: Kuutõrvaja
(Hello World)
(Hello World)
40. rida: 40. rida:
 
         int 80h        ; execute the syscall
 
         int 80h        ; execute the syscall
 
</source>
 
</source>
 +
 +
== Kompileerimine ==
 +
 +
Linuxile on selline programm nagu '''nasm'''.
 +
 +
  nasm -f elf <programm.asm>
 +
 +
Käsu kävivitamisel genereetitakse meile fail nimega ''programm.o'''.
 +
 +
  ld -o programm programm.o
 +
 +
Käsu kävitamisel genereeritakse meile käivitatav programm nimega '''programm'''.
  
 
= Lingid =
 
= Lingid =

Redaktsioon: 20. juuni 2011, kell 12:33

TODO

Näited

???

assembler; label l1, l2;

asm
 mov dx,3DAh
 l1:
  in al, dx
  and al,08h
  jnz l1
 l2:
  in al,dx
  and al,08h
  jz l2

Hello World

global _start
  
section .data
        hello   db      "Hello, World!", 10
        length  equ     $-hello
  
section .text
  
_start:
        mov eax, 4      ; write to file
        mov ebx, 1      ; STDOUT handle
        mov ecx, hello  ; our message
        mov edx, length ; size of message
        int 80h         ; execute the syscall
 
        xor ebx, ebx    ; send 0 as 'exit code'
        mov eax, 1      ; terminate process
        int 80h         ; execute the syscall

Kompileerimine

Linuxile on selline programm nagu nasm.

 nasm -f elf <programm.asm>

Käsu kävivitamisel genereetitakse meile fail nimega programm.o'.

 ld -o programm programm.o

Käsu kävitamisel genereeritakse meile käivitatav programm nimega programm.

Lingid

http://www.csn.ul.ie/~darkstar/assembler/

http://www.csn.ul.ie/~darkstar/assembler/intlist.html