CHRRAM question.

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Hamtaro126
Posts: 786
Joined: Thu Jan 19, 2006 5:08 pm

CHRRAM question.

Post by Hamtaro126 »

I am making SMB2/USA use both CHRRAM and CHRROM using pirate mapper 74 (MMC3 variant) for a DDP-Style Waterfall. I wanted to make the CHRRAM load it's chr in $1800 of the PPU. The problem is it doesn't load right with any of the routines I have. They Lack the Null terminator and it's routines.

How will I load CHRRAM while ending at a certain place using this example:

Code: Select all

.index 8
.mem 8
.org $ae60

StartCHR:
	lda #$18		;point $2007 to address $1800.
	sta $2006
	lda #$00		
	sta $2006		

charload:
	lda <CHRRAM	;get low byte of chr data
	sta <$80        	;store in $80
	lda >CHRRAM     	;get high byte of chr data
	sta <$81	        ;store in $81
	LDY #$00		;load y with 0

charloop:
  	LDA ($80),Y		;load <$80, which contains low byte of char with the contents of y, which is 0 at the moment.
  	STA $2007		; store in $2007
  	INY			;increase y
  	BNE charloop		;if the V flag isn't set, keep looping

  	INC <$81			;increase <$81, which has the high byte of char
  	LDA <$81			;load <$81
  	CMP #$A0		;if the high byte isn't FF
  	BNE charloop		;keep looping
	RTS

CHRRAM:
    .incbin "CHRRAM1.CHR"
I based it off of the ''Hello World CHRRAM version'' from Poultry Games's Website. If it needs any more fixes than this, then tell me.
Last edited by Hamtaro126 on Mon Aug 18, 2008 1:54 pm, edited 1 time in total.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

Or you could just grab the Prototype version of SMB2?

There are a few logistical problems with your approach... 1800 is a rapidly changing bank. If you want everything else to animate, but keep the water moving fast, you'll have to put the water in a CHR area.
Last edited by Dwedit on Sun Aug 17, 2008 7:52 pm, edited 1 time in total.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Hamtaro126
Posts: 786
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

Dwedit wrote:Or you could just grab the Prototype version of SMB2?
That is where the waterfall routine for CHRRAM is coming from. Before I even do that, I must load CHRRAM for the part of the bank.

I know it doesn't, Just needs one,

And I meant $1800 is the PPU address. not RAM. and as Disch's Mapper Docs said. I used CHR-RAM by deleteing CHR-ROM animation in that area and putting it in bank $08. the sprites are also in a different CHR-ROM location.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: CHRRAM question.

Post by tepples »

Hamtaro126 wrote:I am making SMB2/USA use both CHRRAM and CHRROM using pirate mapper 74 (MMC3 variant)
Is that more common than a TQROM?
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

If you want more than 64KB of CHR ROM, you need mapper 74
and obviously this is a romhack for use in emulators only
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Hamtaro126
Posts: 786
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

People can hack a MMC3 to use CHRRAM and CHRROM at the same time. Just needs some scheme to do it.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: CHRRAM question.

Post by Bregalad »

Hamtaro126 wrote:

Code: Select all

	sta <$81        	;store in $80
No comment

Also, you should "bankswtich" the CHRRAM in place, write to it is not enough.
Useless, lumbering half-wits don't scare us.
User avatar
Hamtaro126
Posts: 786
Joined: Thu Jan 19, 2006 5:08 pm

Re: CHRRAM question.

Post by Hamtaro126 »

Bregalad wrote:
Hamtaro126 wrote:

Code: Select all

	sta <$81        	;store in $80
No comment

Also, you should "bankswtich" the CHRRAM in place, write to it is not enough.
Oops, That is fixed,

Also, I already switched it according to Disch's Mapper 74 document as Bank $08. $09 is used with it, As it is in a ''fixed'' CHR bank.

EDIT: It seems to not want to upload to the CHRRAM at all. Can anyone see what is wrong?
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Code: Select all

   lda <CHRRAM   ;get low byte of chr data
   sta <$80           ;store in $80
   lda >CHRRAM        ;get high byte of chr data
   sta <$81           ;store in $81 
I'm assuming you wanted:

Code: Select all

   lda #<CHRRAM   ;get low byte of chr data
   sta $80           ;store in $80
   lda #>CHRRAM        ;get high byte of chr data
   sta $81           ;store in $81 
Since this looks like x816, I don't think you need the < for zero page mode like nesasm requires. < has a different purpose (gets low byte of an address). In either case, you still need the # to indicate immediate mode.

Also... many of your comments are wrong. I'm guessing they're hold overs from a copy/paste job and you edited the code without editing the comments?
Post Reply