1. sajid227

    sajid227 New Member

    Joined:
    Nov 4, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Write assembly language program that reads the contents of an existing file and copies them to a new file.
    Further your program must print messages in case:
    - there is problem in opening existing file, message should be "File could not be opened"
    - contents are copied to the new file, message should be "Successfully copied"
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? Post the code you've written so far.
     
  3. aminnadim

    aminnadim New Member

    Joined:
    Feb 15, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Write assembly language program that reads the contents of an existing file and copies them to a new file.
    Further your program must print messages in case:
    § there is problem in opening existing file, message should be "File could not be opened"
    § contents are copied to the new file, message should be "Successfully copied"
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? Post the code you've written so far.
     
  5. malikimran

    malikimran New Member

    Joined:
    Feb 16, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    [org 0x100]
    jmp start

    file_open: db 'C:\first.txt' ; File to be searched
    handle_open: dw 0 ; Handle of file
    file_create: db ’C:\new.txt' ; File to be created
    handle_create: dw 0 ; Handle of file
    mov ah, 0x3f ; DOS service for reading an opened file
    mov bx, [handle_open] ; get file handle (pointer)
    mov cx, 8192 ; number of bytes to read
    mov dx, buff ; offset address of buffer
    int 0x21

    mov ah, 0x3e ; DOS service to close file
    mov bx, [handle_open] ; file handle
    int 0x21

    mov si, buff ; offset of buff
    mov cx, ax ; number of bytes in buffer
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice