Instruction manual
fb7d ;Return a 00h in register a if the operation completes properly, and 0lh if an error occurs
during the read.
fb7d ;Disk number in 'diskno'
fb7d ;Track number in 'track'
fb7d ;Sector number in 'sector'
fb7d ;Dma address in 'dmaad' (0-65535)
fb7d ;
fb7d 21 72 fd ld hl,hstbuf ;buffer to place disk sector (256 bytes)
fb80 db 0f rd_status_loop_1: in a,(0fh) ;check status
fb82 e6 80 and 80h ;check BSY bit
fb84 c2 80 fb jp nz,rd_status_loop_1 ;loop until not busy
fb87 db 0f rd_status_loop_2: in a,(0fh) ;check status
fb89 e6 40 and 40h ;check DRDY bit
fb8b ca 87 fb jp z,rd_status_loop_2 ;loop until ready
fb8e 3e 01 ld a,01h ;number of sectors = 1
fb90 d3 0a out (0ah),a ;sector count register
fb92 3a 31 fc ld a,(sector) ;sector
fb95 d3 0b out (0bh),a ;lba bits 0 - 7
fb97 3a 2f fc ld a,(track) ;track
fb9a d3 0c out (0ch),a ;lba bits 8 - 15
fb9c 3a 35 fc ld a,(diskno) ;disk (only bits
fb9f d3 0d out (0dh),a ;lba bits 16 - 23
fba1 3e e0 ld a,11100000b ;LBA mode, select host drive 0
fba3 d3 0e out (0eh),a ;drive/head register
fba5 3e 20 ld a,20h ;Read sector command
fba7 d3 0f out (0fh),a
fba9 db 0f rd_wait_for_DRQ_set: in a,(0fh) ;read status
fbab e6 08 and 08h ;DRQ bit
fbad ca a9 fb jp z,rd_wait_for_DRQ_set ;loop until bit set
fbb0 db 0f rd_wait_for_BSY_clear: in a,(0fh)
fbb2 e6 80 and 80h
fbb4 c2 b0 fb jp nz,rd_wait_for_BSY_clear
fbb7 db 0f in a,(0fh) ;clear INTRQ
fbb9 db 08 read_loop: in a,(08h) ;get data
fbbb 77 ld (hl),a
fbbc 23 inc hl
fbbd db 0f in a,(0fh) ;check status
fbbf e6 08 and 08h ;DRQ bit
fbc1 c2 b9 fb jp nz,read_loop ;loop until clear
fbc4 2a 33 fc ld hl,(dmaad) ;memory location to place data read from
70










