From 31aa9d536c8225ebe7550d35d702ace44609750c Mon Sep 17 00:00:00 2001 From: friol Date: Tue, 2 Apr 2024 07:18:17 +0200 Subject: [PATCH] Windows (one window), hirq --- apu.cpp | 23 + audioSystem.cpp | 30 +- debuggerSPC700.cpp | 2 + imgui.ini | 1854 +++++++++++++++++++++++++++++++++++++++++++- main.cpp | 9 +- mmu.cpp | 74 +- mmu.h | 15 + ppu.cpp | 196 +++-- ppu.h | 17 +- romLoader.cpp | 55 +- romLoader.h | 2 +- 11 files changed, 2204 insertions(+), 73 deletions(-) diff --git a/apu.cpp b/apu.cpp index 4adbf0c..da2f297 100644 --- a/apu.cpp +++ b/apu.cpp @@ -3473,6 +3473,29 @@ int apu::stepOne() cycles = doBranch(offs, !flagV); break; } + case 0xf9: + { + // MOV X,d+Y + doMoveToX(&apu::addrDPY); + regPC += 2; + cycles = 4; + break; + } + case 0x39: + { + // AND (X),(Y) + unsigned char src = (this->*read8)(regY | ((flagP?1:0) << 8)); + unsigned char dst= (this->*read8)(regX | ((flagP ? 1 : 0) << 8)); + + dst &= src; + doFlagsNZ(dst); + + (this->*write8)(regX | ((flagP ? 1 : 0) << 8), dst); + + regPC += 1; + cycles = 5; + break; + } default: { // unknown opcode diff --git a/audioSystem.cpp b/audioSystem.cpp index d86f9b3..8f6c411 100644 --- a/audioSystem.cpp +++ b/audioSystem.cpp @@ -4,6 +4,7 @@ extern logger glbTheLogger; static std::deque audioQueue; +static bool audioSemaphore = false; // @@ -14,9 +15,14 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use float* paudioInc = (float*)user; + audioSemaphore = true; const unsigned int avsize = (unsigned int)audioQueue.size(); - if (length == 0) return 0; + if (length == 0) + { + audioSemaphore = false; + return 0; + } if (avsize < 2) { @@ -25,6 +31,7 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use buffer[pos] = 0; } + audioSemaphore = false; return length; } @@ -34,14 +41,23 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use if (nsamplesAva > 15000) (*paudioInc) -= 0.001f; else (*paudioInc) += 0.001f; - + + if ((audioQueue.size() % 2) != 0) + { + glbTheLogger.logMsg("error: audio queue is not even (size"+std::to_string(audioQueue.size())+" )"); + } + for (unsigned int pos = 0;pos < length / sizeof(float);pos += 2) { if (audioQueue.size()>=2) { - buffer[pos] = audioQueue[0]; + float s0= audioQueue[0]; + float s1= audioQueue[1]; + + buffer[pos] = s0; + buffer[pos + 1] =s1; + audioQueue.pop_front(); - buffer[pos + 1] = audioQueue[0]; audioQueue.pop_front(); } else @@ -52,6 +68,7 @@ DWORD CALLBACK StreamProc(HSTREAM handle, float* buffer, DWORD length, void* use } } + audioSemaphore = false; return length; } @@ -87,6 +104,11 @@ audioSystem::audioSystem() void audioSystem::feedAudiobuf(float l, float r) { + if (audioSemaphore) + { + Sleep(1); + } + audioQueue.push_back(l); audioQueue.push_back(r); } diff --git a/debuggerSPC700.cpp b/debuggerSPC700.cpp index 78a1bdf..5238531 100644 --- a/debuggerSPC700.cpp +++ b/debuggerSPC700.cpp @@ -232,6 +232,8 @@ dbgSPC700info listOfInstrs[] {0x4f,"PCALL $param0",2,1,true}, // validatedFC {0xd9,"MOV $param0+Y,X",2,1,true}, // validatedFC {0x50,"BVC $param0",2,1,true}, // validatedFC + {0xf9,"MOV X,$param0+Y",2,1,true}, // validatedFC + {0x39,"AND (X),(Y)",1,0,true}, // validatedFC }; diff --git a/imgui.ini b/imgui.ini index 8a6a088..a58771d 100644 --- a/imgui.ini +++ b/imgui.ini @@ -65,7 +65,7 @@ Size=528,154 Collapsed=1 [Window][SNES TV Output] -Pos=481,84 +Pos=479,83 Size=535,489 [Window][Memory viewer] @@ -2377,6 +2377,1858 @@ Size=700,450 Pos=402,155 Size=700,450 +[Window][Load SNES ROM##filebrowser_958758302704] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_676040912480] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_514625220144] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_995299274816] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_420159795936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_558986737056] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_69274022080] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_461919596272] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_101331874352] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_610788029424] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1089430400528] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_131252138016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_812949287520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_481677391024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_687485070944] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_857545944624] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_535326208352] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_344198067680] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_299610518016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1047314805616] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_278826430864] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_183326258384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_658538345824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_204996390480] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_690483999760] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_289272608080] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_50156647120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_65423651744] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_109465939696] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_477493702448] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1001942527968] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_321700737296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_584181657328] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1035744424608] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_927181156608] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_233171170000] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_99241276752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_280244302704] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1033718576240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_224251784736] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_832236795136] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_546195943904] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_965081478432] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_474540257376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_942247228544] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_893551620016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_613495599472] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_939604831440] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_323674172784] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_794819555792] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_498169932528] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_852835349696] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1034196726384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1044395177152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_841096148240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1065075191696] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_150310072464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_730569552800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_62605602864] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_248081395808] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_263052964384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_113958761552] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_33969517840] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_873693295792] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_935199092464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_717874900960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1060128009840] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_634668299136] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_805351306016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_380527030800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_751695671088] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_322020881104] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1002324210304] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_865459875744] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_41203643040] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_674732290864] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_553259610080] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_413139842096] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_979540817008] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_792808763632] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_85627613888] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_949272555776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_465402965648] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_885735288720] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_687402038464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_502548247520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_874408424464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_137983013248] +Pos=402,163 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_233743168224] +Pos=389,186 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1057292661600] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_989248795584] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_949681501488] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_645191807424] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_511249724224] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_519709766144] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_657615400688] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_380676649376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_259829839312] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_343733548496] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_432565759504] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_627286519488] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_991565819552] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1051496133200] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_422145667008] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_512239448832] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1057949856688] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_79258694880] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_861620450000] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_861590630416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_322926653376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_554070552064] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_366753394960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_5049004224] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_102076232128] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1042635666848] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_457729683440] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_809438851408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_147970504016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1086955448912] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_221107972848] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_583516810960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_101057556256] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_263426928768] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_300527120256] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1079983992928] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_770961238640] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_933747486208] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_355758174176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_115904344368] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_532134489776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_632573455456] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_139403652544] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_656361385008] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_253947670928] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_753050708640] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1046681611008] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_64463155680] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_376630981712] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_339975450416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_681533353520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_473999193184] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_115498004112] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_179634549536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_349313020560] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_159903495360] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_534292312512] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_70901871296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_636360896688] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_431620470128] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1055816265536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1096706535728] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_352121105984] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_436699246048] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_922819277776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_678547009280] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_305765856560] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_337076138160] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_615802711856] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_217112751984] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1017404830752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_4295864704] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_732890903776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_255533231824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_765446697216] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_946337264416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_752860050000] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_780037450624] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_282518874768] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_863323155776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_814283681904] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_624837979024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_556744567392] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_414297616576] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_474282454272] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_780917534416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_479572126672] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_323620958480] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_668480827504] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_340005859216] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_499576059296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_344963986752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_374850303104] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_596579823680] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_207409360784] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1096411296432] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_590984623520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_736806940464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_41799759104] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_363022102768] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_358104281936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_722620755824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_275412397824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_866653156112] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_666425994992] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_341960536384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_726884987600] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_394106221232] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_14458992016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_994254368416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_516162434240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_930714857376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_247672451472] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_57205109536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_712055827936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_735063880240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_87217254640] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1091424333920] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_54108075456] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_981824549216] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_189812027088] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1068947058656] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_175954521808] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_838809874800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_253410652368] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_523548800112] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_465402967488] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_464211784528] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_284798857408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_534124541120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_993488907776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_354168976512] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_344057818752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_672417624544] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_419865408448] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_996654363088] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_212025062096] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_221548752608] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_498569425232] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_455856730800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_89439057184] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_213683908464] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_770523903232] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_161729786112] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_417682600800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1030394982912] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_554945065520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_912761664528] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1067480953968] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_671693518000] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_778071553152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_685861876400] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_292265178512] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_573620662560] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_347763225120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_969073866128] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_922678571824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1091776130928] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_998756955456] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_899792744272] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_328463135712] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1094289241536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_7185740368] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_681068638064] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_429447295952] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_917993533504] +Pos=554,136 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_206227091760] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_809894064336] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_626896253440] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_969791092016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_354119691920] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_61172724016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_921596440720] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_567861621920] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_38379564656] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_264594633408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_179167342272] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1047812354304] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_634725118176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_532832695376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_659685224400] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_12204224752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_835434950720] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_119020695872] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_874692260336] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_822112400192] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_26643182816] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_691342716528] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1087378403600] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_93003297632] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_996576113152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_764952163776] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_904164912960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_909957247536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_140321337920] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_399546101440] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_139241304944] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_149748037024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_343890768656] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_618727846928] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_435988311856] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_142068527536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_973021098960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_625830901120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_15929618912] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_332031308240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_255354320096] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_501811621408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_53270655344] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_161991210064] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_116387197424] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_680573251760] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_219822666240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_72661069728] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_102735014688] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_687781507456] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_612071632880] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_446146917104] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_133755417696] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_228347195024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_170535990336] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1082315879680] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1059834933840] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_776266363952] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_724214722976] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_841553063408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1028677023152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_338100467072] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_54216666784] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_650359190800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_756663825520] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1022557532080] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_862374966672] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_380457824960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_814761489376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_418925884416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_133312656400] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_478394822624] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_636520477008] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_700755850064] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_450031825072] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_959153025040] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_413123064288] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_220607197488] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_358343749936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_947307853200] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_457199236352] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_612944622720] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_911956227296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_989398085312] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_412342922848] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_4972065936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_644946441040] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_120857669744] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_378411004752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_110858843216] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_601327776624] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_596586181376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_78845554416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_446141084176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_876224558384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_384011449376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_813693777296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_129704047888] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_569956938560] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_350401442416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_189405180096] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_816189387376] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_84791571344] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_529657869248] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_246483366544] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1046430069104] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_34434035184] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_889480917280] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_891118661728] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_474769240832] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1059646321120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_385072279888] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_289760785088] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_237586132608] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_628718874624] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1025024374224] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_721868598960] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_852646605248] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_741959053456] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_923215441728] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_655079878752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_685541011840] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_909848194976] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_404484896176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1056715944512] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_955868098384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_661773988416] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_944594791968] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_90591572144] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1094648181952] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_570906883328] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_860818878240] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_848907055184] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_444255548288] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_343691211744] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_465759482688] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_895145455552] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_424055845888] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_856381306272] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_966204961120] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_953240825584] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_909708603760] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_656391189264] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_763930719328] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_751767827792] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_356225234176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_46323315392] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_977509069984] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_546271311296] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_154840248352] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_334725624304] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_188362960736] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_486555038176] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_339404041856] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_824798588816] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_465073714112] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_303848862912] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_912243143024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_380401724896] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1061092701328] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_709647773952] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_202781734016] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_80055481792] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_294716682192] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_105093378880] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_664413254944] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1068623573888] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_929559328192] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_611232625472] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_126020859248] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_662955536800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1052345479024] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_595813052400] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_85068328592] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_656418911600] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_359666660000] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_161874555536] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_891399548912] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_404008841952] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_863459194256] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_377733624944] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_81664847440] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_38230668448] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_511697596256] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_358586823040] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_827740499824] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_593407553408] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_416786985664] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_913675825152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_245109732448] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_902610923264] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_737227420800] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_149238429072] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1004633175488] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_161485796672] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_1045762519216] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_401158812384] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_446658621264] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_695117132752] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_470752801472] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_769768927392] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_273251610224] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_197399523936] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_678180925808] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_590246883248] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_939737133152] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_898409214048] +Pos=402,155 +Size=700,450 + +[Window][Load SNES ROM##filebrowser_129953083904] +Pos=402,155 +Size=700,450 + [Table][0x64418101,3] RefScale=13 Column 0 Width=63 diff --git a/main.cpp b/main.cpp index 00c9705..735a925 100644 --- a/main.cpp +++ b/main.cpp @@ -698,14 +698,19 @@ void displayAppoWindow(cpu5a22& theCPU,ppu& thePPU, mmu& ourMMU, debugger5a22& t fileDialog.SetTitle("Load SNES ROM"); fileDialog.SetTypeFilters({ ".smc", ".sfc" }); //fileDialog.SetPwd("d:\\prova\\snes\\"); - //fileDialog.SetPwd("D:\\prova\\snes\\SNES-master\\SPC700\\PlayBRRSample\\"); + //fileDialog.SetPwd("d:\\prova\\"); fileDialog.SetPwd("D:\\romz\\nintendo\\snes\\USA\\"); + + if (emustatus == -1) + { + fileDialog.Open(); + } int pushedColors = 1; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(ImColor(0.6f,0.1f,0.1f))); if (ImGui::Button("Load rom!")) { - fileDialog.Open(); + //fileDialog.Open(); } ImGui::SameLine(); ImGui::PopStyleColor(pushedColors); diff --git a/mmu.cpp b/mmu.cpp index 9428f88..b9f6c60 100644 --- a/mmu.cpp +++ b/mmu.cpp @@ -381,8 +381,7 @@ void mmu::executeHDMA() void mmu::write8(unsigned int address, unsigned char val) { - //std::stringstream strr; - //strr << std::hex << std::setw(2) << std::setfill('0') << (int)val; + pPPU->openBus = val; unsigned char bank_nr = (unsigned char)(address >> 16); unsigned short int adr = address & 0xffff; @@ -434,6 +433,7 @@ void mmu::write8(unsigned int address, unsigned char val) //glbTheLogger.logMsg("Writing [" + std::to_string(val) + "] to 0x4200 (NMITIMEN - Interrupt Enable and Joypad Request)"); nmiTimen = val; vIrqEnabled= val & 0x20; + hIrqEnabled= val & 0x10; return; } else if (adr == 0x2180) @@ -454,6 +454,16 @@ void mmu::write8(unsigned int address, unsigned char val) wram281x[byte] = val; return; } + else if (adr == 0x4207) + { + hIrqTimer = (hIrqTimer & 0x100) | val; + return; + } + else if (adr == 0x4208) + { + hIrqTimer = (hIrqTimer & 0x0ff) | ((val & 1) << 8); + return; + } else if (adr == 0x4209) { vIrqTimer = (vIrqTimer & 0x100) | val; @@ -511,6 +521,48 @@ void mmu::write8(unsigned int address, unsigned char val) cgramAddress = (cgramAddress + 1) & (0x200 - 1); return; } + else if (adr == 0x2123) + { + // Enable (ABCD) and Invert (abcd) windows for BG1 (AB) and BG2 (CD) + pPPU->writeRegister(0x2123, val); + return; + } + else if (adr == 0x2124) + { + // Enable (EFGH) and Invert (efgh) windows for BG3 (EF) and BG2 (GH) + pPPU->writeRegister(0x2124, val); + return; + } + else if (adr == 0x2126) + { + // window 1 left position + pPPU->writeRegister(0x2126, val); + return; + } + else if (adr == 0x2127) + { + // window 1 right position + pPPU->writeRegister(0x2127, val); + return; + } + else if (adr == 0x2128) + { + // window 2 left position + pPPU->writeRegister(0x2128, val); + return; + } + else if (adr == 0x2129) + { + // window 2 right position + pPPU->writeRegister(0x2129, val); + return; + } + else if (adr == 0x212e) + { + // main screen layer window enable + pPPU->writeRegister(0x212e, val); + return; + } else if (adr == 0x212d) { // write to sub screen designation @@ -731,7 +783,8 @@ unsigned char mmu::read8(unsigned int address) { // 2137h - SLHV - Latch H/V-Counter by Software (R) // TODO - return 0x21; + //return 0x21; + return (unsigned char)(rand() % 256); } else if (adr == 0x2138) { @@ -758,6 +811,12 @@ unsigned char mmu::read8(unsigned int address) cgramAddress = (cgramAddress + 1) & (0x200 - 1); return openbus; } + else if (adr == 0x213c) + { + /* Horizontal counter data by ext/soft latch */ + // TODO + return (unsigned char)(rand()%256); + } else if (adr == 0x213d) { // 213Dh - OPVCT - Vertical Counter Latch (R) @@ -801,10 +860,9 @@ unsigned char mmu::read8(unsigned int address) else if (adr == 0x4211) { // PPU Interrupts - H/V-Timer IRQ Flag (R) [Read/Ack] - TODO - unsigned char val = (vIrqEnabled && irqTriggered) << 7; + unsigned char val = ((vIrqEnabled||hIrqEnabled) && irqTriggered) << 7; irqTriggered = false; - return val;// | (snes->openBus & 0x7f); - //return val | ((256*rand()) & 0x7f); + return val | (pPPU->openBus & 0x7f); } else if (adr == 0x4212) { @@ -899,6 +957,10 @@ unsigned char mmu::read8(unsigned int address) //4217h - RDMPYH - Unsigned Division Remainder / Multiply Product(up.8bit) (R) return snesRAM[adr]; } + else if (adr >= 0x2100 && adr < 0x2200) + { + return pPPU->openBus; + } else if (isHiRom && ((bank_nr >= 0x30) && (bank_nr < 0x3f)) && hasSRAM) { // SRAM diff --git a/mmu.h b/mmu.h index fc9cc7f..4f97ade 100644 --- a/mmu.h +++ b/mmu.h @@ -51,8 +51,13 @@ class mmu: public genericMMU bool nmiFlag = false; unsigned char nmiTimen = 0; + bool vIrqEnabled = false; unsigned short int vIrqTimer = 0; + + bool hIrqEnabled = false; + unsigned short int hIrqTimer = 0; + bool irqTriggered = false; int isHiRom = false; @@ -97,6 +102,16 @@ class mmu: public genericMMU bool isVIRQEnabled() { return vIrqEnabled; } unsigned short int getVIRQScanline() { return vIrqTimer; } + + bool isHIRQEnabled() + { + return hIrqEnabled; + } + unsigned short int getHIRQPos() + { + return hIrqTimer; + } + void setIrqTriggered() { irqTriggered = true; } void resetHDMA(); diff --git a/ppu.cpp b/ppu.cpp index 51f4c0f..5b98835 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -237,6 +237,34 @@ void ppu::writeRegister(int reg, unsigned char val) // Register $2121 : Address for accessing CGRAM(1b / W) cgramIdx = ((int)val) * 2; } + else if (reg == 0x2123) + { + w12sel = val; + } + else if (reg == 0x2124) + { + w34sel = val; + } + else if (reg == 0x2126) + { + windowxpos[0][0] = val; + } + else if (reg == 0x2127) + { + windowxpos[0][1] = val; + } + else if (reg == 0x2128) + { + windowxpos[1][0] = val; + } + else if (reg == 0x2129) + { + windowxpos[1][1] = val; + } + else if (reg == 0x212e) + { + windowTMW = val; + } else if (reg == 0x2122) { // Register $2122: Data write to CGRAM (1b/W) @@ -734,48 +762,42 @@ void ppu::renderTileScanline(int bpp, int px, int py, int tileNum, int palId, in if (bpp == 2) { - if ((((curCol % 4) != 0) && ((theX >= 0) && (theX < (signed int)ppuResolutionX)))) + if ((curCol % 4) != 0) { - //*pBgColorAppo = palArr[(curCol * 3) + 0]; pBgColorAppo++; - //*pBgColorAppo = palArr[(curCol * 3) + 1]; pBgColorAppo++; - //*pBgColorAppo = palArr[(curCol * 3) + 2]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((colidx>>1)+curCol) * 3) + 0]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((colidx >> 1) + curCol) * 3) + 1]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((colidx >> 1) + curCol) * 3) + 2]; pBgColorAppo++; - *pBgColorAppo = 0xff; pBgColorAppo++; - *pBgPriAppo = bgpri; pBgPriAppo++; - *pBgIsTranspAppo = false; pBgIsTranspAppo++; + *pBgColorAppo = 0xff; + *pBgPriAppo = bgpri; + *pBgIsTranspAppo = false; } else { //pBuf += 4; pBgColorAppo += 4; - *pBgPriAppo = bgpri; pBgPriAppo++; - *pBgIsTranspAppo = true; pBgIsTranspAppo++; + *pBgPriAppo = bgpri; + *pBgIsTranspAppo = true; } } else if (bpp == 4) { - if ((((curCol % 16) != 0) && ((theX >= 0) && (theX < (signed int)ppuResolutionX)))) + if ((curCol % 16) != 0) { - //*pBgColorAppo = palArr[(curCol * 3) + 0]; pBgColorAppo++; - //*pBgColorAppo = palArr[(curCol * 3) + 1]; pBgColorAppo++; - //*pBgColorAppo = palArr[(curCol * 3) + 2]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((palId * numCols)+curCol) * 3) + 0]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((palId * numCols)+ curCol) * 3) + 1]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(((palId * numCols)+ curCol) * 3) + 2]; pBgColorAppo++; - *pBgColorAppo = 0xff; pBgColorAppo++; - *pBgPriAppo = bgpri; pBgPriAppo++; - *pBgIsTranspAppo = false; pBgIsTranspAppo++; + *pBgColorAppo = 0xff; + *pBgPriAppo = bgpri; + *pBgIsTranspAppo = false; } else { //pBuf += 4; pBgColorAppo += 4; - *pBgPriAppo = bgpri; pBgPriAppo++; - *pBgIsTranspAppo = true; pBgIsTranspAppo++; + *pBgPriAppo = bgpri; + *pBgIsTranspAppo = true; } } else @@ -783,9 +805,9 @@ void ppu::renderTileScanline(int bpp, int px, int py, int tileNum, int palId, in *pBgColorAppo = palarrLookup[(curCol * 3) + 0]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(curCol * 3) + 1]; pBgColorAppo++; *pBgColorAppo = palarrLookup[(curCol * 3) + 2]; pBgColorAppo++; - *pBgColorAppo = 0xff; pBgColorAppo++; - *pBgPriAppo = bgpri; pBgPriAppo++; - *pBgIsTranspAppo = false; pBgIsTranspAppo++; + *pBgColorAppo = 0xff; + *pBgPriAppo = bgpri; + *pBgIsTranspAppo = false; } } } @@ -1028,11 +1050,11 @@ void ppu::renderBGScanline(int bgnum, int bpp, int scanlinenum) if ((bgSize == 0) || (bgSize == 2)) anderx = 0x1f; unsigned short int vramWord = tilemapMap[realy & andery][realx & anderx]; - int tileNum = vramWord & 0x3ff; - int palId = (vramWord >> 10) & 0x7; - unsigned char bgPri = (vramWord >> 13) & 0x01; - int xflip = (vramWord >> 14) & 0x01; - int yflip = (vramWord >> 15) & 0x01; + const int tileNum = vramWord & 0x3ff; + const int palId = (vramWord >> 10) & 0x7; + const unsigned char bgPri = (vramWord >> 13) & 0x01; + const int xflip = (vramWord >> 14) & 0x01; + const int yflip = (vramWord >> 15) & 0x01; if (tileDim == 8) { @@ -1185,35 +1207,42 @@ void ppu::renderSpritesScanline(int scanlinenum) void ppu::resetAppoBuffers() { - memset(bgPriorityAppo, 0, 256); - memset(objColorAppo, 0, 1024); + /*memset(objColorAppo, 0, 1024); memset(objIsTransparentAppo, true, 256); + memset(bgIsTransparentAppo[0], true, 256); memset(bgIsTransparentAppo[1], true, 256); memset(bgIsTransparentAppo[2], true, 256); memset(bgIsTransparentAppo[3], true, 256); + memset(bgPriorityAppo[0], 0, 256); memset(bgPriorityAppo[1], 0, 256); memset(bgPriorityAppo[2], 0, 256); memset(bgPriorityAppo[3], 0, 256); + memset(bgColorAppo[0], 0, 1024); memset(bgColorAppo[1], 0, 1024); memset(bgColorAppo[2], 0, 1024); - memset(bgColorAppo[3], 0, 1024); - - //for (int x = 0;x < 256;x++) - //{ - //bgPriorityAppo[0][x] = 0; bgPriorityAppo[1][x] = 0; bgPriorityAppo[2][x] = 0; bgPriorityAppo[3][x] = 0; - //bgIsTransparentAppo[0][x] = true; bgIsTransparentAppo[1][x] = true; bgIsTransparentAppo[2][x] = true; bgIsTransparentAppo[3][x] = true; - //bgColorAppo[0][(x * 4) + 0] = 0; bgColorAppo[0][(x * 4) + 1] = 0; bgColorAppo[0][(x * 4) + 2] = 0; bgColorAppo[0][(x * 4) + 3] = 0; - //bgColorAppo[1][(x * 4) + 0] = 0; bgColorAppo[1][(x * 4) + 1] = 0; bgColorAppo[1][(x * 4) + 2] = 0; bgColorAppo[1][(x * 4) + 3] = 0; - //bgColorAppo[2][(x * 4) + 0] = 0; bgColorAppo[2][(x * 4) + 1] = 0; bgColorAppo[2][(x * 4) + 2] = 0; bgColorAppo[2][(x * 4) + 3] = 0; - //bgColorAppo[3][(x * 4) + 0] = 0; bgColorAppo[3][(x * 4) + 1] = 0; bgColorAppo[3][(x * 4) + 2] = 0; bgColorAppo[3][(x * 4) + 3] = 0; - - //objColorAppo[(x * 4) + 0] = 0; objColorAppo[(x * 4) + 1] = 0; objColorAppo[(x * 4) + 2] = 0; objColorAppo[(x * 4) + 3] = 0; - //objPriorityAppo[x] = 0; - //objIsTransparentAppo[x] = true; - //} + memset(bgColorAppo[3], 0, 1024);*/ + + for (unsigned int x = 0;x < 256;x++) + { + bgPriorityAppo[0][x] = 2; + bgPriorityAppo[1][x] = 2; + bgPriorityAppo[2][x] = 2; + bgPriorityAppo[3][x] = 2; + + bgIsTransparentAppo[0][x] = true; bgIsTransparentAppo[1][x] = true; bgIsTransparentAppo[2][x] = true; bgIsTransparentAppo[3][x] = true; + + bgColorAppo[0][(x * 4) + 0] = 0; bgColorAppo[0][(x * 4) + 1] = 0; bgColorAppo[0][(x * 4) + 2] = 0; bgColorAppo[0][(x * 4) + 3] = 0; + bgColorAppo[1][(x * 4) + 0] = 0; bgColorAppo[1][(x * 4) + 1] = 0; bgColorAppo[1][(x * 4) + 2] = 0; bgColorAppo[1][(x * 4) + 3] = 0; + bgColorAppo[2][(x * 4) + 0] = 0; bgColorAppo[2][(x * 4) + 1] = 0; bgColorAppo[2][(x * 4) + 2] = 0; bgColorAppo[2][(x * 4) + 3] = 0; + bgColorAppo[3][(x * 4) + 0] = 0; bgColorAppo[3][(x * 4) + 1] = 0; bgColorAppo[3][(x * 4) + 2] = 0; bgColorAppo[3][(x * 4) + 3] = 0; + + objColorAppo[(x * 4) + 0] = 0; objColorAppo[(x * 4) + 1] = 0; objColorAppo[(x * 4) + 2] = 0; objColorAppo[(x * 4) + 3] = 0; + objPriorityAppo[x] = 0; + objIsTransparentAppo[x] = true; + } } /* this fantastic code comes from https://github.com/angelo-wf/LakeSnes */ @@ -1283,6 +1312,57 @@ void ppu::renderMode7Scanline(int scanlinenum) } } +int ppu::applyWindow(int x, int finalCol) +{ + if (!(windowTMW & 0x0f)) return finalCol; + //if ((!(w12sel & 0x02)) && (!(w12sel & 0x20)) && (!(w34sel & 0x02)) && (!(w34sel & 0x20))) return finalCol; + + bool invert1[4] = { false,false,false,false }; + + if ((w12sel & 0x03)==0x03) invert1[0] = true; + if ((w12sel & 0x30)==0x30) invert1[1] = true; + if ((w34sel & 0x03)==0x03) invert1[2] = true; + if ((w34sel & 0x30)==0x30) invert1[3] = true; + + if (invert1[0] && ((x < windowxpos[0][0]) || (x > windowxpos[0][1]))) + { + if (w12sel & 0x02) bgIsTransparentAppo[0][x] = true; + } + if ((!invert1[0]) && ((x >= windowxpos[0][0]) && (x <= windowxpos[0][1]))) + { + if (w12sel & 0x02) bgIsTransparentAppo[0][x] = true; + } + + if (invert1[1] && ((x < windowxpos[0][0]) || (x > windowxpos[0][1]))) + { + if (w12sel & 0x20) bgIsTransparentAppo[1][x] = true; + } + if ((!invert1[1]) && ((x >= windowxpos[0][0]) && (x <= windowxpos[0][1]))) + { + if (w12sel & 0x20) bgIsTransparentAppo[1][x] = true; + } + + if (invert1[2] && ((x < windowxpos[0][0]) || (x > windowxpos[0][1]))) + { + if (w34sel & 0x02) bgIsTransparentAppo[2][x] = true; + } + if ((!invert1[2]) && ((x >= windowxpos[0][0]) && (x <= windowxpos[0][1]))) + { + if (w34sel & 0x02) bgIsTransparentAppo[2][x] = true; + } + + if (invert1[3] && ((x < windowxpos[0][0]) || (x > windowxpos[0][1]))) + { + if (w34sel & 0x20) bgIsTransparentAppo[3][x] = true; + } + if ((!invert1[3]) && ((x >= windowxpos[0][0]) && (x <= windowxpos[0][1]))) + { + if (w34sel & 0x20) bgIsTransparentAppo[3][x] = true; + } + + return finalCol; +} + void ppu::renderScanline(int scanlinenum) { if ((scanlinenum < 0) || (scanlinenum >= 223)) return; @@ -1330,6 +1410,8 @@ void ppu::renderScanline(int scanlinenum) { int finalCol = -1; + applyWindow(x, finalCol); + if (objPriorityAppo[x] == 3 && (!objIsTransparentAppo[x])) finalCol = 4; else if ((bgPriorityAppo[0][x] == 1) && (!bgIsTransparentAppo[0][x])) finalCol = 0; else if ((bgPriorityAppo[1][x] == 1) && (!bgIsTransparentAppo[1][x])) finalCol = 1; @@ -1345,10 +1427,6 @@ void ppu::renderScanline(int scanlinenum) if (finalCol == -1) { - //unsigned int backdropColor = (((int)(cgram[1] & 0x7f)) << 8) | cgram[0]; - //unsigned char red = backdropColor & 0x1f; red <<= 3; - //unsigned char green = (backdropColor >> 5) & 0x1f; green <<= 3; - //unsigned char blue = (backdropColor >> 10) & 0x1f; blue <<= 3; *pfbuf = palarrLookup[0]; pfbuf++; *pfbuf = palarrLookup[1]; pfbuf++; *pfbuf = palarrLookup[2]; pfbuf++; @@ -1373,9 +1451,9 @@ void ppu::renderScanline(int scanlinenum) else if (screenMode == 0x01) { // 1 16-color 16-color 4-color - ;Normal - if ((((mainScreenDesignation & 0x1f) & (1 << 0)) > 0) ) renderBGScanline(0, 4, scanlinenum+1); + if ((((mainScreenDesignation & 0x1f) & (1 << 2)) > 0)) renderBGScanline(2, 2, scanlinenum + 1); if ( (((mainScreenDesignation & 0x1f) & (1 << 1)) > 0) || (((subScreenDesignation & 0x1f) & (1 << 1))) ) renderBGScanline(1, 4, scanlinenum+1); - if ((((mainScreenDesignation & 0x1f) & (1 << 2)) > 0)) renderBGScanline(2, 2, scanlinenum+1); + if ((((mainScreenDesignation & 0x1f) & (1 << 0)) > 0)) renderBGScanline(0, 4, scanlinenum + 1); if (mainScreenDesignation & 0x10) { @@ -1388,6 +1466,8 @@ void ppu::renderScanline(int scanlinenum) { int finalCol=-1; + applyWindow(x, finalCol); + if ((bgPriorityAppo[2][x] == 1) && bg3_priority && (!bgIsTransparentAppo[2][x])) finalCol = 2; else if (objPriorityAppo[x] == 3 && (!objIsTransparentAppo[x])) finalCol =4; else if ((bgPriorityAppo[0][x] == 1) && (!bgIsTransparentAppo[0][x])) finalCol=0; @@ -1398,7 +1478,8 @@ void ppu::renderScanline(int scanlinenum) else if (objPriorityAppo[x] == 1 && (!objIsTransparentAppo[x])) finalCol = 4; else if ((bgPriorityAppo[2][x] == 1) && (!bg3_priority) && (!bgIsTransparentAppo[2][x])) finalCol = 2; else if (objPriorityAppo[x] == 0 && (!objIsTransparentAppo[x])) finalCol = 4; - else if ((bgPriorityAppo[2][x] == 0) && (!bgIsTransparentAppo[2][x])) finalCol = 2; + else if ((bgPriorityAppo[2][x] == 0) && bg3_priority && (!bgIsTransparentAppo[2][x])) finalCol = 2; + else if ((bgPriorityAppo[2][x] == 0) && (!bg3_priority) && (!bgIsTransparentAppo[2][x])) finalCol = 2; if (finalCol == -1) { @@ -1450,6 +1531,8 @@ void ppu::renderScanline(int scanlinenum) { int finalCol = -1; + applyWindow(x, finalCol); + if (objPriorityAppo[x] == 3 && (!objIsTransparentAppo[x])) finalCol = 4; else if ((bgPriorityAppo[0][x] == 1) && (!bgIsTransparentAppo[0][x])) finalCol = 0; else if (objPriorityAppo[x] == 2 && (!objIsTransparentAppo[x])) finalCol = 4; @@ -1504,6 +1587,8 @@ void ppu::renderScanline(int scanlinenum) { int finalCol = -1; + applyWindow(x, finalCol); + if (objPriorityAppo[x] == 3 && (!objIsTransparentAppo[x])) finalCol = 4; else if ((bgPriorityAppo[0][x] == 1) && (!bgIsTransparentAppo[0][x])) finalCol = 0; else if (objPriorityAppo[x] == 2 && (!objIsTransparentAppo[x])) finalCol = 4; @@ -1555,6 +1640,8 @@ void ppu::renderScanline(int scanlinenum) { int finalCol = -1; + applyWindow(x, finalCol); + if (objPriorityAppo[x] == 3 && (!objIsTransparentAppo[x])) finalCol = 4; else if ((bgPriorityAppo[0][x] == 1) && (!bgIsTransparentAppo[0][x])) finalCol = 0; else if (objPriorityAppo[x] == 2 && (!objIsTransparentAppo[x])) finalCol = 4; @@ -1636,6 +1723,15 @@ void ppu::renderScanline(int scanlinenum) void ppu::step(int numCycles, mmu& theMMU, cpu5a22& theCPU) { + int hPos = internalCyclesCounter / 4; + + // HIRQ + if (theMMU.isHIRQEnabled() && (hPos == theMMU.getHIRQPos())) + { + theCPU.triggerIRQ(); + theMMU.setIrqTriggered(); + } + internalCyclesCounter += numCycles; if ((internalCyclesCounter >= hdmaStartingPos)&&(hdmaStartedForThisLine==false)) diff --git a/ppu.h b/ppu.h index 5667136..49df602 100644 --- a/ppu.h +++ b/ppu.h @@ -101,8 +101,17 @@ class ppu bool opvctFlipFlop = false; bool oamPriRot = false; + int applyWindow(int x, int finalCol); + + int windowxpos[2][2]; + unsigned char windowTMW=0; + unsigned char w12sel = 0; + unsigned char w34sel = 0; + public: + unsigned char openBus = 0; + bool getWriteBreakpoint() { return writeBreakpoint; } ppu(); @@ -110,10 +119,12 @@ class ppu void setINIDISP(unsigned char val) { iniDisp = val; - /*if ((screenDisabled & 0x80) && (!(val & 0x80))) + if ((screenDisabled & 0x80) && (!(val & 0x80))) { - resetOAMAddress(); - }*/ + // TODO + //resetOAMAddress(); + //OAMAddrSave = OAMAddr; + } screenDisabled = val & 0x80; } diff --git a/romLoader.cpp b/romLoader.cpp index 5463b7a..a5783c6 100644 --- a/romLoader.cpp +++ b/romLoader.cpp @@ -63,7 +63,7 @@ Country (also implies PAL/NTSC) (FFD9h) 11h U Australia (PAL) */ -void romLoader::checkRomType(std::vector* romContents, bool& isHirom, int& standard, std::vector& loadLog) +void romLoader::checkRomType(std::vector* romContents, bool& isHirom, int& standard, std::vector& loadLog, int& sramSz) { if (romContents->size() <= 0x8000) { @@ -78,14 +78,27 @@ void romLoader::checkRomType(std::vector* romContents, bool& isHi // check header with sophisticated heuristics std::string romnameFromHeader; int numAlnumLorom = 0, numAlnumHirom = 0; + std::string hiromTitle, loromTitle; for (unsigned int rampos = 0;rampos < 21;rampos++) { unsigned char charHi=(*romContents)[0xffc0 + rampos]; unsigned char charLo=(*romContents)[0xffc0-0x8000 + rampos]; - if (std::isalnum(charHi)) numAlnumHirom += 1; - if (std::isalnum(charLo)) numAlnumLorom += 1; + if (std::isalnum(charHi)) + { + numAlnumHirom += 1; + hiromTitle += charHi; + } + + if (std::isalnum(charLo)) + { + numAlnumLorom += 1; + loromTitle += charLo; + } } + loadLog.push_back("LoRom title:[" + loromTitle + "]"); + loadLog.push_back("HiRom title:["+hiromTitle+"]"); + if (numAlnumHirom > numAlnumLorom) { loadLog.push_back("ROM seems HiRom"); @@ -113,6 +126,18 @@ void romLoader::checkRomType(std::vector* romContents, bool& isHi int iSRAMsize = (1 << sramSize)*1024; loadLog.push_back("SRAM size:" + std::to_string(iSRAMsize)); + if (iSRAMsize > (1024 * 32)) iSRAMsize = 0; + + // 1024 is not considered sram? + if (iSRAMsize > 1024) + { + sramSz = iSRAMsize; + } + else + { + sramSz = -1; + } + // rom country unsigned char romCountry = (*romContents)[0xffd9+ romAdder]; loadLog.push_back("Standard/Country:" + std::to_string(romCountry)); @@ -146,7 +171,8 @@ int romLoader::loadRom(std::string& romPath,mmu& theMMU,std::vector loadLog.push_back("ROM was read correctly. Size is " + std::to_string(romContents.size()/1024) + "kb. HiRom: "+std::to_string(isHirom)); - checkRomType(&romContents, isHirom, videoStandard, loadLog); + int sramSize = 0; + checkRomType(&romContents, isHirom, videoStandard, loadLog,sramSize); // @@ -218,10 +244,12 @@ int romLoader::loadRom(std::string& romPath,mmu& theMMU,std::vector std::string onlyRomName = romName.substr(0, pointPos); std::string sramFileName = "sram\\" + onlyRomName + ".srm"; + bool hasSram = false; std::vector sramData; std::ifstream file(sramFileName, std::ios::binary); if (file) { + hasSram = true; loadLog.push_back("SRAM found, loading it."); file.unsetf(std::ios::skipws); @@ -233,8 +261,23 @@ int romLoader::loadRom(std::string& romPath,mmu& theMMU,std::vector sramData.reserve(fileSize); sramData.insert(sramData.begin(), std::istream_iterator(file), std::istream_iterator()); + } + else + { + if (sramSize > 0) + { + loadLog.push_back("Allocating and saving new SRAM"); + hasSram = true; + for (unsigned int b = 0;b < sramSize;b++) + { + sramData.push_back(0); + } + } + } - for (int pos = 0;pos < fileSize;pos++) + if (hasSram) + { + for (int pos = 0;pos < sramData.size();pos++) { if (!isHirom) { @@ -246,7 +289,7 @@ int romLoader::loadRom(std::string& romPath,mmu& theMMU,std::vector } } - theMMU.hasSram(sramFileName, (unsigned int)fileSize); + theMMU.hasSram(sramFileName, (unsigned int)sramData.size()); } // RESET (emulation) 0xFFFC / 0xFFFD diff --git a/romLoader.h b/romLoader.h index 888828d..5c1bae3 100644 --- a/romLoader.h +++ b/romLoader.h @@ -14,7 +14,7 @@ class romLoader { private: - void checkRomType(std::vector* romContents, bool& isHirom, int& standard, std::vector& loadLog); + void checkRomType(std::vector* romContents, bool& isHirom, int& standard, std::vector& loadLog,int& sramSz); std::vector readFile(std::string& filename,int& error); public: