2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
5 #ifndef ATARI_PARTITION_H
6 #define ATARI_PARTITION_H
9 * An extented partition scheme exists, (several actually), cf.
10 * http://people.debian.org/~smarenka/d-i/atari-fdisk-README
12 * http://leonard.oxg.free.fr/articles/multi_atari/multi_atari.html
15 #include "SupportDefs.h"
16 #include "ByteOrder.h"
18 /* this one is BIG endian */
19 struct atari_partition_entry
{
20 #define ATARI_PART_EXISTS 0x01
21 #define ATARI_PART_BOOTABLE 0x80
23 /* some known types */
24 #define ATARI_PART_TYPE_GEM 'G', 'E', 'M'
25 #define ATARI_PART_TYPE_LNX 'L', 'N', 'X'
26 #define ATARI_PART_TYPE_OS9 'O', 'S', '9'
27 /* the one we'll use */
28 #define ATARI_PART_TYPE_BFS 'B', 'F', 'S'
33 uint8
Flags() const { return flags
; }
34 uint32
Start() const { return B_BENDIAN_TO_HOST_INT32(start
); }
35 uint32
Size() const { return B_BENDIAN_TO_HOST_INT32(size
); }
39 /* this one is BIG endian */
40 struct atari_root_block
{
41 uint8 bootcode
[0x1b6];
42 uint16 cylinder_count
;
45 uint16 reduced_write_current_cylinder
;
46 uint16 write_precomp_cynlinder
;
49 uint8 interleave_factor
;
50 uint8 sectors_per_track
;
51 uint32 maximum_partition_size
; /* in sectors (in clusters) */
52 struct atari_partition_entry partitions
[4];
53 uint32 bad_sector_list_start
;
54 uint32 bad_sector_list_count
;
55 #define ATARI_BOOTABLE_MAGIC 0x1234
56 uint16 checksum
; /* checksum? 0x1234 for bootable */
58 uint32
MaxPartitionSize() const { return B_BENDIAN_TO_HOST_INT16(maximum_partition_size
); }
59 uint32
BadSectorsStart() const { return B_BENDIAN_TO_HOST_INT32(bad_sector_list_start
); }
60 uint32
BadSectorsCount() const { return B_BENDIAN_TO_HOST_INT32(bad_sector_list_count
); }
61 uint16
Checksum() const { return B_BENDIAN_TO_HOST_INT16(checksum
); }
64 /************* bad blocks *************/
66 struct bad_block_entry
{
69 struct bad_block_block
{
72 /************* partition block *************/
74 /* this one is BIG endian, but with LITTLE endian fields! marked LE */
75 /* this is part of the filesystem... */
76 struct atari_boot_block
{
77 uint16 branch
; /* branch code */
80 uint16 bytes_per_sector
; /* LE */
81 uint8 sectors_per_cluster
;
82 uint16 reserved_sectors
; /* LE */
84 uint16 entries_in_root_dir
; /* LE */
85 uint16 sector_count
; /* LE */
86 uint8 media_descriptor
;
87 uint16 sectors_per_fat
; /* LE */
88 uint16 sectors_per_track
; /* LE */
89 uint16 side_count
; /* LE */
90 uint16 hidden_sector_count
; /* LE */
98 #define ATARI_BB_FILENAME_SZ (0x003a - 0x002e)
99 char filename
[ATARI_BB_FILENAME_SZ
];
100 #define ATARI_BB_BOOTCODE_SZ (0x01fe - 0x003a)
101 uint8 bootcode
[ATARI_BB_BOOTCODE_SZ
];
102 uint16 checksum
; /* 0x1234 if bootable */
107 #endif /* ATARI_PARTITION_H */