Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Didattica in generale > Archivio > Progetto della sicurezza di rete > NASM come compilare
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
quakkaro
.arcimaestro.

User info:
Registered: Mar 2005
Posts: 363 (0.05 al dì)
Location: Città
Corso: Corso di Studi
Anno: Anno di Corso
Time Online: 1 Day, 22:48:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[risolto] NASM come compilare

come fate a compilare?
sto provando a compilare il file math.asm



;
; file: math.asm
; This program demonstrates how the integer multiplication and division
; instructions work.
;
; To create executable:
; nasm -f coff math.asm
; gcc -o math math.o driver.c asm_io.o

%include "asm_io.inc"

segment .data
;
; Output strings
;
prompt db "Enter a number: ", 0
square_msg db "Square of input is ", 0
cube_msg db "Cube of input is ", 0
cube25_msg db "Cube of input times 25 is ", 0
quot_msg db "Quotient of cube/100 is ", 0
rem_msg db "Remainder of cube/100 is ", 0
neg_msg db "The negation of the remainder is ", 0

segment .bss
input resd 1


segment .text
global asm_main
asm_main:
enter 0,0 ; setup routine
pusha

mov eax, prompt
call print_string

call read_int
mov [input], eax

imul eax ; edx:eax = eax * eax
mov ebx, eax ; save answer in ebx
mov eax, square_msg
call print_string
mov eax, ebx
call print_int
call print_nl

mov ebx, eax
imul ebx, [input] ; ebx *= [input]
mov eax, cube_msg
call print_string
mov eax, ebx
call print_int
call print_nl

imul ecx, ebx, 25 ; ecx = ebx*25
mov eax, cube25_msg
call print_string
mov eax, ecx
call print_int
call print_nl

mov eax, ebx
cdq ; initialize edx by sign extension
mov ecx, 100 ; can't divide by immediate value
idiv ecx ; edx:eax / ecx
mov ecx, eax ; save quotient into ecx
mov eax, quot_msg
call print_string
mov eax, ecx
call print_int
call print_nl
mov eax, rem_msg
call print_string
mov eax, edx
call print_int
call print_nl

neg edx ; negate the remainder
mov eax, neg_msg
call print_string
mov eax, edx
call print_int
call print_nl

popa
mov eax, 0 ; return back to C
leave
ret


stado su linux uso:
nasm -f elf math.asm [ok]
e poi:
gcc -o math math.o driver.c asm_io.o
ERROR:
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status


beh.. ottimo direi...

dagli appunti ho provato anche:
nasm -f elf math.asm [ok]
gcc -c driver.c [ok...compilato anche il driver in c]
gcc -o first driver.o asm_io.o [error]

stesso errore...
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status


ce qualcuno che mi passerebbe il lavoro svolto lunedi 6-11 e come compilarlo?
grazie in anticipo anche a chi legge questo post e nn ha capito una sega di quello che ce scritto come me...




EDIT:
risolto....
nn avevo le libc6-dev....
valgo 0.

__________________
--------railed------->

Last edited by quakkaro on 07-11-2006 at 22:05

07-11-2006 21:07
Click Here to See the Profile for quakkaro Click here to Send quakkaro a Private Message Visit quakkaro's homepage! Find more posts by quakkaro Add quakkaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
quakkaro
.arcimaestro.

User info:
Registered: Mar 2005
Posts: 363 (0.05 al dì)
Location: Città
Corso: Corso di Studi
Anno: Anno di Corso
Time Online: 1 Day, 22:48:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

p.s.
notate che è passata un' ora per sistemare sta cazzata..
...immaginatemi con l assembly come procederà......

__________________
--------railed------->

07-11-2006 22:07
Click Here to See the Profile for quakkaro Click here to Send quakkaro a Private Message Visit quakkaro's homepage! Find more posts by quakkaro Add quakkaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
IuZ
.grande:maestro.

User info:
Registered: Mar 2004
Posts: 816 (0.11 al dì)
Location:
Corso: T.I.Co.
Anno: Primo
Time Online: 8 Days, 7:26:48 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Quindi i comandi che hai messo prima dovrebbero andare?

PS: te li metto sticky.

__________________
Links a risorse (How-To, libri, manuali, siti) su Linux? -> Qui! ( .dsy:it. LUG ) <-
Scouting Site: -> no6.org <-
Prima di postare, fate una SEARCH ... Link in alto a destra, non è difficile! :P
Abbiamo il dovere di voler essere ciò che siamo.

08-11-2006 16:10
Click Here to See the Profile for IuZ Click here to Send IuZ a Private Message Find more posts by IuZ Add IuZ to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
quakkaro
.arcimaestro.

User info:
Registered: Mar 2005
Posts: 363 (0.05 al dì)
Location: Città
Corso: Corso di Studi
Anno: Anno di Corso
Time Online: 1 Day, 22:48:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

secondo me è meglio mettere in sticky solo l altro post che ha tutto.

__________________
--------railed------->

10-11-2006 10:42
Click Here to See the Profile for quakkaro Click here to Send quakkaro a Private Message Visit quakkaro's homepage! Find more posts by quakkaro Add quakkaro to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
IuZ
.grande:maestro.

User info:
Registered: Mar 2004
Posts: 816 (0.11 al dì)
Location:
Corso: T.I.Co.
Anno: Primo
Time Online: 8 Days, 7:26:48 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Fatto. ;)

__________________
Links a risorse (How-To, libri, manuali, siti) su Linux? -> Qui! ( .dsy:it. LUG ) <-
Scouting Site: -> no6.org <-
Prima di postare, fate una SEARCH ... Link in alto a destra, non è difficile! :P
Abbiamo il dovere di voler essere ciò che siamo.

10-11-2006 13:15
Click Here to See the Profile for IuZ Click here to Send IuZ a Private Message Find more posts by IuZ Add IuZ to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 00:56.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.034 seconds (77.55% PHP - 22.45% MySQL) con 27 query.