It is currently Tue Nov 20, 2018 8:29 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 40 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sun Nov 16, 2014 11:41 pm 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
I have a little n00b question regarding the MMC1. When I bankswitch the CHR background like this

LDA #%00000010 ;Swap background
JSR Background_Select ;Go to $C000 bankswitching subroutine

;Rest of code here

Background_Select:
STA $C000
LSR A
STA $C000
LSR A
STA $C000
LSR A
STA $C000
LSR A
STA $C000
RTS

It works fine on an emulator. However, on real hardware, it seems like there is no such thing, the name entry screen of Deal or no Deal keeps the title background CHR bank. What am I doing wrong?

Here are the pics

Emu
Image
Real Hardware
Image (Uses the title screen CHR bank)


Last edited by Vectrex2809 on Tue Nov 18, 2014 1:31 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sun Nov 16, 2014 11:57 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7723
Location: Seattle
Have you also configured the other MMC1 registers?


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 12:20 am 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
You mean the PRG bank, Sprites CHR bank and $8000? I did.
Here it is (sorry for the pic. My Iphone didn't want to select the text...)
Image


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 12:38 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 3138
Location: Tampere, Finland
If you're using a flash cart to test, make sure the number of CHR banks in your ROM is a power of two (1, 2, 4, 8, and so on).

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 12:39 am 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7723
Location: Seattle
Are you trying to use different background banks in different parts of the screen?


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 12:43 am 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
lidnariq wrote:
Are you trying to use different background banks in different parts of the screen?


Nope. I think Fox is right though, I have 5 CHR banks in my game. Gonna fix that this evening and I'll update you guys :)


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 8:46 am 
Offline
Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2264
You also need to initialize the first background, too. Boot state is random, y ou have to set up everything how you want it first before you can assume any graphics will show. :)


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 8:54 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20791
Location: NE Indiana, USA (NTSC)
3gengames wrote:
You also need to initialize the first background, too. Boot state is random, y ou have to set up everything how you want it first before you can assume any graphics will show. :)

I assume that's what this is for:
Code:
  LDA #%00000001
  JSR Sprite_Select


Top
 Profile  
 
PostPosted: Mon Nov 17, 2014 11:49 pm 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
Hey,
It seems like it works now... Kinda. I still have one bankswitching problem. At some point in the game, you have to select a character. There are 6 banks with five characters in each bank. On an emulator, it works as it should (Starts at bank 03, then goes to bank 04, etc. until bank 8). On real hardware (Tried the Everdrive and the PowerPak), it starts at bank 03, then goes back to bank 00 for some reason, then bank 01, but finishes with bank 08 as it should. Anyone knows what's wrong?

Code:

  LDA buttons
  AND #%00000001
  BEQ NoCharRightUnpressed  ;Not the best way of doing this, I know
  LDA rightpressed                  ;If right is already pressed, don't do the folowing
  BNE NoCharRight                  ;There are better ways to do this, I should change it...
  INC rightpressed
  INC CharNumber
  LDA CaseCharacter               ;Characters are like 3x6 metatiles, this seems to work
  CLC
  ADC #$03
  STA CaseCharacter
  CMP #$6E
  BCC .nochange3
  LDA #$60
  STA CaseCharacter
  INC CaseGraphicBank              ;Here's the main culprit >:(. On real hardware, goes back to zero...
  LDA CaseGraphicBank
  CMP #$09                               ;If higher than $08, set $03
  BNE .chrbankok3
  LDA #$03
  STA CaseGraphicBank
.chrbankok3                              ;There used to be the CHR bank switch subroutine here, but I put it at the beginning of the char selection routine in order to fix a minor glitch
.nochange3
  LDA Character_Palette             ;Sets the palette for the characters. This seems to work too
  CLC
  ADC #$03
  CMP #PALETTEEND
  BCC .nopalend
  LDA #$00
.nopalend
  STA Character_Palette


This is the routine to go to the next character. The routine when pressed left looks similar except it's kind of the opposite thing that happens. Tell me if you need me to post more code. I'll take my src with me today :) Thanks everyone! You've been of great help so far.


Top
 Profile  
 
PostPosted: Wed Nov 19, 2014 11:39 pm 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
Rewrote my routine, but I have the same problem on real hardware using flashcarts... Please help me :)

Code:
  LDX CharNumber
  LDA case_bank,x
  JSR Background_Select   ;$C000 MMC1 writes

;Blahblahblahworkingcodeblahblahblah

case_bank:
  .db $03,$03,$03,$03,$03,$04,$04,$04,$04,$04,$05,$05,$05,$05,$05
  .db $06,$06,$06,$06,$06,$07,$07,$07,$07,$07,$08,$08,$08,$08,$08

Do you know what's wrong?

--Vec


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 3:13 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7580
Location: Chexbres, VD, Switzerland
Pehaps you shoud describe us more in detail what
1) what you are trying to do
2) what do you exepct your results to be
and
3) what is wrong with your actual results

so we can have a clue how to help you ? Just some code is not enough.

The only 2 tricks with the MMC1 are
1) You need to "reset" the mapper at startup (but you only have to do it once, as long as you're sure you always write in bulks of 5 writes)
2) You should not use the mapper in the interrupt routine at the same time you use it in the main program. If you do that, both writes can (and will) conflict. Even if you don't write to the same MMC1 register : The MMC1 has only one "shift register" for input, and the 4 real (internal) registers are written to after the last write of the bunch of 5.

PS : Also you didn't mention which emulators you used, but you should really debug with Nintendulator which is the most accurate to real hardware. When there is a different between real hardware and normal emulators, often Nintendulator and Nestopia are the 2 only ones to emulate the "correct" behaviour (but Nestopia has no debugger).


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 10:16 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4106
The number of PRG or CHR banks must be a power or 2. So you can't have 5 banks, need to pad it with empty banks to 8.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Thu Nov 20, 2014 10:20 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7723
Location: Seattle
Also, base 0, not base 1 ... if you have eight banks, they're numbered 0 through 7.


Top
 Profile  
 
PostPosted: Sun Nov 23, 2014 10:34 am 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
Actually, it was the number of banks again. Thanks for the replies :)


Top
 Profile  
 
PostPosted: Sun Nov 23, 2014 10:41 am 
Offline
User avatar

Joined: Mon Jul 14, 2014 6:05 am
Posts: 90
Location: Lausanne, Switzerland
Bregalad wrote:
Pehaps you shoud describe us more in detail what
1) what you are trying to do
2) what do you exepct your results to be
and
3) what is wrong with your actual results

so we can have a clue how to help you ? Just some code is not enough.

The only 2 tricks with the MMC1 are
1) You need to "reset" the mapper at startup (but you only have to do it once, as long as you're sure you always write in bulks of 5 writes)
2) You should not use the mapper in the interrupt routine at the same time you use it in the main program. If you do that, both writes can (and will) conflict. Even if you don't write to the same MMC1 register : The MMC1 has only one "shift register" for input, and the 4 real (internal) registers are written to after the last write of the bunch of 5.

PS : Also you didn't mention which emulators you used, but you should really debug with Nintendulator which is the most accurate to real hardware. When there is a different between real hardware and normal emulators, often Nintendulator and Nestopia are the 2 only ones to emulate the "correct" behaviour (but Nestopia has no debugger).


I used FCEUX and NEStopia. I'm gonna give Nintendulator a go, thanks for the advice. I also heard about puNes being accurate, is that the case?
As for next time, I'm going to ask questions in a better way, sorry for the confusion :P

PS : Tu viens du Canton de Vaud toi aussi?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 40 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group