Need guidance with nes to snes. UPDATE: Port Complete of Mega Man IV + MSU-1

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

It's not Sprite chr gfx that I was swapping, the game has four 8kb chunks, that setup how the sprites are constructed, (tile id's, animation counters, palettes to use for tiles, xy positions for constructed Sprite, things like that) the original game is chr ram, and the Sprite chr chunks I've edited their locations and sizes to the snes equivalents, and upload them via DMA, overwriting their original method of the NES's $2006/$2006/$2007.

If I'm misunderstanding I apologize. But the issue I have is resolved, I simply load the data I need from those banks, in ROM now. No more slowdown, no more glitched sprites, everything is excellent.

Except for the 2A03 emulator, the triangle volume is too low, idk of that's from my doing of implementing the code, but the 2 square channels and noise channel sound fine when I played the games entire OST.
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

Making great progress, currently working on getting the gameplay going. Right now I'm working on getting the games sub menu drawn correctly, gfx wise and tilemap location wise.
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

I'm having trouble trying to get sprites to hide behind the window mask. I've added the window mask for the far left of the screen, but I can't get sprites behind it. This is the code I came up with.

Code: Select all

LDA #$81
STA $212E
LDA #$03
STA $212B
LDA #$02
STA $2123
STZ $2126
LDA #$07
STA $2127
creaothceann
Posts: 610
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Need guidance with nes to snes.

Post by creaothceann »

infidelity wrote: Sun May 16, 2021 12:28 pm

Code: Select all

lda_imm(%00000010);  sta($2123);    // wb+++- W12SEL  - Window Mask Settings for BG1 and BG2
                     stz($2126);    // wb+++- WH0     - Window 1 Left  Position
lda_imm(%00000111);  sta($2127);    // wb+++- WH1     - Window 1 Right Position
lda_imm(%00000011);  sta($212B);    // wb+++- WOBJLOG - Window mask logic for OBJs and Color Window
lda_imm(%10000001);  sta($212E);    // wb+++- TMW     - Window Mask Designation for the Main Screen
Try the OBJ bits in register $2125 ?
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

creaothceann wrote: Sun May 16, 2021 12:49 pm
infidelity wrote: Sun May 16, 2021 12:28 pm

Code: Select all

lda_imm(%00000010);  sta($2123);    // wb+++- W12SEL  - Window Mask Settings for BG1 and BG2
                     stz($2126);    // wb+++- WH0     - Window 1 Left  Position
lda_imm(%00000111);  sta($2127);    // wb+++- WH1     - Window 1 Right Position
lda_imm(%00000011);  sta($212B);    // wb+++- WOBJLOG - Window mask logic for OBJs and Color Window
lda_imm(%10000001);  sta($212E);    // wb+++- TMW     - Window Mask Designation for the Main Screen
Try the OBJ bits in register $2125 ?
Thank you! Got the mask working just like it does in the NES original.

Code: Select all

LDA #$1F
STA $212E
LDA #$02
STA $2123
STA $2125
STZ $2126
LDA #$07
STA $2127
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

Update: Finally getting items/enemies to appear in the game. Massive edits I've needed to make, lots of indirect longs to access the stages data banks. Its buggy atm, but it's getting there. :-)
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

Update: Spent time fixing up the sprites in the game. There are spots where certain 16x16 blocks alter the background/foreground priority of any 8x8 Sprite tile that comes into contact, and I finally got that all squared away.

The next thing I'm going to work on, is restoring the auto-horizontal scroll engine.

Then once I get that squared away, I'm going to need some guidance/assistance with how to tackle the vertical scroll.
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

Ok, I'm starting to get ready for inserting the code, that deals with auto scrolling the next section of a stage.

Right now I'm toying around with the offset change per column (I cant figure out how to vertically scroll just an 8x8 pixel, I'm only able to scroll and 8 pixel wide column) What I remembered while porting the game over to the SNES, is that in the NES game, on a regular TV, you dont see the actual tiles on the NT$2000 region. And I think I need to shift up the entire screen by 07 bytes, so that when it comes time for auto scrolling vertically, you wont see the horizontal line being drawn for the next line line of gfx to be viewed.

So right now, I'm testing the offset change per column at vram address $3040, by shifting every column 07 bytes up. And when i compare the visual gfx on bsnes, against the original game on FCEUX, the screen is perfect.

However, now I gotta deal with the sprites, they need to be shifted up as well. I tried writing a routine before my OAM DMA routine, where I alter every Sprite Y position that isn't F8 (F8 in this game is how it moves unwanted sprites off of the screen) the code i wrote semi works, sometimes it seems (maybe?) It's running more than once per frame, and sprites will keep scrolling vertically, when I only want it changed once per frame.

I'm thinking maybe to add the code within my irq vector, since I know for a fact that is running once per frame.

Thoughts?
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Need guidance with nes to snes.

Post by Pokun »

Offset-change-per-column can only scroll 8 pixel columns, not 8x8 tiles, unless you split the screen using HDMA or something. And it can only scroll smoothly pixel-per-pixel vertically, while horizontal shift is character-per-character. Mode 4 can also not do both axes at the same time, while mode 2 can.

How much overscan you see on the TV may vary depending on manufacturer and should be the same for NES and SNES if you use the 256x240 resolution. On a PAL CRT TV with 60 Hz support you should see all of the top and bottom but maybe not the sides.

To make sure it runs only once per frame you should wait for NMI each frame.
93143
Posts: 1715
Joined: Fri Jul 04, 2014 9:31 pm

Re: Need guidance with nes to snes.

Post by 93143 »

Why are you using offset-per-tile?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Need guidance with nes to snes.

Post by lidnariq »

For that matter, why do you think you need to
infidelity wrote: Mon May 24, 2021 8:39 am vertically scroll just an 8x8 pixel
?
infidelity
Posts: 490
Joined: Fri Mar 01, 2013 4:46 am

Re: Need guidance with nes to snes.

Post by infidelity »

lidnariq wrote: Mon May 24, 2021 10:12 pm For that matter, why do you think you need to
infidelity wrote: Mon May 24, 2021 8:39 am vertically scroll just an 8x8 pixel
?
My Google searches always showed the function called offset per "tile" so I took that literally and assumed the feature was specific to an 8x8 tile, not every 8 pixel wide tile within the vertical column it resides.
93143 wrote: Mon May 24, 2021 8:50 pm Why are you using offset-per-tile?
Someone awhile back said I'd need to use offset per tile & HDMA for my vertical scroll transitions. The nes game is 30 8x8 pixels top to bottom. But the snes is 32 8x8 pixels top to bottom. I have the nes game drawing at it's original ppu address of $2000. My horizontal scroll is working correctly, both left and right directions, correct tiles and attributes. But I'm getting closer to the point of bringing over the games vertical scroll engine, and I'm worried about implementing this incorrectly.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: Need guidance with nes to snes.

Post by lidnariq »

You might turn on VOPT only for the transitions and run in the lower-numbered video mode most of the time instead?
User avatar
dougeff
Posts: 3078
Joined: Fri May 08, 2015 7:17 pm

Re: Need guidance with nes to snes.

Post by dougeff »

I don't know if offset per tile is a good idea any more. Maybe just a mid screen Y scroll change done with either an IRQ or a HDMA would be easier.

But you would have to adjust it every frame.
nesdoug.com -- blog/tutorial on programming for the NES
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Need guidance with nes to snes.

Post by Pokun »

Nocash uses "offset-per-tile" in the Fullsnes doc, so that might be where people got that term from. I don't know what's up with that though, it should really be offset-change-per-chara-column or something like that as it can't scroll individual tiles.
Post Reply