From e1ea3e622bab9da6666e316f5f45d78e164ad640 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sun, 16 Apr 2017 16:14:32 -0400 Subject: [PATCH] genesis svp --- genplus-gx32/core/mem68k.c | 20 ++++++++++++++++---- genplus-gx32/core/mem68k.h | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/genplus-gx32/core/mem68k.c b/genplus-gx32/core/mem68k.c index ed90a0ae2c..1fad7ecd1e 100644 --- a/genplus-gx32/core/mem68k.c +++ b/genplus-gx32/core/mem68k.c @@ -3,7 +3,7 @@ * Main 68k bus handlers * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -416,7 +416,19 @@ unsigned int ctrl_io_read_byte(unsigned int address) case 0x44: /* RADICA */ case 0x50: /* SVP */ { - return m68k_read_bus_8(address); + if ((address & 0xFC) == 0x00) + { + unsigned int data = svp->ssp1601.gr[SSP_XST].byte.h; + return (address & 1) ? (data & 0xFF) : (data >> 8); + } + + if ((address & 0xFE) == 0x04) + { + unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h; + svp->ssp1601.gr[SSP_PM0].byte.h &= ~1; + return (address & 1) ? (data & 0xFF) : (data >> 8); + } + return m68k_read_bus_8(address); } default: /* Invalid address */ @@ -532,12 +544,12 @@ unsigned int ctrl_io_read_word(unsigned int address) case 0x50: /* SVP */ { - if ((address & 0xFD) == 0) + if ((address & 0xFC) == 0x00) { return svp->ssp1601.gr[SSP_XST].byte.h; } - if ((address & 0xFF) == 4) + if ((address & 0xFE) == 0x04) { unsigned int data = svp->ssp1601.gr[SSP_PM0].byte.h; svp->ssp1601.gr[SSP_PM0].byte.h &= ~1; diff --git a/genplus-gx32/core/mem68k.h b/genplus-gx32/core/mem68k.h index 02087a9424..7f4ce37a9d 100644 --- a/genplus-gx32/core/mem68k.h +++ b/genplus-gx32/core/mem68k.h @@ -3,7 +3,7 @@ * Main 68k bus handlers * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) - * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: