~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/c128/c128drive.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * c128drive.c
 
3
 *
 
4
 * Written by
 
5
 *  Andreas Boose <viceteam@t-online.de>
 
6
 *
 
7
 * This file is part of VICE, the Versatile Commodore Emulator.
 
8
 * See README for copyright notice.
 
9
 *
 
10
 *  This program is free software; you can redistribute it and/or modify
 
11
 *  it under the terms of the GNU General Public License as published by
 
12
 *  the Free Software Foundation; either version 2 of the License, or
 
13
 *  (at your option) any later version.
 
14
 *
 
15
 *  This program is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *  GNU General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program; if not, write to the Free Software
 
22
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
23
 *  02111-1307  USA.
 
24
 *
 
25
 */
 
26
 
 
27
#include "vice.h"
 
28
 
 
29
#include <stdio.h>
 
30
 
 
31
#include "drive.h"
 
32
#include "iec.h"
 
33
#include "iec128dcr.h"
 
34
#include "iecieee.h"
 
35
#include "ieee.h"
 
36
#include "machine-drive.h"
 
37
#include "types.h"
 
38
 
 
39
 
 
40
int machine_drive_resources_init(void)
 
41
{
 
42
    return drive_resources_type_init(DRIVE_TYPE_1541)
 
43
        | iec_drive_resources_init() | iec128dcr_drive_resources_init()
 
44
        | ieee_drive_resources_init();
 
45
}
 
46
 
 
47
void machine_drive_resources_shutdown(void)
 
48
{
 
49
    iec_drive_resources_shutdown();
 
50
    iec128dcr_drive_resources_shutdown();
 
51
    ieee_drive_resources_shutdown();
 
52
}
 
53
 
 
54
int machine_drive_cmdline_options_init(void)
 
55
{
 
56
    return iec_drive_cmdline_options_init()
 
57
        | iec128dcr_drive_cmdline_options_init()
 
58
        | ieee_drive_cmdline_options_init();
 
59
}
 
60
 
 
61
void machine_drive_init(struct drive_context_s *drv)
 
62
{
 
63
    iec_drive_init(drv);
 
64
    iec128dcr_drive_init(drv);
 
65
    iecieee_drive_init(drv);
 
66
    ieee_drive_init(drv);
 
67
}
 
68
 
 
69
void machine_drive_shutdown(struct drive_context_s *drv)
 
70
{
 
71
    iec_drive_shutdown(drv);
 
72
    iec128dcr_drive_shutdown(drv);
 
73
    iecieee_drive_shutdown(drv);
 
74
    ieee_drive_shutdown(drv);
 
75
}
 
76
 
 
77
void machine_drive_reset(struct drive_context_s *drv)
 
78
{
 
79
    iec_drive_reset(drv);
 
80
    iec128dcr_drive_reset(drv);
 
81
    iecieee_drive_reset(drv);
 
82
    ieee_drive_reset(drv);
 
83
}
 
84
 
 
85
void machine_drive_mem_init(struct drive_context_s *drv, unsigned int type)
 
86
{
 
87
    iec_drive_mem_init(drv, type);
 
88
    iec128dcr_drive_mem_init(drv, type);
 
89
    ieee_drive_mem_init(drv, type);
 
90
}
 
91
 
 
92
void machine_drive_setup_context(struct drive_context_s *drv)
 
93
{
 
94
    iec_drive_setup_context(drv);
 
95
    iec128dcr_drive_setup_context(drv);
 
96
    iecieee_drive_setup_context(drv);
 
97
    ieee_drive_setup_context(drv);
 
98
}
 
99
 
 
100
void machine_drive_idling_method(unsigned int dnr)
 
101
{
 
102
    iec_drive_idling_method(dnr);
 
103
}
 
104
 
 
105
void machine_drive_vsync_hook(void)
 
106
{
 
107
    iec_drive_vsync_hook();
 
108
}
 
109
 
 
110
void machine_drive_rom_load(void)
 
111
{
 
112
    iec_drive_rom_load();
 
113
    iec128dcr_drive_rom_load();
 
114
    ieee_drive_rom_load();
 
115
}
 
116
 
 
117
void machine_drive_rom_setup_image(unsigned int dnr)
 
118
{
 
119
    iec_drive_rom_setup_image(dnr);
 
120
    iec128dcr_drive_rom_setup_image(dnr);
 
121
    ieee_drive_rom_setup_image(dnr);
 
122
}
 
123
 
 
124
int machine_drive_rom_read(unsigned int type, WORD addr, BYTE *data)
 
125
{
 
126
    if (iec_drive_rom_read(type, addr, data) == 0)
 
127
        return 0;
 
128
    if (iec128dcr_drive_rom_read(type, addr, data) == 0)
 
129
        return 0;
 
130
    if (ieee_drive_rom_read(type, addr, data) == 0)
 
131
        return 0;
 
132
 
 
133
    return -1;
 
134
}
 
135
 
 
136
int machine_drive_rom_check_loaded(unsigned int type)
 
137
{
 
138
    if (iec_drive_rom_check_loaded(type) == 0)
 
139
        return 0;
 
140
    if (iec128dcr_drive_rom_check_loaded(type) == 0)
 
141
        return 0;
 
142
    if (ieee_drive_rom_check_loaded(type) == 0)
 
143
        return 0;
 
144
 
 
145
    return -1;
 
146
}
 
147
 
 
148
void machine_drive_rom_do_checksum(unsigned int dnr)
 
149
{
 
150
    iec_drive_rom_do_checksum(dnr);
 
151
    ieee_drive_rom_do_checksum(dnr);
 
152
}
 
153
 
 
154
int machine_drive_snapshot_read(struct drive_context_s *ctxptr,
 
155
                                struct snapshot_s *s)
 
156
{
 
157
    if (iec_drive_snapshot_read(ctxptr, s) < 0)
 
158
        return -1;
 
159
    if (iecieee_drive_snapshot_read(ctxptr, s) < 0)
 
160
        return -1;
 
161
    if (ieee_drive_snapshot_read(ctxptr, s) < 0)
 
162
        return -1;
 
163
 
 
164
    return 0;
 
165
}
 
166
 
 
167
int machine_drive_snapshot_write(struct drive_context_s *ctxptr,
 
168
                                 struct snapshot_s *s)
 
169
{
 
170
    if (iec_drive_snapshot_write(ctxptr, s) < 0)
 
171
        return -1;
 
172
    if (iecieee_drive_snapshot_write(ctxptr, s) < 0)
 
173
        return -1;
 
174
    if (ieee_drive_snapshot_write(ctxptr, s) < 0)
 
175
        return -1;
 
176
 
 
177
    return 0;
 
178
}
 
179
 
 
180
int machine_drive_image_attach(struct disk_image_s *image, unsigned int unit)
 
181
{
 
182
    return iec_drive_image_attach(image, unit)
 
183
           & ieee_drive_image_attach(image, unit);
 
184
}
 
185
 
 
186
int machine_drive_image_detach(struct disk_image_s *image, unsigned int unit)
 
187
{
 
188
    return iec_drive_image_detach(image, unit)
 
189
           & ieee_drive_image_detach(image, unit);
 
190
}
 
191
 
 
192
void machine_drive_port_default(struct drive_context_s *drv)
 
193
{
 
194
    iec_drive_port_default(drv);
 
195
}
 
196
 
 
197
void machine_drive_flush(void)
 
198
{
 
199
    drive_gcr_data_writeback_all();
 
200
}
 
201
 
 
202
void machine_drive_stub(void)
 
203
{
 
204
 
 
205
}
 
206