Closed juri74 closed 3 years ago
Mapper 30 (non-flash mode) is already added to latest commit... demos, including Troll Burner works so far with with implementation.
Nice work retro-wertz! Thank you! You seem to really know your mappers for nestopia! I tried integrating mapper 28 (twin dragons, a pretty awesome homebrew) and also the mapper for the fds conversion of Metroid. I was never able to get either working. It was pretty confusing for a noob like me. :P Anywho, sorry to bother you, just figured I would inquire since there seems to be a little activity with mappers on here.
Would it be possible that maybe these 2 could be added as well sometime in the future? The Metroid FDS conversion is a pretty neat and nifty little piece of history from Kaiser. I tried following Mesen's conversion of it, but it was too confusing to translate.
https://github.com/SourMesen/Mesen/blob/master/Core/Kaiser7037.h
The other mapper 28, is a pretty fun little mapper which plays twin dragons, a nice little platformer. :)
mapper 28 done https://github.com/0ldsk00l/nestopia/pull/320
i cant figure out how to map work ram regions and 4k prg stuff in K7037, so that wont happen for now and there seems to be only 1 game for this (Metroid fds conversion)
Hey Rdanbrook and retro-wertz! Thank you for adding that in man! You make quick work of these mappers!
I have a patch I meant to send which implements support for Kaiser ks_7031, which is Dracula II fds conversion from perilsenstive. It had the same issue Metroid fds conversion is having where nestopia has a minimum PRG bank size of 8K.
This patch gets around this implementing a read handler (which increases memory usage, but not nearly no where enough for even a user on a low end pc to notice)
If you would like I can send the patch to you guys, I tried using it as a template to implement the mapper myself, but it's too much over my head. Let me know and ill shoot the patch your way.
i dont get it. how are the 2k prg mapped then here in ks7031?
On Mon, Jun 10, 2019 at 7:06 AM joepogo notifications@github.com wrote:
Hey Retro-wertz and Rdambrook. Sorry for the delay in getting this to you guys. Here is the patch to get Dracula II FDS conversion over to Nestopia. This had the same problem as the Metroid FDS conversion so hopefully this will help you get it working on Nestopia.
diff -ur nestopia-1.48.orig/source/core/board/NstBoard.cpp nestopia-1.48/source/core/board/NstBoard.cpp --- nestopia-1.48.orig/source/core/board/NstBoard.cpp 2017-09-03 14:32:25.000000000 -0600 +++ nestopia-1.48/source/core/board/NstBoard.cpp 2017-11-03 10:58:20.820880536 -0600 @@ -947,6 +947,7 @@ { "KONAMI-VRC-4", Type::KONAMI_VRC4_0 }, { "KONAMI-VRC-6", Type::KONAMI_VRC6_0 }, { "KONAMI-VRC-7", Type::KONAMI_VRC7_0 },
-
{ "KS7031", Type::KAISER_KS7031 }, { "MLT-ACTION52", Type::AE_STD }, { "MLT-CALTRON6IN1", Type::CALTRON_6IN1 }, { "MLT-MAXI15", Type::AVE_D1012 },
@@ -1093,6 +1094,7 @@ { "UNL-H2288", Type::KAY_H2288 }, { "UNL-KOF97", Type::UNL_KINGOFFIGHTERS97 }, { "UNL-KS7032", Type::KAISER_KS7032 },
-
{ "UNL-KS7031", Type::KAISER_KS7031 }, { "UNL-N625092", Type::UNL_N625092 }, { "UNL-SA-0036", Type::SACHEN_SA0036 }, { "UNL-SA-0037", Type::SACHEN_SA0037 },
@@ -3563,6 +3565,7 @@ case Type::JYCOMPANY_TYPE_C : return new JyCompany::Standard(c); case Type::KAISER_KS202 : return new Kaiser::Ks202(c); case Type::KAISER_KS7022 : return new Kaiser::Ks7022(c);
-
case Type::KAISER_KS7031 : return new Kaiser::Ks7031(c); case Type::KAISER_KS7032 : return new Kaiser::Ks7032(c); case Type::KAISER_KS7058 : return new Kaiser::Ks7058(c); case Type::KASING_STD : return new Kasing::Standard(c);
diff -ur nestopia-1.48.orig/source/core/board/NstBoard.hpp nestopia-1.48/source/core/board/NstBoard.hpp --- nestopia-1.48.orig/source/core/board/NstBoard.hpp 2017-09-03 14:32:25.000000000 -0600 +++ nestopia-1.48/source/core/board/NstBoard.hpp 2017-11-03 14:51:40.736909865 -0600 @@ -414,6 +414,7 @@ // Kaiser KAISER_KS202 = MakeId< 56, 256, 128, 8, 0, CRM_0, NMT_V, 0 >::ID, KAISER_KS7022 = MakeId< 175, 256, 128, 0, 0, CRM_0, NMT_V, 0 >::ID,
-
KAISER_KS7031 = MakeId< NMPR, 128, 0, 0, 16, CRM_8, NMT_V, 0 >::ID, KAISER_KS7032 = MakeId< 142, 128, 0, 0, 0, CRM_8, NMT_X, 0 >::ID, KAISER_KS7058 = MakeId< 171, 32, 32, 0, 0, CRM_0, NMT_X, 0 >::ID, // Kasing
diff -ur nestopia-1.48.orig/source/core/board/NstBoardKaiser.cpp nestopia-1.48/source/core/board/NstBoardKaiser.cpp --- nestopia-1.48.orig/source/core/board/NstBoardKaiser.cpp 2017-09-03 14:32:25.000000000 -0600 +++ nestopia-1.48/source/core/board/NstBoardKaiser.cpp 2017-11-03 15:15:32.992912866 -0600 @@ -89,12 +91,47 @@ irq.Reset( hard, hard ? false : irq.Connected() ); }
-
void Ks7031::SubReset(const bool hard)
-
{
-
Map( 0x6000U, 0xFFFEU, &Ks7031::Peek_6000 );
-
Map( 0x8000U, 0xFFFFU, &Ks7031::Poke_8000 );
-
regs[0] = 0;
-
regs[1] = 0;
-
regs[2] = 0;
-
regs[3] = 0;
-
}
-
void Ks7032::SubReset(const bool hard) { Ks202::SubReset( hard ); Map( 0x6000U, 0x7FFFU, &Ks7032::Peek_6000 ); }
-
void Ks7031::SubLoad(State::Loader& state,const dword baseChunk)
-
{
-
NST_VERIFY( (baseChunk == AsciiId<'K','7','1'>::V) );
-
if (baseChunk == AsciiId<'K','7','1'>::V)
-
{
-
while (const dword chunk = state.Begin())
-
{
-
if (chunk == AsciiId<'R','E','G'>::V)
-
{
-
State::Loader::Data<4> data( state );
-
regs[0] = data[0];
-
regs[1] = data[1];
-
regs[2] = data[2];
-
regs[3] = data[3];
-
}
-
state.End();
-
}
-
}
-
}
-
void Ks7022::SubLoad(State::Loader& state,const dword baseChunk) { NST_VERIFY( (baseChunk == AsciiId<'K','7','2'>::V) );
@@ -149,6 +186,14 @@ state.Begin( AsciiId<'K','7','2'>::V ).Begin( AsciiId<'R','E','G'>::V ).Write8( reg ).End().End(); }
-
void Ks7031::SubSave(State::Saver& state) const
-
{
-
state.Begin( AsciiId<'K','7','1'>::V );
-
state.Begin( AsciiId<'R','E','G'>::V ).Write( regs ).End();
-
state.End();
-
}
-
void Ks202::SubSave(State::Saver& state) const { state.Begin( AsciiId<'K','0','2'>::V );
@@ -171,6 +216,27 @@
pragma optimize("", on)
endif
-
NES_POKE_AD(Ks7031,8000)
-
{
-
regs[(address >> 11) & 0x03] = data;
-
}
-
NES_PEEK_A(Ks7031,6000)
-
{
-
int bank, new_addr;
-
if (address < 0x8000) {
-
bank = regs[(address >> 11) & 0x03];
-
} else {
-
bank = 0x0f - ((address >> 11) & 0x0f);
-
}
-
new_addr = ((bank << 11) % prg.Source(0).Size()) | (address & 0x07ff);
-
return prg[0][new_addr];
-
}
-
NES_PEEK_A(Ks7032,6000) { return wrk[0][address - 0x6000];
diff -ur nestopia-1.48.orig/source/core/board/NstBoardKaiser.hpp nestopia-1.48/source/core/board/NstBoardKaiser.hpp --- nestopia-1.48.orig/source/core/board/NstBoardKaiser.hpp 2017-09-03 14:32:25.000000000 -0600 +++ nestopia-1.48/source/core/board/NstBoardKaiser.hpp 2017-11-03 15:16:15.756912955 -0600 @@ -88,6 +88,24 @@ Timer::M2 irq; };
-
class Ks7031 : public Board
-
{
-
public:
-
explicit Ks7031(const Context& c)
-
: Board(c) {}
-
private:
-
void SubReset(bool);
-
void SubLoad(State::Loader&,dword);
-
void SubSave(State::Saver&) const;
-
byte regs[4];
-
NES_DECL_POKE( 8000 );
-
NES_DECL_PEEK( 6000 );
-
};
-
class Ks7032 : public Ks202 { public:
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/0ldsk00l/nestopia/issues/272?email_source=notifications&email_token=AFR4HNTYFUCKRF6C6YV2BS3PZWEFZA5CNFSM4EPB6CIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXIUBHI#issuecomment-500252829, or mute the thread https://github.com/notifications/unsubscribe-auth/AFR4HNT7ZQIDBH5KVFXA4FDPZWEFZANCNFSM4EPB6CIA .
Sorry about the wall of code, i would have sent this as pull request but i am not sure how to do it.
I remember when this implemented, Persilsensitive sent me this and a description of what he had to do to get it working, here is the qoute:
"Notes:
1) It appears that Nestopia is stuck with a minimum PRG bank size of 8K; attempts to adjust it to 2K resulted in code that compiled, but ROMs failed to run. Based on my reading of the code it should be possible to make this change, but it isn’t immediately obvious how. Simply modifying the declaration of Board::prg in NstBoard.hpp isn’t sufficient. Also, I am nervous that there may be places in the code that unintentionally require an 8K bank size. I’m hesitant to go down this path since I’m not really familiar with the code and this change could result in all sorts of breakage.
2) Because of the issue above, it is not possible to implement this mapper with standard bank swapping routines. Instead, a read handler for the range of $6000 - $FFFF is used. A write handler for $8000-$FFFF is used for configuring the mapper registers.
3) Using a read handler for this is unfortunate as it will increase CPU usage a bit, since every read from ROM will require a function call instead of a simple memory lookup. Nestopia is pretty well optimized though, so I doubt users are really going to notice."
There is no hit on performance with the read handler at all. It runs really well on nestopia.
im still not getting it (im no mapper researcher, hence its mind boggling :D) can you at least send or upload the necessary files that has been changed so i can compare and probably make proper pr for review? im sure the performance hit of using such handler would be minimal (not sure whats the slowest system Nestopia UE currently supports...)
thanks.
Yea, no problem! when I get home I can send the files as actual files and not what I posted above so it might make better sense. heh/ :P
And yea, the hit is so minimal even the geico caveman wouldn't notice haha. I tried to upload them here but it won't let me. Do you have a way for me to get these files to you by chance? What I posted above is directly what Persilsensitive sent me. I had to copy it as text. Also I cannot attach zip files here for some reason?!
Try throwing it up on pastebin.
Ahh, yes pastebin. Ok tell me if this makes more sense to you guys:
Try this and tell me how this looks:
The only other thing I can can do is send these as the actual cpp files. That is everything needed to get kaiser7031 Dracula II FDS conversion implemented, which has/had the same issue as the Metroid fds conversion with the 2k issue on nestopia. I think he uses PEEKS intead of POKES in the mapper registers to bypass the limitation.
ok done. much cleaner now using pastebin. ks7031 now working. will try to add ks7037 together with it so i can both at once. if you do have 7037 already, then much better :D
Ok awesome! Glad pastebin was much better this time, it was really hard to follow in the above code I posted, think I will go back and edit so this thread is not too long. haha.
I was sadly never able to get 7037 working, I'm only a noob at this and was never able to get it going/working. I usually do not care too much for pirate dumps but I am very intrigued and interested by the Kaiser ones. I was working on getting this one and a couple other Kaiser ones Doki Doki Panic FDS conversion, and exciting basket fds conversion, but never was able to get the hang of it. I was happy to see the Dracula II fds conversion working, it's pretty neat! With whatever else you help with adding retro-wertz, you have my eternal gratitude! You seem to have a good grasp on the basics of it, which is awesome!
With that said I was at least able to add a couple small mappers myself last year, I think I added highway star fds conversion and zanac fds conversion so when I get a minute, ill pastebin that here too if Rdanbrook wants to add it in. I've been meaning to ask him about it if he wants it, but I keep on forgetting to.
It's a pity as Nestopia is such a great emulator, and only needs a few small tweaks here and there and a few more mapper adds and it will be near the top of the pops again. I have a small list of things that need fixing that I was never able to get around too/have the skill to fix. Good to see some compatibility fixes getting added here and there. It is most certainly undead! :P
OK, shoot could not edit the post with the code so I deleted it. Just a heads up, the sour mesen source code is not the only source you can follow, the fce ultra modified mappers source (which I have bookmarked at home) also has Kaiser game code which is not emulated in sour yet.
I used some of fce's code to port over the gyruss and highway star fds conversion code I think.
KS7031 - PR sent. im not done with KS7037, i cant get it to work getting Invalid Opcode
sadly any of these FDS conversion does not allow saving though...
Yea, unfortunately that's where I justify to myself using savestates heh! :P
Also, is it when you load the rom it's throwing the opcode error? I take it you where able to work past the 2k limitation with this one?
This is times when I wish Dragon2snow would share some code, he got this game working in NestopiaPlus! a while back.
Hey Retro-wertz, were you able to at least get around the 2k limitation on ks7037 with the code from ks7031 at least? Are you getting the errors from loading the rom itself?
no progress since last post. i never re-tested it...
Thanks for the response. Can you pastebin what you have for it if you do not mind? I would like to take a look at it. :)
nope i dont have it anymore...
Hey Ghost, question for you. Sorry to dig this back up. If I can figure out how to get around the 2k limitation for this mapper, can you re-add what you had for the rest to this mapper to see if we can get it to work?
To clarify, I am talking about the Metroid fds conversion.
@joepogo ghost is a username placeholder for users that were deleted. Whoever that was is not going to see your messages.
Oh wow, had no idea hehe. Thanks for the heads up on that. I wonder what in the heck happened to retro-wertz? Thanks again man!
This all seems to be done, so I am closing the issue. If there are any loose ends it can become a new issue.
Joe Granato of http://troll.thenew8bitheroes.com/ just released an NES homebrew demo called Troll Burner which is a kind of test for his much much bigger NES game Mystic Searches. It uses iNES Mapper 30. https://wiki.nesdev.com/w/index.php/UNROM_51226
It would be really nice to support this mapper because it's not just for this one game. Granato is releasing a tool called NESmaker which people can use to produce lots of NES homebrews using this mapper.