File: trdos.h

package info (click to toggle)
fuse-emulator 1.3.2%2Bdfsg1-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 10,456 kB
  • ctags: 9,261
  • sloc: ansic: 83,215; sh: 11,503; perl: 3,806; makefile: 1,000; yacc: 254; lex: 143
file content (73 lines) | stat: -rw-r--r-- 2,369 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* trdos.h: Routines for handling the TR-DOS filesystem
   Copyright (c) 2016 Sergio BaldovĂ­

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

   Author contact information:

   E-mail: serbalgi@gmail.com

*/

#ifndef FUSE_TRDOS_H
#define FUSE_TRDOS_H

#include <libspectrum.h>

typedef struct trdos_spec_t {
  libspectrum_byte first_free_sector; /* 0 to 15 */
  libspectrum_byte first_free_track;  /* 0 to ? */
  libspectrum_byte disk_type;
  libspectrum_byte file_count;
  libspectrum_word free_sectors;
  libspectrum_byte id;
  char password[9];                   /* not null-terminated */
  libspectrum_byte deleted_files;
  char disk_label[8];                 /* not null-terminated */
} trdos_spec_t;

typedef struct trdos_dirent_t {
  char filename[8];                   /* not null-terminated */
  char file_extension;
  libspectrum_word param1;
  libspectrum_word param2;
  libspectrum_byte file_length;       /* in sectors */
  libspectrum_byte start_sector;      /* 0 to 15 */
  libspectrum_byte start_track;       /* 0 to ? */
} trdos_dirent_t;

typedef struct trdos_boot_info_t {
  int have_boot_file;
  int basic_files_count;
  char first_basic_file[8];           /* not null-terminated */
} trdos_boot_info_t;

int
trdos_read_spec( trdos_spec_t *spec, const libspectrum_byte *src );

void
trdos_write_spec( libspectrum_byte *dest, const trdos_spec_t *spec );

int
trdos_read_dirent( trdos_dirent_t *entry, const libspectrum_byte *src );

void
trdos_write_dirent( libspectrum_byte *dest, const trdos_dirent_t *entry );

int
trdos_read_fat( trdos_boot_info_t *info, const libspectrum_byte *sectors,
                unsigned int seclen );

#endif                  /* #ifndef FUSE_TRDOS_H */