الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برنامج Text Editor

مغلق
بدأه سارة_ي في 17 مايو 2006 · 14 رد · 1,065 مشاهدة · في لغة Assembly لأنظمة 16, 32, 64 بت
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

ياليت اللي يعرف الكود لهذا البرنامج يساعدني لو سمحتووووو

write 8086 assembly program to implement a text editor with features like loading, saving files, printing and help, dealing with dos and bios interrupt :wacko:

ساعدوني ضروري ضروري.. و الملف المرفق ما قمت بعمله لكن لوجود مشاكل و انا ضعيفة جدا في الأسمبلي

و حاولت اضيفه لكن فشلت المحاولة :o

ساعدوني يا خبراء الأسمبلي

#2

نحن ما زلنا بانتظار ان تقومي بارفاق ما قمتي بكتابته, ان لم ينجح ارفاق الملف يمكن ان تقومي بوضع الكود فقط مع محاولة الاحتفاظ بالتنسيق بشكل واضح ما امكن.

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#3

عفوا حاولت اكثر من مرة لكن هذا جزء مما لدي

و الرجاء المساعدة ضروري جدا ضروري كيفية عمل الكود كامل

.model small
.stack 256
.data  
.code
org 100h

start:
jmp main

file1  db "my.txt", 0
m  db "an error", 0
filehandle dw ?
outbufferpar label byte 
maxlen  db 27 
actlen  db ?
outbuffer db 27 dup (?)

main proc near
;////// CREATE FILE
mov ah, 3Ch  
mov cx, 0  
lea dx, file1 
int 21h 
jc error 
mov filehandle, ax 

; ////////RECIEVE INPUTS
mov ah, 0Ah 
lea dx, outbufferpar
int 21h 

; //////WRITE FILE
mov ah, 40h  
mov bx, filehandle 
mov cl, maxlen 
lea dx, outbuffer 
int 21h  

; ////////CLOSE FILE
close_file:
mov ah, 3Eh
mov bx, filehandle
int 21h 
ret

; //////ERROR
error:
mov ah, 40h 
mov bx, 1 
mov cx, 17 
lea dx, m 
int 21h 
ret 
main endp
#4

ضروري ساعدوني من له خبرة ببرامج الأسمبلي

أنا ضعيفة جدا بالاسمبلي و بحاجة لخبرتكم

هل من منجد ؟؟؟؟؟؟

#5

راجعي الرابط: /index.php?showtopic=81250

ثم http://www.ctyme.com/intr/int.htm

من اجل بقية المقاطعات الخاصة بالطباعة وما الى هذا.. رغم اني لم اتعامل معها من قبل لذا لا ادري ان كان هناك مشاكل معينة قد تظهر.

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#6

مشكورين لكن المشكلة انني اريد أن اتعامل مع شاشة الدوس كانها محرر نصوص و اقوم بفتح، اغلاق والتعديل على النص الموجود فيها و كذلك طباعته

رجاءً الأمر هام جدا و ضروري أرجو المساعدة

#7

لنرى كم من مرة سيتم تحميل المرفق!

اقتباس

TED 1.0 © 1988 Ziff Communications Co

PC Magazine © Tom Kihlken

TEDASM.ZIP

قطرة الماء تـثـقب الحجر.. لا بالعنف. لكن بتكرار المحاولة

at4re.gif

منتديات الفريق العربي للهندسة العكسية 不喜欢的勿入! www.at4re.com

#8

مشكور ... لكن برنامج أبسط من هيك ، الأساس فقط

#9

البرنامج عندك

و السورس واضح

يمكن التعديل عليه حسب الحاجة

ام المراد برنامج 100% حسب المواصفات!

قطرة الماء تـثـقب الحجر.. لا بالعنف. لكن بتكرار المحاولة

at4re.gif

منتديات الفريق العربي للهندسة العكسية 不喜欢的勿入! www.at4re.com

#10

مشكورة لكن التعديل يحتاج الى خبير أسمبلي و انا ضعيفة جدا

عند تنفيذ هذا الكود يعطي خطأ out of range

و مكان حدوث الخطأ je file_not_found

jc open_err

jc read_err

ساعدوني أرجوكم

.model  Large
.code
	   org	 100h
start:
	   jmp	 main

; this program uses FCB techniques - explaination later on :P
name_skelton	label		  byte
max_len   db   100   ; avoids buffer overflow & arbitrary code execute - Qnix;)
act_len   dw	?
file_name db	50 dup (?)
new_name_skel   label			  byte
new_max_len   db	55
new_act_len   dw	?
new_file_name db	50 dup (?)

ext	 db	  '.txt', 0
ask	 db	  '(1) rename (2) delete & create (3) read & display', 13, 10, '$'
handle  dw	  ?
in_buff db	  250 dup (?)
file_buffer	 label		  byte
			   maxl   db	255
			   actl   dw	?
			   o_buff	db	250 dup (?)
op_err  db	  'Error openning file', 0
re_err  db	  'Error reading file', 0
ren_err db	  'Error renaming file', 0
de_err  db	  'Error deleting file', 0
cr_err  db	  'Error creating file', 0
wr_err  db	  'Error writing file', 0
cl_err  db	  'Error closing file', 0

main	proc	near
	   call	get_file			 ; calls sub-routine get_file
	   call	loc_file			 ; calls sub-routine loc_file
	   call	take_action		  ; calls sub-routine take_action
	   ret
main	endp

get_file	proc	near
; waits the user to enter the file name and stores it in file_name
	   mov	 ah, 0Ah
	   lea	 dx, name_skelton
	   int	 21h

; now because the file name needs extension we append the ext here
; using the act_len and principle of OFFSET
	   mov	 ax, act_len		  ; al holds the length of entered name
	   lea	 bx, file_name		; loads addr of 'file_name' block in bx
	   add	 bx, ax			   ; locates the end of the entered name
	   mov si, word ptr [ext]   ; moves two bytes from 'ext' to si 
	   mov	 [bx], si			 ; appends 1st two bytes '.t'
	   mov	 si, word ptr [ext]+2 ; moves last bytes from 'ext' to si
	   mov	 [bx]+2, si		   ; appends last two bytes 'xt'

; by the end of this procedure we have 'file_name.txt' stored in memory :)
	   ret						  ; return to main proc
get_file	endp

loc_file	proc	near
; search for the file in current directory
	   mov	 ah, 4Eh
	   mov	 cx, 0
	   lea	 dx, file_name
	   int	 21h
	   jc	  nFound
	   mov	 ax, 0
	   ret
nFound:
	   mov	 ax, 1
	   ret

; by the end of this proc we have either 0 or 1 in ax to determine the results
loc_file	endp

take_action proc	near
; option explicit :]]
	   cmp	 ax, 1
	   je	  file_not_found
file_found:
	   mov	 ah, 09h			  ; service 09 (display characters)
	   lea	 dx, ask
	   int	 21

	   mov	 ah, 0				; service 00 (read a character)
	   int	 16h				  ; execute 16h interrupt
	   cmp	 al, 31h
	   je	  rename
	   cmp	 al, 32h
	   je	  delete
open:
	   mov	 ax, 3D00h			; service 3D (open file for read-only)
	   lea	 dx, file_name
	   int	 21h
	   jc	  open_err
	   mov	 handle, ax
read:
	   mov	 ah, 3Fh
	   mov	 bx, handle
	   mov	 cx, 250
	   lea	 dx, o_buff
	   int	 21h
	   jc	  read_err
display:
	   mov	 ah, 09h
	   lea	 dx, o_buff
	   int	 21h

	   jmp	 close
