/[cebix]/SIDPlayer/src/psid.h
ViewVC logotype

Contents of /SIDPlayer/src/psid.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations)
2004-01-12T15:15:49Z (13 years, 8 months ago) by cebix
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
File MIME type: text/x-objective-c
Happy New Year!

1 /*
2 * psid.h - PSID file format definitions
3 *
4 * SIDPlayer (C) Copyright 1996-2004 Christian Bauer
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef PSID_H
22 #define PSID_H
23
24 #include "types.h"
25
26
27 // Minimum and maximum header length
28 const int PSID_MIN_HEADER_LENGTH = 118; // Version 1
29 const int PSID_MAX_HEADER_LENGTH = 124; // Version 2
30
31 // Offsets of fields in header (all fields big-endian)
32 enum {
33 PSID_ID = 0, // 'PSID'
34 PSID_VERSION = 4, // 1 or 2
35 PSID_LENGTH = 6, // Header length
36 PSID_START = 8, // C64 load address
37 PSID_INIT = 10, // C64 init routine address
38 PSID_MAIN = 12, // C64 replay routine address
39 PSID_NUMBER = 14, // Number of subsongs
40 PSID_DEFSONG = 16, // Main subsong number
41 PSID_SPEED = 18, // Speed flags (1 bit/song)
42 PSID_NAME = 22, // Module name (ISO Latin1 character set)
43 PSID_AUTHOR = 54, // Author name (dto.)
44 PSID_COPYRIGHT = 86, // Copyright info (dto.)
45 PSID_FLAGS = 118, // Flags (only in version 2 header)
46 PSID_RESERVED = 120
47 };
48
49 // Read 16-bit quantity from PSID header
50 inline uint16 read_psid_16(const uint8 *p, int offset)
51 {
52 return (p[offset] << 8) | p[offset + 1];
53 }
54
55 // Read 32-bit quantity from PSID header
56 inline uint32 read_psid_32(const uint8 *p, int offset)
57 {
58 return (p[offset] << 24) | (p[offset + 1] << 16) | (p[offset + 2] << 8) | p[offset + 3];
59 }
60
61 #endif

  ViewVC Help
Powered by ViewVC 1.1.26