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

« back to all changes in this revision

Viewing changes to src/drive/driverom.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
 * driverom.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
#include <string.h>
 
31
 
 
32
#include "drive.h"
 
33
#include "driverom.h"
 
34
#include "log.h"
 
35
#include "machine-drive.h"
 
36
#include "resources.h"
 
37
#include "sysfile.h"
 
38
#include "types.h"
 
39
 
 
40
 
 
41
/* Logging goes here.  */
 
42
static log_t driverom_log;
 
43
 
 
44
/* If nonzero, we are far enough in init that we can load ROMs.  */
 
45
int drive_rom_load_ok = 0;
 
46
 
 
47
 
 
48
int driverom_load_images(void)
 
49
{
 
50
    drive_rom_load_ok = 1;
 
51
 
 
52
    machine_drive_rom_load();
 
53
 
 
54
    if (machine_drive_rom_check_loaded(DRIVE_TYPE_ANY) < 0) {
 
55
        log_error(driverom_log,
 
56
                  "No ROM image found at all!  "
 
57
                  "Hardware-level emulation is not available.");
 
58
        return -1;
 
59
    }
 
60
 
 
61
    return 0;
 
62
}
 
63
 
 
64
void driverom_initialize_traps(drive_t *drive)
 
65
{
 
66
    if ((drive->type == DRIVE_TYPE_1541) ||
 
67
        (drive->type == DRIVE_TYPE_1541II)) {
 
68
        /* Save the ROM check.  */
 
69
        drive->rom_checksum[0] = drive->rom[0xeae4 - 0x8000];
 
70
        drive->rom_checksum[1] = drive->rom[0xeae5 - 0x8000];
 
71
        drive->rom_checksum[2] = drive->rom[0xeae8 - 0x8000];
 
72
        drive->rom_checksum[3] = drive->rom[0xeae9 - 0x8000];
 
73
        /* Save the idle trap.  */
 
74
        drive->rom_idle_trap[0] = drive->rom[0xec9b - 0x8000];
 
75
 
 
76
        if (drive->idling_method == DRIVE_IDLE_TRAP_IDLE) {
 
77
            drive->rom[0xeae4 - 0x8000] = 0xea;
 
78
            drive->rom[0xeae5 - 0x8000] = 0xea;
 
79
            drive->rom[0xeae8 - 0x8000] = 0xea;
 
80
            drive->rom[0xeae9 - 0x8000] = 0xea;
 
81
            drive->rom[0xec9b - 0x8000] = 0x00;
 
82
        }
 
83
    }
 
84
 
 
85
    if (drive->type == DRIVE_TYPE_1551) {
 
86
        /* Save the ROM check. */
 
87
        drive->rom_checksum[0] = drive->rom[0xe9f4 - 0x8000];
 
88
        drive->rom_checksum[1] = drive->rom[0xe9f5 - 0x8000];
 
89
        /* Save the idle trap changes. */
 
90
        drive->rom_idle_trap[0] = drive->rom[0xeabf - 0x8000];
 
91
        drive->rom_idle_trap[1] = drive->rom[0xeac0 - 0x8000];
 
92
        drive->rom_idle_trap[2] = drive->rom[0xead0 - 0x8000];
 
93
        drive->rom_idle_trap[3] = drive->rom[0xead9 - 0x8000];
 
94
 
 
95
        if (drive->idling_method == DRIVE_IDLE_TRAP_IDLE) {
 
96
            drive->rom[0xe9f4 - 0x8000] = 0xea;
 
97
            drive->rom[0xe9f5 - 0x8000] = 0xea;
 
98
            drive->rom[0xeabf - 0x8000] = 0xea;
 
99
            drive->rom[0xeac0 - 0x8000] = 0xea;
 
100
            drive->rom[0xead0 - 0x8000] = 0x08;
 
101
            drive->rom[0xead9 - 0x8000] = 0x00;
 
102
        }
 
103
    }
 
104
 
 
105
    if (drive->type == DRIVE_TYPE_1581) {
 
106
        drive->rom[0xaf6f - 0x8000] = 0x4c;
 
107
        drive->rom[0xaf70 - 0x8000] = 0xca;
 
108
        drive->rom[0xaf71 - 0x8000] = 0xaf;
 
109
        drive->rom[0xdaee - 0x8000] = 0x00;
 
110
    }
 
111
}
 
112
 
 
113
void driverom_init(void)
 
114
{
 
115
    driverom_log = log_open("DriveROM"); 
 
116
}
 
117