Logo 
Search:

Assembly Language Articles

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

Program to Read Particular Sector of Disk

Posted By: Anna Schmidt     Category: Assembly Language     Views: 3730

Write a Program to Read Particular Sector of Disk.

Code for Program to Read Particular Sector of Disk in Assembly Language

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

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
    endm

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, "Sector contains : $"
        msg6 db 0dh, 0ah, "Failure in reading sector...$"
        msg7 db 0dh, 0ah, "Reading sector...$"

        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 msg7
        mov al, 01h
    mov ch, track
        mov cl, sector
        mov dh, head
        mov dl, drive
        lea bx, buf
    mov ah, 02h
        int 13h
        jnc success
        prnstr msg6
        jmp stop
success :
    prnstr msg5
        mov cx, 512
        mov ah, 02h
        mov si, offset buf
next :
    mov dl, [si]
        int 21h
        inc si
        loop next
stop :
    mov ax, 4c00h
    int 21h
code ends
    end start


  
Share: 


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

Anna Schmidt
Anna Schmidt author of Program to Read Particular Sector of Disk is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
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!