~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/lib/formats/atarist_dsk.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************************
2
 
 
3
 
    formats/atarist_dsk.c
4
 
 
5
 
    Atari ST disk images
6
 
 
7
 
*********************************************************************/
8
 
 
9
 
#include "formats/atarist_dsk.h"
10
 
#include "formats/basicdsk.h"
11
 
 
12
 
/*
13
 
 
14
 
    TODO:
15
 
 
16
 
    - MSA format
17
 
    - STT format
18
 
    - DIM format
19
 
 
20
 
*/
21
 
 
22
 
/***************************************************************************
23
 
    CONSTANTS / MACROS
24
 
***************************************************************************/
25
 
 
26
 
#define LOG 0
27
 
 
28
 
/***************************************************************************
29
 
    IMPLEMENTATION
30
 
***************************************************************************/
31
 
 
32
 
/*-------------------------------------------------
33
 
    FLOPPY_IDENTIFY( atarist_st_identify )
34
 
-------------------------------------------------*/
35
 
 
36
 
static FLOPPY_IDENTIFY( atarist_st_identify )
37
 
{
38
 
        *vote = 100;
39
 
 
40
 
        return FLOPPY_ERROR_SUCCESS;
41
 
}
42
 
 
43
 
/*-------------------------------------------------
44
 
    FLOPPY_CONSTRUCT( atarist_st_construct )
45
 
-------------------------------------------------*/
46
 
 
47
 
static FLOPPY_CONSTRUCT( atarist_st_construct )
48
 
{
49
 
        int heads = 0;
50
 
        int tracks = 0;
51
 
        int sectors = 0;
52
 
        UINT8 bootsector[512];
53
 
 
54
 
        floppy_image_read(floppy, bootsector, 0, 512);
55
 
        sectors = bootsector[0x18];
56
 
        heads = bootsector[0x1a];
57
 
        tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads;
58
 
 
59
 
        struct basicdsk_geometry geometry;
60
 
        memset(&geometry, 0, sizeof(geometry));
61
 
 
62
 
        geometry.heads = heads;
63
 
        geometry.first_sector_id = 1;
64
 
        geometry.sector_length = 512;
65
 
        geometry.tracks = tracks;
66
 
        geometry.sectors = sectors;
67
 
 
68
 
        if (LOG) LOG_FORMATS("ST Heads %u Tracks %u Sectors %u\n", heads, tracks, sectors);
69
 
 
70
 
        return basicdsk_construct(floppy, &geometry);
71
 
}
72
 
 
73
 
/*-------------------------------------------------
74
 
    FLOPPY_CONSTRUCT(atarist_dsk_construct)
75
 
-------------------------------------------------*/
76
 
 
77
 
FLOPPY_OPTIONS_START( atarist )
78
 
        FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_st_identify, atarist_st_construct, NULL, NULL )
79
 
/*  FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL, NULL )
80
 
    FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL, NULL )
81
 
    FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL, NULL )*/
82
 
FLOPPY_OPTIONS_END