WIP: Replace M68k core w/ Musashi 680x0

The entire point of this was that I eventually wanted to add a GDB stub
in the emulator so I can debug the VIA, and I didn't want to waste that
effort w/ a CPU core I wasn't planning on using. So, now, it's changed.
The system right now gets up to drawing the checkerboard background and,
supposedly, attempting to draw the blinking disk icon. Interrupts are
probably broken. Hard to tell.

Also, the new CPU core gives us the M68030 and M68040 and the FPU all
for *free*. So yeah, expect some SE/30 action coming soon. Ish.
This commit is contained in:
InvisibleUp 2020-07-16 22:26:28 -04:00
parent 62e3cdd929
commit 2b61dcd4f5
19 changed files with 58 additions and 28 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "src/tomlc99"]
path = src/tomlc99
url = https://github.com/cktan/tomlc99
[submodule "src/HW/M68K"]
path = src/HW/M68K
url = https://github.com/kstenerud/Musashi.git

View File

@ -75,10 +75,11 @@ HW_SRC = {
'src/HW/KBRD/KBRDEMDV.c',
],
'M68K': [
# 'src/HW/M68K/DISAM68K.c',
'src/HW/M68K/M68KITAB.c',
'src/HW/M68K/MINEM68K.c',
# 'src/HW/M68K/FPCPEMDV.c',
'src/HW/M68K/m68kcpu.c',
'src/HW/M68K/m68kdasm.c',
'src/HW/M68K/m68khooks.c',
'src/HW/M68K/m68kops.c',
'src/HW/M68K/softfloat/softfloat.c',
],
'MOUSE': [
'src/HW/MOUSE/MOUSEMDV.c',

View File

@ -38,6 +38,7 @@
#include "HW/RAM/RAMADDR.h"
#include "HW/VIA/VIAEMDEV.h"
#include "HW/SCC/SCCEMDEV.h"
#include "HW/M68K/m68k.h"
#include <stdio.h>
/*
@ -56,6 +57,7 @@ bool WantMagnify = (WantInitMagnify != 0);
bool RequestInsertDisk = false;
uint8_t RequestIthDisk = 0;
bool ControlKeyPressed = false;
ATTep HeadATTel = NULL;
IMPORTPROC m68k_reset(void);
@ -81,7 +83,7 @@ IMPORTFUNC uint32_t GetCyclesRemaining(void);
IMPORTPROC SetCyclesRemaining(uint32_t n);
IMPORTPROC SetHeadATTel(ATTep p);
IMPORTFUNC ATTep FindATTel(CPTR addr);
LOCALFUNC ATTep FindATTel(CPTR addr);
IMPORTFUNC uint32_t SCSI_Access(uint32_t Data, bool WriteMem, CPTR addr);
//IMPORTFUNC uint32_t SCC_Access(uint32_t Data, bool WriteMem, CPTR addr);
@ -645,10 +647,40 @@ LOCALPROC FinishATTList(void)
}
#endif
SetHeadATTel(h);
//SetHeadATTel(h);
HeadATTel = h;
}
}
LOCALFUNC ATTep FindATTel(CPTR addr)
{
ATTep prev;
ATTep p;
p = HeadATTel;
if ((addr & p->cmpmask) != p->cmpvalu) {
do {
prev = p;
p = p->Next;
} while ((addr & p->cmpmask) != p->cmpvalu);
/*{
ATTep next = p->Next;
if (nullpr == next) {
// don't move the end guard
} else {
// move to first
prev->Next = next;
p->Next = HeadATTel;
HeadATTel = p;
}
}*/
}
return p;
}
#if (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)
LOCALPROC SetUp_RAM24(void)
{
@ -1460,7 +1492,7 @@ GLOBALPROC Addr32_ChangeNtfy(void)
}
#endif
LOCALFUNC ATTep get_address_realblock1(bool WriteMem, CPTR addr)
ATTep get_address_realblock1(bool WriteMem, CPTR addr)
{
ATTep p;
@ -1470,6 +1502,8 @@ Label_Retry:
(WriteMem ? kATTA_writereadymask : kATTA_readreadymask)))
{
/* ok */
} else if (0 != (p->Access & kATTA_mmdvmask)) {
/* also ok */
} else {
if (0 != (p->Access & kATTA_ntfymask)) {
if (MemAccessNtfy(p)) {
@ -1482,7 +1516,7 @@ Label_Retry:
return p;
}
GLOBALFUNC uint8_t * get_real_address0(uint32_t L, bool WritableMem, CPTR addr,
uint8_t * get_real_address0(uint32_t L, bool WritableMem, CPTR addr,
uint32_t *actL)
{
uint32_t bankleft;
@ -1547,13 +1581,12 @@ GLOBALPROC VIAorSCCinterruptChngNtfy(void)
}
if (NewIPL != CurIPL) {
CurIPL = NewIPL;
m68k_IPLchangeNtfy();
m68k_set_irq(NewIPL);
}
}
GLOBALFUNC bool AddrSpac_Init(void)
{
MINEM68K_Init(&CurIPL);
return true;
}
@ -1630,13 +1663,13 @@ GLOBALVAR iCountt NextiCount = 0;
GLOBALFUNC iCountt GetCuriCount(void)
{
return NextiCount - GetCyclesRemaining();
return NextiCount - m68k_cycles_remaining();
}
GLOBALPROC ICT_add(int taskid, uint32_t n)
{
// n must be > 0
int32_t x = GetCyclesRemaining();
int32_t x = m68k_cycles_remaining();
uint32_t when = NextiCount - x + n;
#ifdef _VIA_Debug
@ -1645,7 +1678,7 @@ GLOBALPROC ICT_add(int taskid, uint32_t n)
InsertICT(taskid, when);
if (x > (int32_t)n) {
SetCyclesRemaining(n);
m68k_modify_timeslice(n);
NextiCount = when;
}
}

View File

@ -280,5 +280,7 @@ typedef ATTer *ATTep;
EXPORTFUNC uint32_t MMDV_Access(ATTep p, uint32_t Data,
bool WriteMem, bool ByteSize, CPTR addr);
EXPORTFUNC bool MemAccessNtfy(ATTep pT);
uint8_t * get_real_address0(uint32_t L, bool WritableMem, CPTR addr, uint32_t *actL);
ATTep get_address_realblock1(bool WriteMem, CPTR addr);
#endif

View File

@ -28,16 +28,13 @@
by Jesus A. Alvarez.
*/
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "UI/MYOSGLUE.h"
#include "UTIL/ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "HW/M68K/MINEM68K.h"
#endif
#include "HW/DISK/SONYEMDV.h"
#include "HW/M68K/m68k.h"
#include <stdio.h>
/*

1
src/HW/M68K Submodule

@ -0,0 +1 @@
Subproject commit 67346dba6d245d48ab362dfa1d2c18075f9fbcf1

View File

@ -29,7 +29,6 @@
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "HW/SCC/SCCEMDEV.h"
#include "HW/M68K/MINEM68K.h"
#include "HW/MOUSE/MOUSEMDV.h"
#include "HW/VIA/VIAEMDEV.h"

View File

@ -24,16 +24,12 @@
/* NCR5380 chip emulation by Yoav Shadmi, 1998 */
#ifndef AllFiles
#include "SYSDEPNS.h"
#include "UTIL/ENDIANAC.h"
#include "UI/MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "HW/M68K/MINEM68K.h"
#endif
#include "HW/SCSI/SCSIEMDV.h"
#define scsiRd 0x00

View File

@ -27,7 +27,6 @@
#include "UI/MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "HW/M68K/MINEM68K.h"
#include "HW/SOUND/SNDEMDEV.h"
#include "HW/VIA/VIAEMDEV.h"

View File

@ -26,8 +26,7 @@
#include "UI/MYOSGLUE.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "HW/M68K/M68KITAB.h"
#include "HW/M68K/MINEM68K.h"
#include "HW/M68K/m68k.h"
#include "HW/VIA/VIAEMDEV.h"
#include "HW/DISK/IWMEMDEV.h"
#include "HW/SCC/SCCEMDEV.h"
@ -153,8 +152,8 @@ const DevMethods_t DEVICES[] = {
},
// m68k
{
.init = NULL,
.reset = m68k_reset,
.init = m68k_init_mac,
.reset = m68k_pulse_reset,
.starttick = NULL,
.endtick = NULL,
.subtick = NULL,
@ -477,7 +476,7 @@ LOCALPROC m68k_go_nCycles_1(uint32_t n)
ICT_DoCurrentTasks();
n2 = ICT_DoGetNext(n);
NextiCount += n2;
m68k_go_nCycles(n2);
m68k_execute(n2 / 64); // TODO: verify scaler here
n = StopiCount - NextiCount;
} while (n != 0);
}