It is currently Thu Jan 24, 2019 5:54 am

 All times are UTC - 7 hours

 Page 6 of 7 [ 93 posts ] Go to page Previous  1 ... 3, 4, 5, 6, 7  Next
 Print view Previous topic | Next topic
Author Message
 Post subject: Re: Pallete affects scroll valuePosted: Fri Nov 17, 2017 9:22 am

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Answer to first question:
This is so that I can double the screen size Ala SMB3 by using adjacent tiles to get a certain effect of doubling the screen size using one hex memory address, effectively filling both "screens" of the PPU. While my arrogance that has shown prominently during this wants to explain how I did it, I want to tell you what it was originally
Code:
DrawColumn:
LDA #%00100100        ; set to increment +32 mode
STA \$2000

LDA \$2002             ; read PPU status to reset the high/low latch
LDA columnHigh
STA \$2006             ; write the high byte of column address
LDA columnLow
STA \$2006             ; write the low byte of column address
LDX #\$1E         ; copy 30 bytes
LDY #\$1E
DrawColumnLoop:
LDA [sourceLow], y
STA \$2007
INY
DEX
BNE DrawColumnLoop

DrawNewColumn2:
LDA scroll       ; calculate new column address using scroll register
LSR A
LSR A
LSR A            ; shift right 3 times = divide by 8
STA columnLow2    ; \$00 to \$1F, screen is 32 tiles wide

LDA nametable     ; calculate new column address using current nametable
EOR #\$01          ; invert low bit, A = \$00 or \$01
ASL A             ; shift up, A = \$00 or \$02
ASL A             ; \$00 or \$04
CLC
ADC #\$28          ; add high byte of nametable base address (\$2000) can change to lower name table \$2000 = ADC #\$20 \$2800 = ADC #\$28 changes what loads the name table in the bottem name table in
STA columnHigh    ; now address = \$20 or \$24 for nametable 0 or 1

LDA columnNumber2  ; column number * 32 = column data offset
ASL A
ASL A
ASL A
ASL A
ASL A
STA sourceLow2
LDA columnNumber
LSR A
LSR A
LSR A
STA sourceHigh2

LDA sourceLow       ; column data start + offset = address to load column data from
CLC
ADC #\$04
STA sourceLow2
LDA sourceHigh
ADC #\$04
STA sourceHigh2

DrawColumn2:
LDA #%00100100        ; set to increment +32 mode
STA \$2000

LDA \$2002             ; read PPU status to reset the high/low latch
LDA columnHigh
STA \$2006             ; write the high byte of column address
LDA columnLow
STA \$2006             ; write the low byte of column address
LDX #\$1E              ; copy 30 bytes
LDY #\$1E
DrawColumnLoop2:
LDA [sourceLow2], y
STA \$2007
INY
DEX
BNE DrawColumnLoop2

;;;;;;;;;;
scrollCheck:

LDA player
CLC
ADC #\$08
CMP #\$80
BEQ ReadController1

LDA player
CLC
ADC #\$08
CMP #\$80
BCC Rights

LDA player
SEC
SBC #\$01
STA player

LDA #\$00
STA sdir

JMP ReadController1

RTS
witch took too much memory from the hex by using the next screen data, halving the game's level data.
The new code like you said
Quote:
[writes] the value from [sourcelow],y to \$2007, then adding 1 that value and writing that to \$2007. So for every byte in the address pointed to in sourcelow, you're writing two bytes.
Whitch keeps the level long without compensating the length.

Answer to the second question:
The game isn't finished. When I learn Bank switching and r-a-m- -s-t-o-r-a-g-e(already done) , I'll get working on the other game elements. If there's problem with it, tell me please.

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]

Top

 Post subject: Re: Pallete affects scroll valuePosted: Fri Nov 17, 2017 10:44 am

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1268
Yes, there is a problem. Your ROM claims to be 48KB in the header, but it's only 40KB, which makes some emulators reject it outright. Nestopia is one such emulator. VirtuaNES is another. Adding the bank directive as I've instructed will tell NESASM to add another CHR bank (8KB) to your file so that it will be the proper size.

