Next Previous Contents

## 4. Converting sector numbers

Since the read and write functions expect a sector number, for systems where the sectors aren't addressed by a logical sector number (e.g. CBM drives), there are 2 conversion functions. One of them converts a logical sector number to a head/track/sector triple. The other conversion function works the other way round.

> `

>         unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle,
>                                                     const dio_phys_pos *physpos,
>                                                     sectnum_t *sectnum);

> `

This function converts track/head/sector to logical sector number.

> `

>         unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle,
>                                                     const _sectnum_t *sectnum,
>                                                     dio_phys_pos *physpos);

> `

This function converts a logical sector number to track/head/sector notation.

Note, that on systems which natively use logical sector numbers (e.g. Atari), the conversion functions are dummies. They ignore head/track (`dio_phys_to_log`) or return them as zero (`dio_log_to_phys`). The logical sector number is returned as physical sector and vice versa.

Next Previous Contents