انجمنهای فارسی اوبونتو
کمک و پشتیبانی => برنامهسازی => نویسنده: heidari در 09 آذر 1387، 04:16 بظ
-
با سلام خدمت دوستان من می خواستم اگر دوستان امکانش رو دارند مرا در این زمینه راهنمایی کنند
من ابونتو ۸.۱۰ رو دارم نسم رو با سیناتیک رو سیستمم نصب کردم اما اصلا نمی دونم چطوری باهاش کار کنم اصلا نمی دونم کجاست یعنی باید از کجا بهش دسترسی داشته باشم برنامه هام رو چطوری باهاش کامپایل کنم لینک های اینگلیسی رو که تو سایت بود دیدم اما چیزی نفهمیدم ممنون می شم راهنماییم کنید
این درخواست رو تو تکنو تاکسس دادم ولی فعلا داره خاک می خوره :(
-
خط فرمان man nasm
-
روش کار خیلی سادست...
یه شل باز کن
برای اجرای nasm فرمان زیر رو تایپ کن
nasm
برای کامپایل یک برنامه
nasm -f elf test.asm
برای کامپایل و تغییر نام برنامه
nasm -f elf -o test.o test.asm
برای داشتن فایل لیست:
nasm -f elf -o test.o -l test.lst test.asm
و سرانجام برای لینک فایل آبجکت تولید شده با nasm
ld -o test test.o
برای اجرای برنامه هم:
test/.
-
از هر دو عزیز سپاسگزارم تقریبا مشکلم حل شد اگر دوباره مشکلی در زمینه اجرای نسم داشتم همینجا مطرح می کنم
درکل خیلی ممنونم
-
سلام من پاک دیوانه شدم. این فایل اسمبلی من هستش:
%include "io.mac"
.DATA
name_msg db 'Please enter your name: ',0
query_msg db 'How many times to repeat welcome message? ',0
confirm_msg1 db 'Repeat welcome message ',0
confirm_msg2 db ' times? (y/n) ',0
welcome_msg db 'Welcome to Assembly Language Programming ',0
.UDATA
user_name resb 16 ; buffer for user name
response resb 1
.CODE
.STARTUP
PutStr name_msg ; prompt user for his/her name
GetStr user_name,16 ; read name (max. 15 characters)
ask_count:
PutStr query_msg ; prompt for repeat count
GetInt CX ; read repeat count
PutStr confirm_msg1 ; confirm repeat count
PutInt CX ; by displaying its value
PutStr confirm_msg2
GetCh [response] ; read user response
cmp byte [response],'y' ; if 'y', display welcome message
jne ask_count ; otherwise, request repeat count
display_msg:
PutStr welcome_msg ; display welcome message
PutStr user_name ; display the user name
nwln
loop display_msg ; repeat count times
.EXIT
که io.mac که توی همون دایرکتوری هستش این جوریه:
extern proc_nwln, proc_PutCh, proc_PutStr
extern proc_GetStr, proc_GetCh
extern proc_PutInt, proc_GetInt
extern proc_PutLInt, proc_GetLInt
;;-------------------------------------------------------------------
%macro .STARTUP 0
;group dgroup .data .bss
global _start
_start:
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro .EXIT 0
mov EAX,1
xor EBX,EBX
int 0x80
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro .DATA 0
segment .data
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro .UDATA 0
segment .bss
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro .CODE 0
segment .data
segment .bss
segment .text
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro nwln 0
call proc_nwln
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro PutCh 1
push AX
mov AL,%1
call proc_PutCh
pop AX
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro PutStr 1
push ECX
mov ECX,%1
call proc_PutStr
pop ECX
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro GetStr 1-2 81
push ESI
push EDI
mov EDI,%1
mov ESI,%2
call proc_GetStr
pop EDI
pop ESI
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro GetCh 1
push SI
xor SI,SI
%ifidni %1,AL
;inc SI
call proc_GetCh
%elifidni %1,AH
mov SI,1
call proc_GetCh
%else
push AX
call proc_GetCh
mov %1,AL
pop AX
%endif
pop SI
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro PutInt 1
push AX
mov AX,%1
call proc_PutInt
pop AX
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro GetInt 1
%ifnidni %1,AX
push AX
call proc_GetInt
mov %1,AX
pop AX
%else
call proc_GetInt
%endif
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro PutLInt 1
push EAX
mov EAX,%1
call proc_PutLInt
pop EAX
%endmacro
;;-------------------------------------------------------------------
;;-------------------------------------------------------------------
%macro GetLInt 1
%ifnidni %1,EAX
push EAX
call proc_GetLInt
mov %1,EAX
pop EAX
%else
call proc_GetLInt
%endif
%endmacro
;;-------------------------------------------------------------------
حالا این کد ها رو زدم:
nasm -f elf example.asm
ld -o example example.o io.o
که میگه :
ld: io.o: No such file: No such file or directory
و دقیقا مشکل من همینه. نمیدونم چیکار کنم. از io.mac فایل io.o رو نمیسازه در حالی که nasm موقع کمپایل فایل io.mac رو میشناسه و include میکنه.
از این که کمکم میکنید ممنون