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

مثال لكيفية إنشاء العديد من المجلدات بالأسمبلي 16 بت

بدأه The Hidden Ghost في 19 سبتمبر 2014 · 0 رد · 1,432 مشاهدة · في لغة Assembly لأنظمة 16, 32, 64 بت
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكم ورحمة الله تعالى وبركاته.

إليكم مثالا واضحا لكيفية إنشاء العديد من المجلدات بالاعتماد على المقاطعة 21، أتمنى أن يكون الكود مفهوما.

;Hello guys :)
;I have created a little application with assembly language 16-bit, in order to enter 
;to the Assembly language's door, So it just an application that creates a lot of folders 
;using the path you put it . :P Let's see the code:


;***********************************************************************************
; This is a simple program in Assembly language which create a lot of folders.     *
;It is just for learning purposes, I want always to create an application in such  *
;language in order to jump this massive hurdle, well, I think a have just do it    *
;the job, there's no matter to be in the last part of the Stack, because it has    *
;a concept named LIFO( Last In First Out ), So you must be serious and happy :)    *  
;                                                                                  *
;                                                      Coded by: The Hidden Ghost  *
;***********************************************************************************

org 100h						        ;It's a COM 

mov ax,0013h                                                ;Set Video Mode 
int 10h                                                     ;Bios interrupt
mov al,03h                                                   ;Set Text Mode
int 10h							    ;Bios interrupt
mov ax,09000				;Print a string on Screen [ah = 09h]
mov dx,offset szBuff 	    	       		;Print that string [szBuff]
int 21h								;DOS interrupt 
mov ax,0A00h						;Input a string here please 
mov dx,offset szBuffIn				;Store the string or the folder path into [szBuffIn]
int 21h								;DOS interrupt
xor bx,bx							;BX = 0
mov bl,byte ptr szBuffIn[1]			;strlen(szBuffIn)
push bx								;Save the length
mov byte ptr szBuffIn[bx + 02h],00h ;Jump the extra 2 bytes and put the zero terminated
mov al,bl							;Store the length in al register
xor bx,bx							;BX = 0
add bl,02h							;We want start from szBuffIn[2]
xor cx,cx							;CX = 00h
mov cl,al							;Make a loop like that: for(;length>=0;length--)
copy_str:
mov dl,byte ptr szBuffIn[bx]		;We copy szBuffIn[bl++] in dl, by the way [bl] equal 02h until now
mov byte ptr szBuffSwf[bx],dl		;szBuffSwf[bl++] = dl
inc bl								;Increase bl by one [bl = bl + 01h] 
loop copy_str						;While(cx-- != 0) 
mov byte ptr szBuffSwf[bx],'$'		;Put the '$' in the end of the string
mov ax,0900h						;Print a string on Screen [ah = 09h]
lea dx,szNewl						;New line
int 21h								;DOS interrupt     
lea dx,szNewl						;New line
int 21h								;DOS interrupt  
mov cx,0FFh							;We will create 255 folder [CX = 255]:)
pop bx								;Restore the valute of BX which is the length of the string that we put it previously
mov si,bx							;SI = the length
mov bl,21h; '!'						;We must add a character in the end of the folder name in order to ignore the existence of the created one
create_folder: 
mov byte ptr szBuffIn[si+02h],bl	;Add the character stored in [bl] in the end
mov byte ptr szBuffIn[si+03h],00h	;Zero terminated  
mov ax,3900h						;Function to create a folder
lea dx,szBuffIn + 02h				;Folder name
int 21h            					;DOS interrupt
mov ah,09h						    ;Print a string on Screen [ah = 09h]
lea dx,szBuffShw					;Print that string [szBuffShw]
int 21h								;DOS interrupt   
mov byte ptr szBuffIn[si+03h],'$'   ;Put the '$' in the end of the string 
mov dx,offset szBuffIn[02h]			;The Folder name
int 21h								;DOS interrupt  
lea dx,szNewl						;New line makes me happy :)
int 21h								;DOS interrupt							
inc bl								;Increase [bl] by one, so it will add another character to the folder name
loop create_folder					;While(cx-- != 0)
xor ah,ah							;AH = 00h
add ah,01h							;Pause screen
int 21h								;DOS interrupt
xor ax,ax							;AX = 00h
int 10h        						;Return to text mode
ret									;Return to Operating System  

szBuffSwf db 100 dup(' ')           ;char szBuffSwf[100]
szNewl    db 0Ah,0Dh,"$"			;("\n\r")
szBuff    db "Enter your Folder's name here #> ","$" 
szBuffShw db "Creating folder: ","$"
szBuffOut db "XXXXXXXXXXXX",0Ah,0Dh,"$"
szBuffIn  db 100 dup(' ')			;char szBuffIn[100]

إلى اللقاء :)

 

fcreator.zip

تم تعديل هذه المشاركة بواسطة Hamza+C+ASM في 19 سبتمبر 2014 في 20:46

1
rS3eY.png

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…