Ah, so that's how you use the ".ds" directive. The github page was a little vague about that. I don't think padding is technically necessary either, but NESASM tends to fill empty space with #$ff.tokumaru wrote: ↑Wed May 12, 2021 2:28 pmThere's no need to use external files for padding... Any decent assembler will have a directive to fill memory. It looks like NESASM uses DS for this (e.g. .ds 8192 to generate 8KB of zeros). But with NESASM's mandatory BANK directives, I don't think you even need to do any manual padding, each "bank" will be 8KB no matter what you put on it.
VRC6 CHR Bank Malformed?
Moderator: Moderators
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
Because you haven't written the correct values to $D000 through $E003.puppydrum64 wrote: ↑Wed May 12, 2021 3:53 pm But unfortunately I still don't understand why this is happening, even after setting bit 5 of $B003:
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
Re: VRC6 CHR Bank Malformed?
That's the first 1KB of CHR data repeated 8 times. Looks right to me =p
You should try switching those banks.
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
Hmm, so how do I switch banks exactly? I know I need to write to the "PPU registers" but what to write to them?Controllerhead wrote: ↑Wed May 12, 2021 4:00 pmThat's the first 1KB of CHR data repeated 8 times. Looks right to me =p
You should try switching those banks.
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
Re: VRC6 CHR Bank Malformed?
The KB of CHR data that you want in each bank. So, if you did:
Code: Select all
LDX #$00
STX $D000
INX
STX $D001
INX
STX $D002
INX
STX $D003
INX
STX $E000
INX
STX $E001
INX
STX $E002
INX
STX $E003
If i understand VRC6 correctly...
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
Funnily enough I literally just tried this before reading your reply and it worked. Thanks! I'm gonna try numbers that go past 7 and see if that loads bank 2. And I'll write a loop that does this more efficiently and with a way to select entire banks. But that might take a while.Controllerhead wrote: ↑Wed May 12, 2021 4:31 pmThe KB of CHR data that you want in each bank. So, if you did:The SMB CHR data would be loaded in order.Code: Select all
LDX #$00 STX $D000 INX STX $D001 INX STX $D002 INX STX $D003 INX STX $E000 INX STX $E001 INX STX $E002 INX STX $E003
If i understand VRC6 correctly...
-
- Posts: 1318
- Joined: Thu Apr 23, 2009 11:21 pm
- Location: cypress, texas
Re: VRC6 CHR Bank Malformed?
Remember that bank switching for VRC6 is described on this page:
https://wiki.nesdev.com/w/index.php/VRC6
But, it’s quite confusing… for me at least; follow the advice given, and if it doesn’t work out, then refer to that page and play with it.
Aahhh, so it makes a bit of sense now… if you write #xxxxxx00b, or #%xxxxxx00, to $B003, then your bank switching will work as Controllerhead said.
If you write #%xxxxxx10 to $B003, then the bank switching (or writing, will be quite different. Sry, I’ve got to go.
https://wiki.nesdev.com/w/index.php/VRC6
But, it’s quite confusing… for me at least; follow the advice given, and if it doesn’t work out, then refer to that page and play with it.
Aahhh, so it makes a bit of sense now… if you write #xxxxxx00b, or #%xxxxxx00, to $B003, then your bank switching will work as Controllerhead said.
If you write #%xxxxxx10 to $B003, then the bank switching (or writing, will be quite different. Sry, I’ve got to go.
Re: VRC6 CHR Bank Malformed?
In my opinion, VRC6 is one of the most ridiculous mappers ever seen on the Famicom, exceeded only by Namco's 163, the MMC5, and JY Company's mapper. It's unfortunate that it's the one you're starting with, because there's a whole lot more background to have to get through before you can meaningfully understand how to use it.
But if it's its audio capabilities that are your sole inspiration, there's really nothing to be done for that.
But if it's its audio capabilities that are your sole inspiration, there's really nothing to be done for that.
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
Only weird thing happening now is, I have my test ROM set up so that pressing A will add 1 to the value in $D000. But for some reason it adds 2 instead, and I don't know why.
- Controllerhead
- Posts: 314
- Joined: Tue Nov 13, 2018 4:58 am
- Location: $4016
- Contact:
Re: VRC6 CHR Bank Malformed?
You realize you can't read the value of the register, right? It will just read the value of the ROM at $D00x or what have you, nor will writing to it change the value that is read. You'll have to keep track of the register value(s) in RAM somewhere manually, if that's your intention.puppydrum64 wrote: ↑Wed May 12, 2021 6:13 pm Only weird thing happening now is, I have my test ROM set up so that pressing A will add 1 to the value in $D000. But for some reason it adds 2 instead, and I don't know why.
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
I figured as much. What I did was create seven "soft" registers in zero page RAM. The only time I actually write to the real registers is during vBlank, where I copy the phony registers to the real ones. The button presses increment the soft registers only.Controllerhead wrote: ↑Wed May 12, 2021 6:49 pmYou realize you can't read the value of the register, right? It will just read the value of the ROM at $D00x or what have you, nor will writing to it change the value that is read. You'll have to keep track of the register value(s) in RAM somewhere manually, if that's your intention.puppydrum64 wrote: ↑Wed May 12, 2021 6:13 pm Only weird thing happening now is, I have my test ROM set up so that pressing A will add 1 to the value in $D000. But for some reason it adds 2 instead, and I don't know why.
-
- Posts: 1318
- Joined: Thu Apr 23, 2009 11:21 pm
- Location: cypress, texas
Re: VRC6 CHR Bank Malformed?
This is what debuggers are made for… in Mesen, I’d create a breakpoint that triggered on your soft copy of $D000 for each read and write. (Click on the breakpoint part of the debug window and press insert to create; to edit apuppydrum64 wrote: ↑Wed May 12, 2021 7:34 pmI figured as much. What I did was create seven "soft" registers in zero page RAM. The only time I actually write to the real registers is during vBlank, where I copy the phony registers to the real ones. The button presses increment the soft registers only.Controllerhead wrote: ↑Wed May 12, 2021 6:49 pmYou realize you can't read the value of the register, right? It will just read the value of the ROM at $D00x or what have you, nor will writing to it change the value that is read. You'll have to keep track of the register value(s) in RAM somewhere manually, if that's your intention.puppydrum64 wrote: ↑Wed May 12, 2021 6:13 pm Only weird thing happening now is, I have my test ROM set up so that pressing A will add 1 to the value in $D000. But for some reason it adds 2 instead, and I don't know why.
-
- Posts: 160
- Joined: Sat Apr 24, 2021 7:25 am
Re: VRC6 CHR Bank Malformed?
Yep, that helped me find the error. I forgot an RTS at the end of one of my subroutines and it ended up bleeding into the next one causing it to be called twice.unregistered wrote: ↑Thu May 13, 2021 8:37 amThis is what debuggers are made for… in Mesen, I’d create a breakpoint that triggered on your soft copy of $D000 for each read and write. (Click on the breakpoint part of the debug window and press insert to create; to edit apuppydrum64 wrote: ↑Wed May 12, 2021 7:34 pmI figured as much. What I did was create seven "soft" registers in zero page RAM. The only time I actually write to the real registers is during vBlank, where I copy the phony registers to the real ones. The button presses increment the soft registers only.Controllerhead wrote: ↑Wed May 12, 2021 6:49 pm
You realize you can't read the value of the register, right? It will just read the value of the ROM at $D00x or what have you, nor will writing to it change the value that is read. You'll have to keep track of the register value(s) in RAM somewhere manually, if that's your intention.debugbreakpoint entry, click it and press F2.) Then press F5 and play your game and press A… the debugger will stop at every read and write to that soft register. You should be able to figure out what’s happening. (F10 will step through one instruction; F5 will run your game until a breakpoint hits; if you go too far, you can step back with ALT+~ or reset and try debug process again; the breakpoints will not disappear until you delete them. )
-
- Posts: 1318
- Joined: Thu Apr 23, 2009 11:21 pm
- Location: cypress, texas
Re: VRC6 CHR Bank Malformed?
Happy it’s working for you! When we began our NES game, I forgot an rts too.