• 0
The Hidden Ghost

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


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

إليكم مثالا واضحا لكيفية إنشاء العديد من المجلدات بالاعتماد على المقاطعة 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 interruptmov al,03h                                                   ;Set Text Modeint 10h							    ;Bios interruptmov 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 interruptxor bx,bx							;BX = 0mov bl,byte ptr szBuffIn[1]			;strlen(szBuffIn)push bx								;Save the lengthmov byte ptr szBuffIn[bx + 02h],00h ;Jump the extra 2 bytes and put the zero terminatedmov al,bl							;Store the length in al registerxor bx,bx							;BX = 0add bl,02h							;We want start from szBuffIn[2]xor cx,cx							;CX = 00hmov 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 nowmov byte ptr szBuffSwf[bx],dl		;szBuffSwf[bl++] = dlinc 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 stringmov ax,0900h						;Print a string on Screen [ah = 09h]lea dx,szNewl						;New lineint 21h								;DOS interrupt     lea dx,szNewl						;New lineint 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 previouslymov si,bx							;SI = the lengthmov bl,21h; '!'						;We must add a character in the end of the folder name in order to ignore the existence of the created onecreate_folder: mov byte ptr szBuffIn[si+02h],bl	;Add the character stored in [bl] in the endmov byte ptr szBuffIn[si+03h],00h	;Zero terminated  mov ax,3900h						;Function to create a folderlea dx,szBuffIn + 02h				;Folder nameint 21h            					;DOS interruptmov 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 nameint 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 nameloop create_folder					;While(cx-- != 0)xor ah,ah							;AH = 00hadd ah,01h							;Pause screenint 21h								;DOS interruptxor ax,ax							;AX = 00hint 10h        						;Return to text moderet									;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]

إلى اللقاء :)



تم تعديل بواسطه Hamza+C+ASM

شارك هذا الرد

رابط المشاركة
شارك الرد من خلال المواقع ادناه

0 إجابة على هذا السؤال .

لاتوجد إجابات على هذا السؤال حتى الآن .

  • يستعرض القسم حالياً   0 members

    لا يوجد أعضاء مسجلين يشاهدون هذه الصفحة .