]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Buddha IDE emulation fix
authorToni Wilen <twilen@winuae.net>
Sat, 18 Nov 2023 14:34:45 +0000 (16:34 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 18 Nov 2023 14:34:45 +0000 (16:34 +0200)
idecontrollers.cpp

index a578349baa02f475c4188fb1e830aa4bef30c1fe..808667526e4a2d5622db6108f88ccd9710bf19c2 100644 (file)
@@ -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);