~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to src/drive/drive-overflow.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-03-27 13:06:04 UTC
  • mfrom: (4 hoary)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20050327130604-zodmv0i60dbbmcik
Tags: 1.16-3
Apply patch from Andreas Jochens <aj@andaco.de> to correct building on
AMD64 and GCC 4.x (closes: #300936)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * drive-overflow.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 "alarm.h"
 
30
#include "clkguard.h"
 
31
#include "drive-overflow.h"
 
32
#include "drive.h"
 
33
#include "drivetypes.h"
 
34
#include "interrupt.h"
 
35
#include "log.h"
 
36
#include "rotation.h"
 
37
 
 
38
 
 
39
static void drive_clk_overflow_callback(CLOCK sub, void *data)
 
40
{
 
41
    unsigned int dnr;
 
42
    drive_t *drive;
 
43
 
 
44
    dnr = (unsigned int)data;
 
45
    drive = drive_context[dnr]->drive;
 
46
 
 
47
    if (drive->byte_ready_active == 0x06)
 
48
        rotation_rotate_disk(drive);
 
49
 
 
50
    rotation_overflow_callback(sub, dnr);
 
51
 
 
52
    if (drive->attach_clk > (CLOCK) 0)
 
53
        drive->attach_clk -= sub;
 
54
    if (drive->detach_clk > (CLOCK) 0)
 
55
        drive->detach_clk -= sub;
 
56
    if (drive->attach_detach_clk > (CLOCK) 0)
 
57
        drive->attach_detach_clk -= sub;
 
58
 
 
59
    alarm_context_time_warp(drive_context[dnr]->cpu->alarm_context, sub, -1);
 
60
    interrupt_cpu_status_time_warp(drive_context[dnr]->cpu->int_status, sub,
 
61
                                   -1);
 
62
}
 
63
 
 
64
void drive_overflow_init(void)
 
65
{
 
66
    unsigned int dnr;
 
67
 
 
68
    for (dnr = 0; dnr < DRIVE_NUM; dnr++) {
 
69
        clk_guard_add_callback(drive_context[dnr]->cpu->clk_guard,
 
70
                               drive_clk_overflow_callback, (void *)dnr);
 
71
    }
 
72
}
 
73