Instruction manual

0289 ;Subroutine to start a new line
0289 3e 0d write_newline: ld a,00dh ;ASCII carriage return character
028b cd 0c 00 call write_char
028e 3e 0a ld a,00ah ;new line (line feed) character
0290 cd 0c 00 call write_char
0293 c9 ret
0294 ;
0294 ;Subroutine to read one disk sector (256 bytes)
0294 ;Address to place data passed in HL
0294 ;LBA bits 0 to 7 passed in C, bits 8 to 15 passed in B
0294 ;LBA bits 16 to 23 passed in E
0294 disk_read:
0294 db 0f rd_status_loop_1: in a,(0fh) ;check status
0296 e6 80 and 80h ;check BSY bit
0298 c2 94 02 jp nz,rd_status_loop_1 ;loop until not busy
029b db 0f rd_status_loop_2: in a,(0fh) ;check status
029d e6 40 and 40h ;check DRDY bit
029f ca 9b 02 jp z,rd_status_loop_2 ;loop until ready
02a2 3e 01 ld a,01h ;number of sectors = 1
02a4 d3 0a out (0ah),a ;sector count register
02a6 79 ld a,c
02a7 d3 0b out (0bh),a ;lba bits 0 - 7
02a9 78 ld a,b
02aa d3 0c out (0ch),a ;lba bits 8 - 15
02ac 7b ld a,e
02ad d3 0d out (0dh),a ;lba bits 16 - 23
02af 3e e0 ld a,11100000b ;LBA mode, select drive 0
02b1 d3 0e out (0eh),a ;drive/head register
02b3 3e 20 ld a,20h ;Read sector command
02b5 d3 0f out (0fh),a
02b7 db 0f rd_wait_for_DRQ_set: in a,(0fh) ;read status
02b9 e6 08 and 08h ;DRQ bit
02bb ca b7 02 jp z,rd_wait_for_DRQ_set ;loop until bit set
02be db 0f rd_wait_for_BSY_clear: in a,(0fh)
02c0 e6 80 and 80h
02c2 c2 be 02 jp nz,rd_wait_for_BSY_clear
02c5 db 0f in a,(0fh) ;clear INTRQ
02c7 db 08 read_loop: in a,(08h) ;get data
02c9 77 ld (hl),a
02ca 23 inc hl
55