Shadow of the Beast (port)

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Sun Jun 17, 2018 2:17 pm

In the next few days I will release the rom demo of Shadow of the Beast for NES.

The truth is that it has taken a lot of time away from other projects because I got hooked on making it work despite my limitations and the limitations of the machine. A team of professionals would have polished it without much trouble.

In fact, the rom contains some flaw, much more visible in emulator, but functional in a real NES console through everflash, etc ...

I'm very excited about it, but I want to leave it here to continue with the remodeling of my most important project: The Banketh

Image

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Thu Jul 12, 2018 2:52 pm

ROM: http://www.retrones.net/sites/default/f ... BHB%5D.nes

It has been developed with support from the NESlib library of Shiru. The multidirectional scroll is a modification of the original engine of Doug Fraker, which has also been adapted to work with the mapper MMC3 (to achieve plane effects). I found the music by chance in a forum dedicated to famitraker, and it was developed by MovieMovies1 for the mapper MMC5. Obviously, I have adapted it to work in the MMC3.

It works perfectly on a real NES using flashcard and other methods.

If you want to use it on PC or smartphone, the VirtuaNES emulator is recommended.
Last edited by Diskover on Thu Jul 12, 2018 10:26 pm, edited 1 time in total.

User avatar
dougeff
Posts: 2617
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Shadow of the Beast (port)

Post by dougeff » Thu Jul 12, 2018 4:20 pm

This ROM fails in 5 of the 6 emulators I tried. It worked in JNES 1.1, with a few errors.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
rainwarrior
Posts: 7682
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Shadow of the Beast (port)

Post by rainwarrior » Thu Jul 12, 2018 4:32 pm

It isn't quite working for me on my PowerPak either. Seems playable but some of the graphics are displaying the wrong tiles, and the scroll splits seem broken every second frame? (Seen as interlaced lines in the picture below.)

I dunno what your goals are, but it's probably worth trying to do this in a way that plays nice with most emulators? Unless you're specifically trying to exploit something technical that only the "real thing" can do, you're probably relying on some specific quirk of the implementation of MMC3 used by your flashcart which may or may not be present on an actual MMC3. (Clearly my PowerPak's simulation of an MMC3 differs from the one you used on your flashcart.) If you write code that is more within the boundaries of the well known parts of the MMC3 though, it should run on more emulators too.

Otherwise, I am excited to see this ready for public viewing. :)
Attachments
sotb_powerpak_powermappers_mmc3.jpg

WhiteHat94
Posts: 33
Joined: Fri Apr 07, 2017 5:02 pm

Re: Shadow of the Beast (port)

Post by WhiteHat94 » Thu Jul 12, 2018 9:45 pm

Seems to work fine on my Everdrive. Did not work on FCEUX when I tried immediately after I downloaded.

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Thu Jul 12, 2018 10:22 pm

I recommend using the VirtuaNES emulator or in a real NES using flashcard

http://virtuanes.s1.xrea.com/bin/virtuanes097e.zip

I spent a lot of time trying to solve the errors in the other emulators, but it has been impossible for me.

The problem is when I activate the instruction asm ('cli'); for the interruption of the MMC3 to work.

Guide me through the dougeff MMC3 tutorial https://nesdoug.com/2016/01/15/24-mmc3- ... hing-irqs/
Last edited by Diskover on Thu Jul 12, 2018 11:52 pm, edited 2 times in total.

User avatar
tokumaru
Posts: 11471
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Shadow of the Beast (port)

Post by tokumaru » Thu Jul 12, 2018 10:43 pm

Like rainwarrior said, unless you're intentionally exploiting hardware quirks that emulators are known to have problems with, it's a good idea to look into why it fails on so many setups. Even if it does work on real hardware (although it seems that different MMC3 implementations in flash carts are still disagreeing), and theoretically the original console has the final word, the fact that slight deviations from the real hardware are causing visible problems could mean your code is barely working, and under certain circumstances could still break.

A lot of these emulators are pretty accurate (unlike VirtuaNES, from what I could find online) and can handle all sorts of games just fine, so they should be able to handle your effects without problems too. I think the effort of making this game/demo work well across different emulators is worth it, as you'll end up with a more robust engine overall.

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Thu Jul 12, 2018 11:36 pm

tokumaru wrote:Like rainwarrior said, unless you're intentionally exploiting hardware quirks that emulators are known to have problems with, it's a good idea to look into why it fails on so many setups. Even if it does work on real hardware (although it seems that different MMC3 implementations in flash carts are still disagreeing), and theoretically the original console has the final word, the fact that slight deviations from the real hardware are causing visible problems could mean your code is barely working, and under certain circumstances could still break.

A lot of these emulators are pretty accurate (unlike VirtuaNES, from what I could find online) and can handle all sorts of games just fine, so they should be able to handle your effects without problems too. I think the effort of making this game/demo work well across different emulators is worth it, as you'll end up with a more robust engine overall.
I have not done anything particularly weird to make the game work. As I mention, when implementing the MMC3, at the moment I activate the instruction asm ('cli'); for interruptions per line to work, in most emulators it stops working. On the other hand, in VirtuaNES and in a real NES it works perfectly.

If I deactivate the instruction asm ('cli'); the game works on all
Last edited by Diskover on Thu Jul 12, 2018 11:40 pm, edited 1 time in total.

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Thu Jul 12, 2018 11:39 pm

rainwarrior wrote:It isn't quite working for me on my PowerPak either. Seems playable but some of the graphics are displaying the wrong tiles, and the scroll splits seem broken every second frame? (Seen as interlaced lines in the picture below.)

