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

كيف ننشء بروسيجر؟؟

بدأه المارد01 في 14 أبريل 2008 · 8 رد · 3,412 مشاهدة · في أرشيف قسم الـــ Assembly
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

#2

قبل ما تتمنى توضيح اوضح انت عما تسال! "بروسيجر"

والسلام علكيم

d4baa0.gif
#3

أعتقد انه يسأل عن الـProcedure أو الـfunctions أخي delta , تعرف اختلاف اللغات :D

.386
.model flat,stdcall
option casemap:none

include		windows.inc
include		kernel32.inc
include		user32.inc
includelib	kernel32.lib
includelib	user32.lib

.data
Msg		db	"Nothing improtant !",0
_Title	db	"MessageBox Title",0

;declare Procedure1
;Function_Name	proto	Parameter No.1(optional):type, Parameter No.1(optional):type, ... and so on
Procedure1	proto	Param1:dword, Param2:dword

.code
start:
;call using the MASM 'invoke' word witch pushes the parameters in stack and call the function for you.
;you must declare the function prototypes "if" it exists after the call line !
	invoke Procedure1,55,66h
	ret;end program
;--------------------------------------------------

Procedure1	proc	Param1:dword, Param2:dword
	invoke MessageBox, 0, addr Msg, addr _Title, MB_OK

;fill registers with parameters
	mov esi, Param1
	mov edi, Param2

; call using the standard ASM method : pushing parameters to stack then call the function.
; no need to declare the called function !
	push 5
	call Procedure2
; esi, edi and ebx haven't changed despite of using them in 'Procedure2' because of the word 'using esi edi ebx'
	ret
Procedure1 endp
;--------------------------------------------------

Procedure2	proc	uses esi edi ebx param1:dword
;local name:type
;it's the same as local variables in C/C++ which remains in the procedure stack frame
	LOCAL int1:dword
	LOCAL int2:dword

; change registers that will be saved and restored after executing the function
	xor esi, esi
	add edi, 5
	and ebx, 7fffffffh
	invoke MessageBox, 0, addr Msg, addr _Title, MB_OK
	ret
Procedure2 endp
;--------------------------------------------------

end start

الكود مدعم بالتعليقات , اذا اردت تفصيل عن شئ محدد أكثر فلا تتردد بالسؤال .

المشروع(RadAsm) في المرفقات

Procedure.rar

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#4

انا مبتدىء بالاسمبلي وبستخدم ايميوليتر8086 لكتابة اكواد الاسمبلي بس مش عارف اعمل بروسيجر واستدعيه يعني على سبيل المثال بروسيجر يقرا بالديسمال او البناري او سترنق مثلا...

#5
اقتباس
ايميوليتر8086
اقتباس
بروسيجر
اقتباس
بالديسمال
اقتباس
البناري
اقتباس
او سترنق

أكتب المصطلحات باللغة الانجليزية أو الترجمة المناسبة لها بالعربية , ألم تقرأ الرد رقم (2) !!!!!!!!؟؟؟؟؟؟؟؟؟

كما اني لم أفهم ما تريد .

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#6

لعله يقصد function

myFunction:
ANY code here
call myFunction
rasool4k.gif

[وسط]mimetex.cgi?MSN:root@root-shell.net.

[/وسط]

#7

وما الفرق ؟؟؟؟؟

Function == Procedure

كلاهما يندرج تحت مسمى الـSubroutine ويمكن تنفيذهم كما في أول مشاركة لي .

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#8

ظننت أن الـProcedure مثل الـThread :S

لم أقرا الكود :!

rasool4k.gif

[وسط]mimetex.cgi?MSN:root@root-shell.net.

[/وسط]

#9

تعريف برنامج فرعي ( الاجراء ) :

procedure_name PROC
; here your code
	RET
procedure_name ENDP

استدعاء الاجراء :

CALL procedure_name

تم تعديل هذه المشاركة بواسطة MEGinCCSI في 20 أبريل 2008 في 03:23

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