1 /* trdos.h: Routines for handling the TR-DOS filesystem
2 Copyright (c) 2016 Sergio BaldovĂ
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 Author contact information:
20 E-mail: serbalgi@gmail.com
29 typedef struct trdos_spec_t
{
30 uint8_t first_free_sector
; /* 0 to 15 */
31 uint8_t first_free_track
; /* 0 to ? */
34 uint16_t free_sectors
;
36 char password
[9]; /* not null-terminated */
37 uint8_t deleted_files
;
38 char disk_label
[8]; /* not null-terminated */
42 typedef struct trdos_dirent_t
{
43 char filename
[8]; /* not null-terminated */
47 uint8_t file_length
; /* in sectors */
48 uint8_t start_sector
; /* 0 to 15 */
49 uint8_t start_track
; /* 0 to ? */
53 typedef struct trdos_boot_info_t
{
55 int basic_files_count
;
56 char first_basic_file
[8]; /* not null-terminated */
60 int trdos_read_spec (trdos_spec_t
*spec
, const uint8_t *src
);
62 void trdos_write_spec (uint8_t *dest
, const trdos_spec_t
*spec
);
64 int trdos_read_dirent (trdos_dirent_t
*entry
, const uint8_t *src
);
66 void trdos_write_dirent (uint8_t *dest
, const trdos_dirent_t
*entry
);
68 int trdos_read_fat (trdos_boot_info_t
*info
, const uint8_t *sectors
, unsigned int seclen
);