I dunno what your goals are, but it's probably worth trying to do this in a way that plays nice with most emulators? Unless you're specifically trying to exploit something technical that only the "real thing" can do, you're probably relying on some specific quirk of the implementation of MMC3 used by your flashcart which may or may not be present on an actual MMC3. (Clearly my PowerPak's simulation of an MMC3 differs from the one you used on your flashcart.) If you write code that is more within the boundaries of the well known parts of the MMC3 though, it should run on more emulators too.

Otherwise, I am excited to see this ready for public viewing. :)
The sprites work under the 8x16 configuration

From what I see, it seems that your PowerPak has not identified them that way and tries to show them as 8x8

I have an idea: this afternoon, when I leave work, I will put the game on an MMC3 board.

I think I remember that I have PRG and CHR stored in some box. I will flase, weld and try with the MMC3 of RetroStage.-

User avatar
dougeff
Posts: 2617
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Shadow of the Beast (port)

Post by dougeff » Fri Jul 13, 2018 5:09 am

If you are setting and clearing interrupts 200+ times a frame, this may be the problem.

Other games don't do this, which is why no emulator author has bothered to get the accuracy perfect on such a thing.

MMC3 has a scanline counter system. I would use that. That just requires keeping interrupts ON the whole frame and just resetting a counter value several times a frame.


Also, are you using a PAL NES, diskover? That might be part of the issues that rainwarrior is having.
I will put the game on an MMC3 board
You might have issues, if the board doesn't have 4 screen mirroring, like the ROM.
nesdoug.com -- blog/tutorial on programming for the NES

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Fri Jul 13, 2018 6:13 am

Yes, I am using a PAL NES

I configured this in this way to be able to do 15 screen divisions and in that way make parallax scroll effects.

Code: Select all

irq:
	pha
	txa
	pha
	tya
	pha
	ldy #15				;wait a little, loop 15 times
:	dey					;2 cycles
	bne :- 				;3 cycles

	ldx _Scroll_Index 	;each time the irq fires, it fetches a different byte from and array
	lda _Scroll, x
	sta $2005			;change the horizontal scroll
	lda _scrollY 		;#0 originalmente. Controlamos desplazamiento vertical de la pantalla
	sta $2005			;vertical scroll = 0
	inc _Scroll_Index

	lda #1
	sta $e000 			; acknowledge the irq, turn off the counter
	lda #14				; Alto en pixeles de cada linea IRQ. Tenemos 10 trozos a repartir. Hay que probar con 32
	sta $c000 			; set up the next irq, 20 scanlines	
	sta $c001
	lda #1
	sta $e001 			; turn on the scanline counter
   
	pla
	tay
	pla
	tax
	pla
	rti

Sour
Posts: 739
Joined: Sun Feb 07, 2016 6:16 pm

Re: Shadow of the Beast (port)

Post by Sour » Tue Jul 17, 2018 6:13 am

The problem is that you did not disable APU Frame Counter IRQs at power on. These are enabled by default, at least on NTSC consoles (and likely most emulators): http://wiki.nesdev.com/w/index.php/CPU_power_up_state)

Changing Mesen's code to boot with APU IRQs disabled fixes (almost) everything:
shadow.png
I say almost because at some very specific character positions, the background (between the clouds & ground) flashes in or out of existence for a few pixels.

This issue reminds me of this problem bananmos had with a PAL rom: viewtopic.php?p=214822#p214822
It's possible that PAL NES might boot with the "disable IRQ" flag turned on for the frame counter, which would explain both issues. (I'm unsure if any of the PAL test roms check this particular behavior)

Diskover
Posts: 213
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Shadow of the Beast (port)

Post by Diskover » Tue Jul 17, 2018 11:57 pm

Sour wrote:The problem is that you did not disable APU Frame Counter IRQs at power on. These are enabled by default, at least on NTSC consoles (and likely most emulators): http://wiki.nesdev.com/w/index.php/CPU_power_up_state)

Changing Mesen's code to boot with APU IRQs disabled fixes (almost) everything:
I say almost because at some very specific character positions, the background (between the clouds & ground) flashes in or out of existence for a few pixels.)
Yes, it is a problem that I have not been able to solve and that has to do with the camera that follows the player. For 4 pixels, it is positioned in the previous nametable. I tried many things, such as delaying a few pixels, but this generated other new problems, and I gave up. Also in PAL console this small defect occurs.

It only happens when we work with MMC3 and the IRQs are on. If I deactivate it, it does not happen.
Sour wrote: This issue reminds me of this problem bananmos had with a PAL rom: viewtopic.php?p=214822#p214822
It's possible that PAL NES might boot with the "disable IRQ" flag turned on for the frame counter, which would explain both issues. (I'm unsure if any of the PAL test roms check this particular behavior)
And what is the solution if the IRQs should always be on to make the parallax scroll effect?

User avatar
Sumez
Posts: 909
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Shadow of the Beast (port)

Post by Sumez » Wed Jul 18, 2018 1:30 am

Manually turn it on? :)

User avatar
dougeff
Posts: 2617
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Shadow of the Beast (port)

Post by dougeff » Wed Jul 18, 2018 4:54 am

It seems the neslib based source code on my webpage omits this bit

lda #$40
sta $4017

from crt0.s

I believe I borrowed this crt0 from the Alter Ego source code.

$4017 is the APU frame counter. Writing #$40 here disables frame count IRQs. Please add this somewhere near the top of crt0.s. Sorry for the inconvenience.
nesdoug.com -- blog/tutorial on programming for the NES

Post Reply