INT 13h AH=02h copies whole sectors from the disk into memory at ES:BX: AL sectors, 512 bytes each, starting at the address given by CH, CL and DH on drive DL (see INT 13h for how the cylinder is packed into CH and CL). The buffer must be big enough for all of them. On success CF = 0 and AL says how many were read.

The first sector of a hard disk, cylinder 0, head 0, sector 1, is the master boot record: boot code, then from offset 1BEh four 16-byte partition entries, and at 1FEh the signature bytes 55h AAh that mark the sector as bootable. The example reads it and prints those last two bytes:

On a disk image (IMGMOUNT) it prints: read ok, bytes at 1FEh: 55 AA. With drive C a mounted folder, as in the workbench, there is no sector to read; DOSBox-X answers this one boot-sector probe with success but fills in only a fake partition entry, so it prints: read ok, bytes at 1FEh: 00 00. With no drive 80h at all: read failed, AH = 01.
PUSH CS
POP ES
MOV BX, OFFSET SECT1 ; ES:BX = a 512-byte buffer
MOV AX, 0201h ; AH = 02h read, AL = 1 sector
MOV CX, 0001h ; CH = cylinder 0, CL = sector 1 (sectors count from 1)
MOV DX, 0080h ; DH = head 0, DL = 80h, the first hard disk
INT 13h
JC FAIL1 ; CF = 1: AH = what went wrong
MOV DX, OFFSET OK1
MOV AH, 09h ; DOS: print the $-string at DS:DX
INT 21h
MOV AL, SECT1+1FEh ; the boot signature: 55h AAh on a real disk
CALL PHEX2
MOV DL, " "
MOV AH, 02h ; DOS: print the character in DL
INT 21h
MOV AL, SECT1+1FFh
CALL PHEX2
JMP DONE1
FAIL1:
MOV BL, AH ; keep the status
MOV DX, OFFSET BAD1
MOV AH, 09h ; DOS: print the $-string at DS:DX
INT 21h
MOV AL, BL
CALL PHEX2
DONE1:
OK1 DB "read ok, bytes at 1FEh: $"
BAD1 DB "read failed, AH = $"
SECT1 DB 512 DUP (0)
PHEX2 PROC NEAR ; print AL as two hex digits; keeps every register
PUSH AX
PUSH CX
PUSH DX
MOV DH, AL ; keep the byte
MOV CL, 4
SHR AL, CL ; the high nibble
CALL HEXN1
MOV AL, DH
AND AL, 0Fh ; the low nibble
CALL HEXN1
POP DX
POP CX
POP AX
RET
HEXN1:
ADD AL, "0"
CMP AL, "9"
JBE HEXN2
ADD AL, 7 ; past "9": "A".."F"
HEXN2:
MOV DL, AL
MOV AH, 02h
INT 21h
RET
PHEX2 ENDP

Limits

The buffer must not cross a 64 KB physical boundary (an address that is a multiple of 10000h): the PC's DMA controller, used for floppies, cannot carry over into the next 64 KB page, and the BIOS reports error 09h. Sector-sized buffers in a small program are usually safe, but a big one should be checked. Reads of several sectors should stay within one track on old BIOSes; reading one sector at a time is the safe choice. And floppy reads fail now and then for harmless reasons: retry three times with INT 13h AH=00h in between.

In DOSBox-X

Only drives attached as images (IMGMOUNT, or a booted disk) have sectors. For a mounted folder DOSBox-X answers most reads with CF = 1 and AH = 01h; the one exception is a read of cylinder 0, head 0, sector 1 of a hard-disk number, which some old installers use to check that a disk exists. That read "succeeds" and writes only a partition-entry marker (80h at 1BEh, 06h at 1C2h) into the buffer, leaving the rest as it was, which is why the example clears its buffer first and then sees 00 00 where the signature would be.