One thing to note is that \$2000 isn't written to before (or in) DrawNewAttributes in the NMI, so when \$2007 is written to in DrawNewAttributes it is incrementing by whatever was last written to \$2000.

Your game crashes when you press A because of this code:
Code:
LDA JumpState;If JumpState is >= 1
CMP #\$01
BCS ReadADonep1;go to ReadADonep1

LDA #\$01;This makes JumpState equal to 1
STA JumpState
ReadADonep1:

LDA JumpState;If JumpState is >= 1
CMP #\$01;Go to ReadADonep1
BCS ReadADonep1;Because ReadADonep1 is directly above, this is an endless loop.

_________________
https://kasumi.itch.io/indivisible

Top

 Post subject: Re: Pallete affects scroll valuePosted: Tue Nov 21, 2017 5:45 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Trying to write to \$0700 and every time I do, It resets to \$FF
Code:
DrawColumnLoop:

LDA [sourceLow], y
STA \$0700,y
INY
DEX
BNE DrawColumnLoop

RTS

 Attachments: Kitsunetales.asm [19.48 KiB] Downloaded 54 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Wed Nov 22, 2017 3:19 pm

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1268
First: There is no ROM, nor a way to build the ROM, so I can't even see the problem you're currently talking about. Can you share the other files one needs to build the game, instead of just the .asm? "KitsuneTaleslevel.bin", "KitsuneTaleslevel2.bin", "KitsuneTalesattrib.bin", "KitsuneTalesattrib2.bin", "Electro_and_Shiro.chr" and "Kitsunetales.chr". This forum allows you to upload .zip files, so you can upload your project file as one file.

Edit:
Second: Please make the changes I suggested in my last post about CHR. I now see that you changed .ineschr to 3 instead of 4, but that... creates a different kind of problem. Potentially the problem you're describing.

The size of your CHR and PRG should be a power of two. If you multiply your .ineschr value by 8192 you'll get 24576 which is not a power of two. What I outlined as a fix was a way to avoid all of this kind of stuff. You want .ineschr 4, you want a .bank 5, and you want .org \$0000 under each CHR .bank statement. (so .bank 3, .bank 4, and .bank 5 would want .org \$0000 under them, instead of .org \$A000 and \$E000. .bank 2 is correct.) The last CHR banks can be empty, but they need to be there.

Third: Without building the ROM, that code looks like it'd do exactly what I said it'd do. That is, copy a single column from the address pointed to in sourceLow and sourceLow+1 to RAM (except at \$0700+ rather than \$0500+). So can you be more specific about the difference between what you are expecting to happen and what is actually happening?

Edit 2: Because it will help replicate exactly what you're seeing, what emulator are you using, and what version of that emulator? If testing on real hardware, what flash card/other type of cartridge? (Though I only own a powerpak and infiniteneslives MMC3 cart, so if it's not those then I can't see it exactly.)

_________________
https://kasumi.itch.io/indivisible

Top

 Post subject: Re: Pallete affects scroll valuePosted: Wed Nov 22, 2017 7:13 pm

Joined: Sat Feb 16, 2013 11:52 am
Posts: 324
Quote:
I want to program a MMC3 demake of smash bros, what's a vblank?

