diff options
-rw-r--r-- | ARM.cpp | 18 | ||||
-rw-r--r-- | ARM.h | 18 | ||||
-rw-r--r-- | ARMInterpreter.cpp | 18 | ||||
-rw-r--r-- | ARMInterpreter.h | 17 | ||||
-rw-r--r-- | ARMInterpreter_ALU.cpp | 18 | ||||
-rw-r--r-- | ARMInterpreter_ALU.h | 17 | ||||
-rw-r--r-- | ARMInterpreter_Branch.cpp | 18 | ||||
-rw-r--r-- | ARMInterpreter_Branch.h | 17 | ||||
-rw-r--r-- | ARMInterpreter_LoadStore.cpp | 18 | ||||
-rw-r--r-- | ARMInterpreter_LoadStore.h | 17 | ||||
-rw-r--r-- | ARM_InstrTable.h | 17 | ||||
-rw-r--r-- | CP15.cpp | 19 | ||||
-rw-r--r-- | CP15.h | 17 | ||||
-rw-r--r-- | GPU2D.cpp | 28 | ||||
-rw-r--r-- | GPU2D.h | 29 | ||||
-rw-r--r-- | NDS.cpp | 38 | ||||
-rw-r--r-- | NDS.h | 17 | ||||
-rw-r--r-- | SPI.cpp | 48 | ||||
-rw-r--r-- | SPI.h | 17 | ||||
-rw-r--r-- | main.cpp | 19 | ||||
-rw-r--r-- | melonDS.depend | 4 | ||||
-rw-r--r-- | types.h | 18 |
22 files changed, 443 insertions, 4 deletions
@@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "NDS.h" #include "ARM.h" @@ -1,4 +1,20 @@ -// ARM shit +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef ARM_H #define ARM_H diff --git a/ARMInterpreter.cpp b/ARMInterpreter.cpp index 82ab3d5..c400fd7 100644 --- a/ARMInterpreter.cpp +++ b/ARMInterpreter.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "NDS.h" #include "CP15.h" diff --git a/ARMInterpreter.h b/ARMInterpreter.h index 00a3f20..12005f3 100644 --- a/ARMInterpreter.h +++ b/ARMInterpreter.h @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef ARMINTERPRETER_H #define ARMINTERPRETER_H diff --git a/ARMInterpreter_ALU.cpp b/ARMInterpreter_ALU.cpp index 6555793..676ff5f 100644 --- a/ARMInterpreter_ALU.cpp +++ b/ARMInterpreter_ALU.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include "ARM.h" diff --git a/ARMInterpreter_ALU.h b/ARMInterpreter_ALU.h index d1195c3..1c6fe44 100644 --- a/ARMInterpreter_ALU.h +++ b/ARMInterpreter_ALU.h @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef ARMINTERPRETER_ALU_H #define ARMINTERPRETER_ALU_H diff --git a/ARMInterpreter_Branch.cpp b/ARMInterpreter_Branch.cpp index 354dad3..efaddd3 100644 --- a/ARMInterpreter_Branch.cpp +++ b/ARMInterpreter_Branch.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "ARM.h" diff --git a/ARMInterpreter_Branch.h b/ARMInterpreter_Branch.h index 3419286..6b7989a 100644 --- a/ARMInterpreter_Branch.h +++ b/ARMInterpreter_Branch.h @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef ARMINTERPRETER_BRANCH_H #define ARMINTERPRETER_BRANCH_H diff --git a/ARMInterpreter_LoadStore.cpp b/ARMInterpreter_LoadStore.cpp index c968920..165a2fe 100644 --- a/ARMInterpreter_LoadStore.cpp +++ b/ARMInterpreter_LoadStore.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "ARM.h" diff --git a/ARMInterpreter_LoadStore.h b/ARMInterpreter_LoadStore.h index 773d1ba..1c999a4 100644 --- a/ARMInterpreter_LoadStore.h +++ b/ARMInterpreter_LoadStore.h @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef ARMINTERPRETER_LOADSTORE_H #define ARMINTERPRETER_LOADSTORE_H diff --git a/ARM_InstrTable.h b/ARM_InstrTable.h index 98d40fc..e39703c 100644 --- a/ARM_InstrTable.h +++ b/ARM_InstrTable.h @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ INSTRFUNC_PROTO(ARMInstrTable[4096]) = { @@ -1,6 +1,25 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "NDS.h" + namespace CP15 { @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef CP15_H #define CP15_H diff --git a/GPU2D.cpp b/GPU2D.cpp new file mode 100644 index 0000000..8145101 --- /dev/null +++ b/GPU2D.cpp @@ -0,0 +1,28 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#include "NDS.h" +#include "GPU2D.h" + + +namespace GPU2D +{ + +// + +} @@ -0,0 +1,29 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + +#ifndef GPU2D_H +#define GPU2D_H + +namespace GPU2D +{ + +// shit here + +} + +#endif @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include <string.h> #include "NDS.h" @@ -422,6 +440,8 @@ u8 ARM9Read8(u32 addr) case 0x04000000: switch (addr) { + case 0x04000208: return IME[0]; + case 0x04000247: return WRAMCnt; } @@ -468,6 +488,8 @@ u16 ARM9Read16(u32 addr) case 0x0400010E: return Timers[3].Control; case 0x04000180: return IPCSync9; + + case 0x04000208: return IME[0]; } } @@ -557,6 +579,8 @@ void ARM9Write8(u32 addr, u8 val) case 0x04000000: switch (addr) { + case 0x04000208: IME[0] = val; return; + case 0x04000247: WRAMCnt = val; MapSharedWRAM(); @@ -613,6 +637,8 @@ void ARM9Write16(u32 addr, u16 val) } CompensateARM7(); return; + + case 0x04000208: IME[0] = val; return; } } @@ -699,6 +725,8 @@ u8 ARM7Read8(u32 addr) case 0x040001C2: return SPI::ReadData(); + case 0x04000208: return IME[1]; + case 0x04000241: return WRAMCnt; } @@ -739,11 +767,15 @@ u16 ARM7Read16(u32 addr) case 0x0400010C: return Timers[7].Counter; case 0x0400010E: return Timers[7].Control; + case 0x04000138: return 0; // RTC shit + case 0x04000180: return IPCSync7; case 0x040001C0: return SPI::ReadCnt(); case 0x040001C2: return SPI::ReadData(); + case 0x04000208: return IME[1]; + case 0x04000504: return _soundbias; } } @@ -827,6 +859,8 @@ void ARM7Write8(u32 addr, u8 val) case 0x040001C2: SPI::WriteData(val); return; + + case 0x04000208: IME[1] = val; return; } } @@ -875,6 +909,8 @@ void ARM7Write16(u32 addr, u16 val) case 0x0400010C: Timers[7].Reload = val; return; case 0x0400010E: TimerStart(7, val); return; + case 0x04000138: return; // RTC shit + case 0x04000180: IPCSync9 &= 0xFFF0; IPCSync9 |= ((val & 0x0F00) >> 8); @@ -894,6 +930,8 @@ void ARM7Write16(u32 addr, u16 val) SPI::WriteData(val & 0xFF); return; + case 0x04000208: IME[1] = val; return; + case 0x04000504: _soundbias = val & 0x3FF; return; @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef NDS_H #define NDS_H @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "NDS.h" #include "SPI.h" @@ -14,6 +32,7 @@ u8 CurCmd; u32 DataPos; u8 Data; +u8 StatusReg; u32 Addr; void Init() @@ -38,6 +57,7 @@ void Reset() Hold = 0; CurCmd = 0; Data = 0; + StatusReg = 0x00; } u8 Read() @@ -56,6 +76,7 @@ void Write(u8 val, u32 hold) { CurCmd = val; Hold = 1; + Data = 0; DataPos = 1; Addr = 0; printf("firmware SPI command %02X\n", CurCmd); @@ -88,6 +109,33 @@ void Write(u8 val, u32 hold) } break; + case 0x04: // write disable + StatusReg &= ~(1<<1); + Data = 0; + break; + + case 0x05: // read status reg + Data = StatusReg; + break; + + case 0x06: // write enable + StatusReg |= (1<<1); + Data = 0; + break; + + case 0x9F: // read JEDEC ID + { + switch (DataPos) + { + case 1: Data = 0x20; break; + case 2: Data = 0x40; break; + case 3: Data = 0x12; break; + default: Data = 0; break; + } + DataPos++; + } + break; + default: printf("unknown firmware SPI command %02X\n", CurCmd); break; @@ -1,3 +1,20 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef SPI_H #define SPI_H @@ -1,3 +1,21 @@ +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ + #include <stdio.h> #include "NDS.h" @@ -6,6 +24,7 @@ int main() { printf("melonDS version uh... 0.1??\n"); printf("it's a DS emulator!!!\n"); + printf("http://melonds.kuribo64.net/\n"); NDS::Init(); diff --git a/melonDS.depend b/melonDS.depend index c5e5ee3..a8a280b 100644 --- a/melonDS.depend +++ b/melonDS.depend @@ -55,7 +55,7 @@ 1480953933 c:\documents\sources\melonds\arminterpreter_loadstore.h -1480951014 source:c:\documents\sources\melonds\arminterpreter_loadstore.cpp +1480953916 source:c:\documents\sources\melonds\arminterpreter_loadstore.cpp <stdio.h> "ARM.h" @@ -67,7 +67,7 @@ 1480814622 c:\documents\sources\melonds\spi.h -1480816963 source:c:\documents\sources\melonds\spi.cpp +1480954747 source:c:\documents\sources\melonds\spi.cpp <stdio.h> "NDS.h" "SPI.h" @@ -1,4 +1,20 @@ -// types, common crap +/* + Copyright 2016-2017 StapleButter + + This file is part of melonDS. + + melonDS is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + melonDS is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with melonDS. If not, see http://www.gnu.org/licenses/. +*/ #ifndef TYPES_H #define TYPES_H |