Grumpy NES emulator

Show off your games, demos and other (playable) creations.
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Grumpy NES emulator

Post by pgimeno »

I've had trouble too. Blockage works great, but it's kind of repetitive and not very demanding. Cowlitz Gamers 1st Adventure works, but it slows down at times; I guess that's expectable. The 2nd adventure doesn't work at all. The Legends of Owlia crashes upon entering the game, if not earlier, and often ends with this traceback:

Code: Select all

Error: gnes/PPU/init.lua:148: BUG: write to 42c6: no writer at 3
stack traceback:
	[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
	[C]: in function 'write'
	gnes/PPU/init.lua:148: in function <gnes/PPU/init.lua:146>
	gnes/CPU/init.lua:160: in function '_step'
	gnes/CPU/init.lua:26: in function 'stepC'
	gnes/NES.lua:150: in function '_frameStep'
	gnes/NES.lua:81: in function 'tick'
	gnes/gnes.lua:121: in function 'draw'
	gnes/gnes.lua:145: in function <gnes/gnes.lua:133>
	[C]: in function 'xpcall'
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Grumpy NES emulator

Post by ReFreezed »

grump wrote: Sun Oct 24, 2021 8:16 am Keyboard or gamepad?
Both. And I can add that the timing of the releases range from usually near-instant to rarely maybe a second, so very random.

Actually, I just tried Contra again today, and it seems to work most of the time now. Weird indeed. Maybe it's also a hardware timing related thing.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Grumpy NES emulator

Post by grump »

pgimeno wrote: Sun Oct 24, 2021 12:31 pm Cowlitz Gamers 1st Adventure works, but it slows down at times;
I forgot about the F10 key. Start the ROM and watch the MEM value. If it goes straight up above 4 MB or so and doesn't stop, press F10 (super-hard reset, JIT flushes). Repeat until it remains stationary below 4 MB. Now all the LuaJIT dice were adequately rolled and you should be able to enjoy your game at best performance. It's ridiculous, lol
pgimeno wrote: Sun Oct 24, 2021 12:31 pm The Legends of Owlia crashes upon entering the game, if not earlier, and often ends with this traceback:
I would like to try this because that stack trace is crazy and makes no sense, but the ROM is not available for download anymore. There's a demo ROM but it doesn't crash on me.
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Grumpy NES emulator

Post by pgimeno »

I've found a copy of The Legend of Owlia here, together with many other homebrew games for several platforms (including the other ones I tested with Grumpy NES):

https://github.com/FunKey-Project/FunKe ... _files.zip
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Grumpy NES emulator

Post by grump »

Thanks @pgimeno, I found the issue with Owlia. It wasn't as interesting as I first thought and only this and one other game are affected.
User avatar
Gunroar:Cannon()
Party member
Posts: 1141
Joined: Thu Dec 10, 2020 1:57 am

Re: Grumpy NES emulator

Post by Gunroar:Cannon() »

grump wrote: Thu Oct 28, 2021 5:54 pm Thanks @pgimeno, I found the issue with Owlia. It wasn't as interesting as I first thought and only this and one other game are affected.
Can you spread insight on the issue, if you may?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Grumpy NES emulator

Post by grump »

Gunroar:Cannon() wrote: Sat Oct 30, 2021 11:48 pm Can you spread insight on the issue, if you may?
Sure, why not. I'll happily bore anyone to death.

NES games are cartridges, and cartridge is hardware and must be emulated. Many different cartridge boards have been identified, documented and assigned so called mapper numbers. A game dump has a header that contains the mapper number.

The problematic game in this case works with mapper 2 hardware, which provides extra memory that can be bank-switched.

In my bank-switching code, I only used the lowest 4 bits of the bank number to select one of 16 memory banks (as suggested by the documentation). But this game here has 512 KiB of ROM (32 pages), requiring 5 address lines instead of just 4 to select a bank.

The bug was fixed by using all 8 bits of the bank number when switching banks. It's even right there in the article:
Emulator implementations of iNES mapper 2 treat this as a full 8-bit bank select register, without bus conflicts. This allows the mapper to be used for similar boards that are compatible.

Code: Select all

mapper.write = (addr, val) =>
	if addr >= 0x8000
		banks[0] = lshift(val, 14)
I could identify one other game that uses this mapper with 5+ address lines, so that makes this my first obscure game bug fixed after a user report ;)
User avatar
Gunroar:Cannon()
Party member
Posts: 1141
Joined: Thu Dec 10, 2020 1:57 am

Re: Grumpy NES emulator

Post by Gunroar:Cannon() »

Dang, you're a NES expert :shock:
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Grumpy NES emulator

Post by milon »

Gunroar:Cannon() wrote: Sun Oct 31, 2021 6:23 am Dang, you're a NES expert :shock:
That's kind of a requirement for writing an emulator. ;)
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Grumpy NES emulator

Post by ivan »

Wow, this is super impressive, Grump!
grump wrote: Wed Jun 02, 2021 4:14 pm Sometimes performance is superb, other times it slows down to a crawl. It accumulates more garbage per second than a neckbeard in his nest in a month, for reasons unknown.
Wish I could help with this issue, but I have no experience with MoonScript at all.
Looks great, anyways!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest