5
* Andreas Boose <viceteam@t-online.de>
7
* This file is part of VICE, the Versatile Commodore Emulator.
8
* See README for copyright notice.
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.
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.
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
35
#include "machine-drive.h"
36
#include "resources.h"
41
/* Logging goes here. */
42
static log_t driverom_log;
44
/* If nonzero, we are far enough in init that we can load ROMs. */
45
int drive_rom_load_ok = 0;
48
int driverom_load_images(void)
50
drive_rom_load_ok = 1;
52
machine_drive_rom_load();
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.");
64
void driverom_initialize_traps(drive_t *drive)
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];
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;
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];
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;
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;
113
void driverom_init(void)
115
driverom_log = log_open("DriveROM");