Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to Write Into Particular Sector of disk

Posted By: Adalbert Fischer     Category: Assembly Language     Views: 57289

Write a Program to Write Into Particular Sector of disk.

Code for Program to Write Into Particular Sector of disk in Assembly Language

prnstr macro msg
        mov ah, 09h
        lea dx, msg
        int 21h

readnum macro val
        mov ah, 01h
        int 21h
        mov ah, 00h
        sub al, '0'
        mov bl, 0ah
        mul bl
        mov bl, al
        mov bh, 00h
        mov ax, 0100h
        int 21h
        sub al, '0'
        add bx, ax
        mov val, bl

data segment
        track db ?
        sector db ?
        head db ?
        drive db ?

        msg1 db 0dh, 0ah, "Enter the track number : $"
        msg2 db 0dh, 0ah, "Enter the sector number : $"
        msg3 db 0dh, 0ah, "Enter the head number (0/1) : $"
        msg4 db "Enter drive (0-A, 1-B, 80-C) : $"
        msg5 db 0dh, 0ah, "Enter the string to be written : $"
        msg6 db 0dh, 0ah, "Failure in writing to disk...$"
        msg7 db 0dh, 0ah, "Writing to the disk...$"
        msg8 db 0dh, 0ah, "Writing Successful...$"
        buf db 512 dup(' ')
data ends

code segment
        assume cs:code, ds:data, es:data
start :
        mov ax, data
        mov ds, ax
        mov es, ax

        prnstr msg4
        readnum drive
        prnstr msg3
        readnum head
        prnstr msg1
        readnum track
        prnstr msg2
        readnum sector
        prnstr msg5
        mov si, offset buf
        mov ah, 01h
again :
        int 21h
        mov [si], al
        inc si
        cmp al, '#'
        jnz again

        prnstr msg7
        mov al, 01h
        mov ch, track
        mov cl, sector
        mov dh, head
        mov dl, drive
        lea bx, buf
        mov ah, 03h
        int 13h
        jnc success
        prnstr msg6
        jmp stop
success :
        prnstr msg8
stop :
        mov ax, 4c00h
        int 21h
code ends
        end start


Didn't find what you were looking for? Find more on Program to Write Into Particular Sector of disk Or get search suggestion and latest updates.

Adalbert Fischer
Adalbert Fischer author of Program to Write Into Particular Sector of disk is from Frankfurt, Germany.
View All Articles

Related Articles and Code:


Other Interesting Articles in Assembly Language:

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!