Asking why to clear the nametable was what I wanted to know most. If the reason the nametable needed to be cleared was something particularly ornate, then the "how" part would have been necessary especially if the solution was strange too. Since you meant clearing the nametable as in assigning all the nametable tiles to #$00, then the how was unnecessary. Yes I know how to set nametable locations tiles to #$00. As for my header, this is how I have it (set for NESASM3)

I still can't figure out why I'm getting a stack explosion. As it stands, the stack explosion will happen the moment a player presses start. If you erase the contents under the label ClearNametables: then the stack explosion somehow doesn't happen but I need that in the initial part of my program to clear the name tables. I was told that stack explosions only happen if info is abandoned in the stack from things like PHA and JSR but it doesn't explain why my stack explodes just by including the ClearNametables: label. Erase it and compile, you'll see. I tried running a trace logger in FCEUX but I am too much of a noob to be able to interpret it. You guys would probably be able to spot it very quickly.

I attached the .asm file if anybody can help me figure out how to stop the stack explosion. Once this gets figured out, I am ready to upload it to a cart. Thanks!

Looking in the trace logger, with a break point on writes to $0100-$01C0, hits this point. Whatever this subroutine is (I didn't try finding it in the source or assembling it), it's leading the CPU to it's doom.

My guess is something weirder is going on. If you replace the nametable clearing with the same number of NOPs, maybe you would get the same crashing result. It's hard to see how that code PPU init code could be doing anything. In the worst case, it could be one of NESASM's "silent errors". What version of the assembler are you using?

BTW, because NESASM doesn't assume you want to use zeropage (one of the things that annoys me about it), all of your instructions using ZP like STX $52 are actually assembling as STX $0052. This shouldn't have anything to do with your error, but it does make the program bigger and run slower.

I know because there's only one place in your code that has lda $00,x right above sta $50. So after that JSR, it should do its thing and return to LDX $52 and INX. DEX and BRK have been assembled there instead. Why is this? Because of this:

Code:

.bank 15 .org $EB00

.db $CA,$00,$04 ; 00 - initial

Do those 3 bytes look familiar? Yep, they're the $CA (DEX), $00 (BRK), $04 (undefined) bytes showing up where your code should be. What probably happened was the code you added with the nametables made your code large enough to hit the what you had reserved for whatever that other stuff was at $EB00.

Basically, you began your code with .org $E000. But it's larger than $B00 bytes. In the same bank, you have a .org $EB00, so there's a collision.

Now, NESASM absolutely should have thrown an error for the collision. I'd like to know if it's the latest version, because that's bad if things like that still happen.

The simple way to fix it is to save 8 (or 9 if you keep that code absolute) bytes in your code. Like Memblers said, NESASM doesn't assume zero page. So saving the eight bytes in your case will be super easy. To force zero page in NESASM, use <

That will save a byte everywhere you do it in your code as well make your code faster. And it looks like your code ONLY used zero page variables, so there are lots of saving to be had. (Note: Don't do it for non zero page variables. For clarity the zero page is the RAM from $0000-$00FF. $0100-$7FFF is non zero page RAM.)

You found it! My code was bleeding into a region that was reserved for $EB00. That's why more writes made that happen! Thanks so much.

Other than that, I am using NESASM3. I am currently cleaning up my code for a few reasons:1) This was my first program so I am noticing a lot of inefficient work.2) I'm currently naming my variables so it is easier to read.

When I am done, I will repost with the DMC stuff too. I heard before that NESASM3 is more for learning and has definite disadvantages. What compiler is considered the best, and what would I need to do to my .asm file so that it is compatible with the new compiler?

NES Assembler 3.1? NES Assembler 3.01? It displays a version when you run it. There are different versions of a file called nesasm3.exe. Does this one also give you a broken ROM without telling you? If so... *sigh*, poor NESasm.

Different people think different things are the best. ASM6 is nearly as simple, and more versatile. Others like CA65/CC65, which are even more versatile, but not as simple. It shouldn't be too difficult to port your code over to asm6 at least. But... if you're planning on doing that, don't use < for zero page stuff.

You'll need to manually create a header, and change some syntax. LDA [$D2],Y becomes LDA ($D2),Y. Most assemblers use () for indirect addressing, actually. I'll let someone else get more specific than that, I haven't used asm6 with mappers too terribly much and don't want to mislead. (I'm still using NESASM, because my project is too large to easily change to anything. My next project will probably use asm6.)

I figured out how to upload my game to a cart and play it on a Nintendo but there is one problem: the sprites are being assigned the wrong tiles. This doesn't happen on the emulators. Maybe I did something wrong in the installation? What I did was:1) Took my .nes file and trimmed off the first 16 bytes.2) I cut it in two and created two .bin files, 128 kB PRG and 256 kB CHR.3) Since I am writing to a TKROM 512 PRG, I was told to pad the PRG so that it will be 512 KiB going onto the cart. So I make four identical copies of my PRG (as I understood from the instructions) and paste all four back-to-back.4) Upload to cart successful. Plug into top loading NES. Turn on and everything else is fine but the sprites are using the wrong tile selections.

Also, is there a page on nesdev that is dedicated to homebrew developers software? There is some software I would be interested in if it exists. Photo to tiles in a few clicks. A video converter that creates small 2 second videos at 30 frames per second. A dedicated convert to DPCM. I can do all these things the normal way but has anybody shortened the process a little?

Who is online

Users browsing this forum: Google [Bot] and 3 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