return reg;
*portnum = (addr - 0x800) / 0x200;
if ((board->aci->rc->device_settings & 3) == 1) {
- if ((addr & 0xc0) == 0x80) {
+ if ((addr & (0x80 | 0x40)) == 0x80) {
return IDE_DATA;
}
+ if ((addr & (0x80 | 0x40)) == 0xc0) {
+ return -1;
+ }
}
reg = (addr >> 2) & 15;
if (addr & 0x100)
}
} else if (addr >= 0x7fc && addr <= 0x7ff) {
v = board->userdata;
- } else {
+ } else if (!(addr & 1)) {
int offset = (addr >> 1) & board->rom_mask;
if (p1 && (board->userdata & 0x100)) {
offset += 0x8000;
int portnum;
int regnum = get_buddha_reg(addr, board, &portnum, NULL);
if (regnum == IDE_DATA) {
- if (board->ide[portnum])
+ if (board->ide[portnum]) {
v = get_ide_reg_multi(board, IDE_DATA, portnum, 1);
+ }
} else {
v = ide_read_byte(board, addr) << 8;
v |= ide_read_byte(board, addr + 1);