rename:
	   mov	 ah, 0Ah
	   lea	 dx, new_name_skel
	   int	 21h
	   mov	 ax, new_act_len
	   lea	 bx, new_file_name
	   add	 bx, ax
	   mov si, word ptr [ext]
	   mov	 [bx], si
	   mov	 si, word ptr [ext]+2
	   mov	 [bx]+2, si

	   mov	 ah, 56h
	   lea	 dx, file_name
	   lea	 di, new_file_name
	   int	 21h
	   jc	  rename_err

	   jmp	 exit
delete:
	   mov	 ah, 41h
	   lea	 dx, file_name
	   int	 21h
	   jc	  delete_err

create:
	   mov	 ah, 3Ch
	   mov	 cx, 0
	   lea	 dx, file_name
	   int	 21h
	   jc	  create_err
	   mov	 handle, ax

recieve:
	   mov	 ah, 0Ah
	   lea	 dx, in_buff
	   int	 21

write:
	   mov	 ah, 40h
	   mov	 bx, handle
	   mov	 cx, actl
	   lea	 dx, o_buff
	   int	 21h
	   jc	  write_err

close:
	   mov	 ah, 3Eh
	   mov	 bx, handle
	   int	 21h
	   jc	  close_err

	   jmp	 exit

open_err:
	   mov	 ah, 09h
	   lea	 dx, op_err
	   int	 21h

	   jmp	 exit
read_err:
	   mov	 ah, 09h
	   lea	 dx, re_err
	   int	 21h

	   jmp	 exit
rename_err:
	   mov	 ah, 09h
	   lea	 dx, ren_err
	   int	 21h

	   jmp	 exit
delete_err:
	   mov	 ah, 09h
	   lea	 dx, de_err
	   int	 21h

	   jmp	 exit
create_err:
	   mov	 ah, 09h
	   lea	 dx, cr_err
	   int	 21h

	   jmp	 exit
write_err:
	   mov	 ah, 09h
	   lea	 dx, wr_err
	   int	 21h

	   jmp	 exit
close_err:
	   mov	 ah, 09h
	   lea	 dx, cl_err
	   int	 21h

	   jmp	 exit
file_not_found:
	   jmp	 create
exit:
	   ret

take_action endp

end	 start

تم تعديل هذه المشاركة بواسطة Xacker في 29 مايو 2006 في 11:20

#11

خبراء الاسمبلي .... ما في حد بدو يساعد

مشكورين

#12

مثلا عند:

open:
	   mov	 ax, 3D00h		   ; service 3D (open file for read-only)
	   lea	 dx, file_name
	   int	 21h
	   jc	  open_err
	   mov	 handle, ax

اجر التعديل التالي:

open:
	   mov	 ax, 3D00h		   ; service 3D (open file for read-only)
	   lea	 dx, file_name
	   int	 21h
	   jnc	  @F
	   call	 _create
@@:
	   mov	 handle, ax

واضيفي اجرائية مستقلة ضعي فيها الكود الخاص بـ create وهو:

create:
	   call	_create

والاجرائية تكون:

_create	proc	near

	mov	 ah, 3Ch
	   mov	 cx, 0
	   lea	 dx, file_name
	   int	 21h
	   jc	  create_err
	   mov	 handle, ax
	ret
create_err:
	   mov	 ah, 09h
	   lea	 dx, cr_err
	   int	 21h
	   ret

_create endp

لا تنسى ان تقومي بانهاء البرنامج عند exit: بمقاطعة انهاء البرنامج وليس بـ ret فقد تتسبب باخطاء.

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#13

شكرا يا أخي لكن كيف ممكن افتح ملف جديد على شاشة الدوس ، عند كتابة اسم ملف تنفيذي يعطي خطأ

#14

لربما لانك لست على نفس المسار؟

جربي السحب والالقاء للملف التنفيذي في شاشة الدوس وسيتم وضع مساره اوتوماتيكيا, عندها انقري انتر.

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#15

شكرا لك من ساعدني بهذا المشروع و كانت النتائج جيدة جدا

مشكورررررررررررررررررررررررررررررررررررين

;)

هذا الموضوع مغلق.

مواضيع مشابهة