STOP and go read the basics immediately. Go read a decent tutorial (Nerdy Nights at a minimum, I'm sure people here have links to better reading material though) before trying to code complex stuff. You're not going anywhere if all you do is copy/paste code you barely understand even if we try our best to help you. Look at the complexity of a simple breakout game I've coded:

https://github.com/AleffCorrea/BrickBre ... lision.asm

Roughly 500 lines just for background and sprite collision detection... feel free to browse the rest of the files from my game. Don't be overwhelmed by it though, trust me when I say that if you stop what you're trying to do right now and direct your efforts towards learning the underlying concepts first you'll be doing code that is 10 times better than mine in no time.

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit.

Top

 Post subject: Re: Pallete affects scroll valuePosted: Sat Nov 25, 2017 7:03 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Here

 Attachments: File comment: Tanuki Tales spinoff 2d metalgear Tanuki.chr [8 KiB] Downloaded 50 times File comment: Trash Kitsunetales.chr [8 KiB] Downloaded 53 times File comment: Main Graphics Electro_and_Shiro.chr [8 KiB] Downloaded 51 times File comment: ROM Game KitsuneTales.nes [40.02 KiB] Downloaded 55 times File comment: Main code KitsuneTales.nes [40.02 KiB] Downloaded 55 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Sat Nov 25, 2017 7:17 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
YOU

 Attachments: File comment: Level 2 KitsuneTaleslevel2.bin [796 Bytes] Downloaded 52 times File comment: level2 atribute KitsuneTalesattrib2.bin [36 Bytes] Downloaded 47 times File comment: Level 1 KitsuneTaleslevel.bin [48 Bytes] Downloaded 52 times File comment: in case Trash doesn't work KitsuneTalesShiroAkai.chr [48.02 KiB] Downloaded 50 times File comment: atributes KitsuneTalesattrib.bin [128 Bytes] Downloaded 47 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Sun Nov 26, 2017 1:10 am

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1268
I got rid of the code under anim, and scrollCheck. It wasn't used.
I got rid of readjoy. It wasn't used.
I got rid of Loadp. It wasn't used.
I got rid of LoadPalettes2. It wasn't used.

I recommend getting rid of dead code like that, it makes for way less to sift through while looking for errors.

DrawNewColumn uses columnNumber to decide which column to draw (which address to put into sourceLow and sourceHigh). columnNumber gets incremented every frame, so most of the time it's loading from data totally beyond your level data. Since the byte that's used to pad unused space is \$FF in NESASM, this is why mostly \$FF gets copied. Why columnNumber gets incremented, I have no idea. It's hard for me to follow the current code. And I know how I'd find out what's wrong, exactly, but I genuinely think the time would be better spent helping you rewrite it. As I, and others, have recommended, I would rewrite this one small step at a time.

1. Write code that copies a single fixed column to RAM.
When that works (check the RAM with FCEUX's hex editor)
2. Write code that copies a single column to RAM, that you can change with the d-pad. (Say... pressing right picks the next column. Pressing left picks the previous column.)
When that works (check the RAM with FCEUX's hex editor)
3. Write code in your NMI that writes the values in the "column RAM" to \$2007 fixed to one column's address.
When that works (you can just see it)
4. Write code in that sets an address for \$2006 to a specific column, that is also changed with the d-pad.
When that works (check the RAM for the address for \$2006 gets stored to)
5. Write code in the NMI that uses the address you set above to write to \$2006 so the \$2007 writes go to the right place.
When that works (you can just see the columns get written to the right place by using the d-pad)...
6. Write code that writes all columns one frame at a time without the use of the d-pad.
When that works...
7. Move the code in the NMI that writes to \$2006 and \$2007 to a subroutine and call it from the NMI.
When that works...
8. Disable rendering and use that subroutine in addition to your column to RAM code to write all columns in a single frame.
When that works...
9. When rendering is enabled, make it draw a new column when the screen is scrolled.
When that works...
etc.

I outline these steps to try to teach what making small testable parts is like. If you don't have a good guess of where a problem is when you're coding, you're probably writing too much before testing.

You didn't answer my question: What test setup (emulator/cartridge) are you using?

Edit: For the record I do see you are taking steps to writing small parts like this, but the reason your code is broken right now is actually stuff you wrote before. So I'm saying get rid of that stuff in addition to doing each small part.

_________________
https://kasumi.itch.io/indivisible

Top

 Post subject: Re: Pallete affects scroll valuePosted: Sun Nov 26, 2017 12:08 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Test Setup?:
Fceux first check value, see if my code is working, try to break code. Move on.

wanna see an example? press up and down on the dpad using the kitsune3 code . theres the test of rendering.
Ive Also learmned what vnblabnking is

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]

Top

 Post subject: Re: Pallete affects scroll valuePosted: Sun Nov 26, 2017 2:01 pm

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1268
I saw an example. I even told you what was wrong, just not specifically how to fix it. You're doing things to columnNumber for reasons I don't understand. If you got rid of all code that modifies columnNumber, it'd probably work. Which you could then build on, which is what I suggest. Assuming you get rid of the columnNumber modifying code, you're on step 1 in my post. Then go to step 2. etc.

Does it at least make sense why you're seeing \$FFs with the explanation in the previous post?

_________________
https://kasumi.itch.io/indivisible

Top

 Post subject: Re: Pallete affects scroll valuePosted: Tue Nov 28, 2017 1:59 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Done, check the scrolling by pressing A, Up and down

 Attachments: KitsuneTales.nes [40.02 KiB] Downloaded 60 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Tue Nov 28, 2017 3:43 pm

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1268
Fix the CHR! Your file is still 40KB, which probably means you still don't have a .bank 5 and a .org \$0000 under that .bank 5.

Glad it mostly works, but there's definitely still something wrong. Every 32 pixels (which I assume is when you update attribute bytes), the scroll position jumps a little vertically.

edit: To be specific: Every 32 horizontal pixels, I mean. Holding A for 32 frames.

_________________
https://kasumi.itch.io/indivisible

Top

 Post subject: Re: Pallete affects scroll valuePosted: Wed Dec 06, 2017 11:35 am

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
Quuuesstion....

Before I dive into the main problem:
"Why does every time I update my 'pallete'[palette] , the scroll gets messed up?" problem,

There is something wrong with the attribute table. I'm using your (Kasumi) method of updating using nmi timing and when I update the screen data, There are background tiles missing and the attribute doesn't update correctly. Answers?
Also, Fancy a bonus?
1.[*] can you activate an IRQ any where?
2. scroll both the IRQ and the main screen in both directions at the same time? (you know like the Sonic 2 Vs. screen)? example: https://www.youtube.com/watch?v=OgIb5T9HYEc
P.S. This is for a multiplayer option I'm thinking of.

 Attachments: File comment: New atributes KitsuneTalesattrib.bin [126 Bytes] Downloaded 52 times File comment: code Kitsunetales.asm [20.3 KiB] Downloaded 48 times File comment: Rom KitsuneTales.nes [48.02 KiB] Downloaded 58 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Thu Dec 07, 2017 8:50 pm

Joined: Thu Jul 13, 2017 5:17 pm
Posts: 48
UPDATE.
Bad example: uses parallax scrolling

 Attachments: KitsuneTales.nes [48.02 KiB] Downloaded 56 times Kitsunetales.asm [19.05 KiB] Downloaded 49 times

_________________
In Progress:
Tengu Tales (MMC3 Test first)[Collision]
Smash ("port", first MMC5 )[display stage]
Sonic the Hedgehog 1 TEST(VRC7, modify level])[display map data]
Baseball Brawlers (MMC5 full features, "Yoshi's Island")[MMC5 testing]
Top

 Post subject: Re: Pallete affects scroll valuePosted: Fri Dec 08, 2017 10:44 am

Joined: Fri May 08, 2015 7:17 pm
Posts: 2396
Location: DIGDUG
I didn't look at the code, but after 2 minutes of looking at the last .nes file...I see.

1.You aren't zeroing the attribute table of the PPU. Or setting it at all.

No RAM should be assumed to be zero. On a real NES, the screen (attribute table) might be filled with random palettes for the BG.

2. You are still occasionally writing to the PPU outside of v-blank. Not very far outside, but enough to cause occasional jitter while scrolling.

_________________
nesdoug.com -- blog/tutorial on programming for the NES

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 6 of 7 [ 93 posts ] Go to page Previous  1 ... 3, 4, 5, 6, 7  Next

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki
Powered by phpBB® Forum Software © phpBB Group