From: Toni Wilen Date: Sat, 18 Nov 2023 14:34:45 +0000 (+0200) Subject: Buddha IDE emulation fix X-Git-Tag: 5.1.0~49 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=1d4db3c3e0cc1d9537400b4edf7f1559ced17c0a;p=francis%2Fwinuae.git Buddha IDE emulation fix --- diff --git a/idecontrollers.cpp b/idecontrollers.cpp index a578349b..80866752 100644 --- a/idecontrollers.cpp +++ b/idecontrollers.cpp @@ -498,9 +498,12 @@ static int get_buddha_reg(uaecptr addr, struct ide_board *board, int *portnum, i 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) @@ -687,7 +690,7 @@ static uae_u32 ide_read_byte(struct ide_board *board, uaecptr addr) } } 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; @@ -1106,8 +1109,9 @@ static uae_u32 ide_read_word(struct ide_board *board, uaecptr addr) 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);