azimraeesi
شنبه 25 اردیبهشت 1389, 20:37 عصر
سلام
کد برنام که مسیر یک فایل متنی را از صفحه کلید بگیرد و محتویات ان را در یک فایل دیگر در مسیر دلخواه کپی کند
azimraeesi
یک شنبه 26 اردیبهشت 1389, 11:19 صبح
کسی نیست کمک کند
pashaie
یک شنبه 26 اردیبهشت 1389, 14:04 عصر
یه کدی واسه کار دیگه ای نوشته بودم ولی با کمی تغییر کد مورد نظر شما شد
خدمت شما
    org  100h
    
    lea dx, msg_start
    mov ah, 9
    int 21h
    
    lea dx, pathBuf
    mov ah, 0ah
    int 21h 
    
    lea bx, pathBuf
    sub ax, ax
    mov al, pathBuf[1]    
    mov si, ax     
    mov bx[si+2], 0
    
    lea dx, pathBuf    
    inc dx
    inc dx    
    mov al, 0 
    mov ah, 3Dh 
    int 21h    
    jc  err_open
    mov ReadH, ax 
    
    mov ah, 3Ch 
    mov cx, 0
    lea dx, ResultFN    
    int 21h
    jc  err_create
    mov WriteH, ax  
                    
    mov ah, 3Fh 
    mov bx, ReadH
    mov cx, 2048
    lea dx, buffer
    int 21h  
    mov si, 0        
    copy_start:
    mov bh, buffer[si]
    inc si
    cmp si, ax
    jl  copy_start    
    
    mov cx, ax
    mov ah, 40h
    mov bx, WriteH
    lea dx, buffer
    int 21h 
    
    lea dx, msg_ok
    mov ah, 9
    int 21h
    mov ah, 3Eh 
    mov bx, ReadH
    int 21h 
    mov ah, 3Eh 
    mov bx, WriteH
    int 21h 
    jmp end_of_program
    
    err_open:
    lea dx, msg_err_o
    mov ah, 9
    int 21h 
    jmp end_of_program
    
    err_create:
    lea dx, msg_err_c
    mov ah, 9
    int 21h 
    jmp end_of_program
    
    end_of_program:
    lea dx, msg_key
    mov ah, 9
    int 21h
   
    mov ah, 1
    int 21h
    ret    
    msg_start   db "Note: this program will just convert first 2kb of input file."
                db 13,10,"Input File: $"
    msg_err_o   db 13,10,"Error in opening file.$"
    msg_err_c   db 13,10,"Error in creating file.$"    
    msg_ok      db 13,10,"Mission Accomplished!$"
    msg_key     db 13,10,"Press any key to continue.$"    
    ResultFN    db "result.txt", 0
    ReadH       dw ?
    WriteH      dw ?           
    pathBuf     db 100, ?, 100 dup (0) 
    buffer      db 2048 dup(?)
azimraeesi
دوشنبه 27 اردیبهشت 1389, 14:26 عصر
سلام  این برنامه مشکل داره کسی میتونه مشکلش برطرف کنه
مسیر فایل مبدا رو میگیره محتویاتش در فایل مقصد کپی میشه
mydata segment 'data'
str1 label byte
max db 50
len db ?
buffer db 50 dup(?)
str2 label byte
max2 db 50
len2 db ?
buffer2 db 50 dup(?)
filehandle1 dw ?
filehandle2 dw ?
msg1 db 10,13,'enter surce file address:','$'
msg2 db 10,13,'enter file2 address:','$'
temp db ?
mydata ends
mycode segment 'code'
main proc far
assume cs:mycode,ds:mydata
mov ax,mydata
mov ds,ax
mov ah,09
mov dx,offset msg1
int 21h
mov ah,0ah
mov dx,offset str1
int 21h
mov ah,09
mov dx,offset msg2
int 21h
;mov ah,0ah
;mov dx,offset str2
;int 21h
;mohasebe toole reshte
mov si,offset buffer
mov cl,len
mov ch,0
add si,cx
mov byte ptr[si],00h
mov ah,3ch
mov cx,0
mov dx,offset buffer
int 21h
mov filehandle2,ax
start:mov ah,3fh
mov cx,1
mov bx,filehandle1
mov dx,offset temp
int 21h
cmp ax,0
je exit
mov ah,40h
mov bx,filehandle1
mov cx,1
mov dx,offset temp
int 21h
jmp start
exit:mov ah,3eh
mov bx,filehandle1
int 21h
mov ah,3eh
mov bx,filehandle2
int 21h
mov ah,4ch
int 21h
main endp
mycode ends
end main
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.