Assets for the Nesdev Compo 2016

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: Assets for the Nesdev Compo 2016

Post by Rahsennor »

This is silly I know, but will it work as intended for a UNROM game?

Code: Select all

	ldx #$FF
	stx $8000 ; select last PRG bank
	inx
	stx $5000 ; mapper 028 address $00 (CHR register)
	stx $8000 ; PRG bank 0 on UNROM, CHR bank 0 on 028
	inx
	stx $5000 ; restore mapper 028 address $01 (PRG register)
	ldx $BFFF ; 0 in bank 0, high byte of IRQ vector (>$C0) in last bank

	bmi ShowQuitOptionOnTitleScreen
To save others searching through the old threads:
tepples wrote:
thefox wrote:Just let me know what code to execute to reset to the multicart menu.
If a game is running in UNROM or 32K NROM mode, all it has to do is change the outer bank to the last bank. This can be done with the following code copied to RAM:

Code: Select all

  ldx #$81  ; Set outer bank
  stx $5000
  ldx #$FF  ; to the last bank in the cart
  stx $8000
  jmp ($FFFC)
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Assets for the Nesdev Compo 2016

Post by tepples »

The easiest way to determine whether the game has been included in one of my multicarts is to compare $FFFC (the reset vector's low byte) to the expected value of the reset vector's low byte.

Code: Select all

  lda $FFFC
  cmp #<reset
  bne ShowQuitOptionOnTitleScreen
Rahsennor
Posts: 479
Joined: Thu Aug 20, 2015 3:09 am

Re: Assets for the Nesdev Compo 2016

Post by Rahsennor »

I knew I had to be overcomplicating things. :roll:
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Assets for the Nesdev Compo 2016

Post by pubby »

I got a PM requesting the source to that animation-to-assembly program so here it is:

animate.cpp: http://pastebin.com/raw/7m5QnWtp
color.hpp: http://pastebin.com/raw/a9EP7KFp
runs.s: http://pastebin.com/raw/febfK0nh

I didn't bother cleaning it up, so user beware.

Here's an example frame to use as input:

Image

It's intended to be used for the type of animations found in Mario 3.
User avatar
Diskover
Posts: 219
Joined: Thu Nov 24, 2011 7:16 am
Contact:

Re: Assets for the Nesdev Compo 2016

Post by Diskover »

I need help.

Through this neslib-unrom I'm making a game. I managed to play music, but I can not play sound SFX.

Does anyone know how you should do? For more examples and tutorials I've seen, some of Shiru itself, not seem to work the sound.

No that's wrong.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Assets for the Nesdev Compo 2016

Post by dougeff »

Sent you a PM.
nesdoug.com -- blog/tutorial on programming for the NES
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: Assets for the Nesdev Compo 2016

Post by na_th_an »

I've updated the original post with a new revision of my tiny "Neslib for UNROM" package. I've used it successfully to produce the UNROM version of one of my compo entries (Lala the Magical).

Hope you find it useful.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Assets for the Nesdev Compo 2016

Post by dougeff »

I know this is late, but maybe somebody can still use it for the Compo, or for any NES project.

This is a scanline counter sub-routine...

(Note: one scanline = 113.667 CPU cycles)

Code: Select all

;load x with amount of scanlines to wait, should not be zero

Scanline_counter:

	ldy #11	;2 (not included in cycle count till end)
-
	nop ; 2
	nop ; 2
	dey	; 2
;branch not taken requires two machine cycles. Add one if the branch is taken
	bne -	;3 (2 on last loop) =9*11-1...98

	txa ; 2 = 100
	lsr a ; 2 = 102 (set carry half of the time)
	bcc + ;2 or 3 (depending if branch taken) = 104/5
+
	nop ; 2 = 106/7
	dex	; 2 = 108/9
	bne Scanline_counter ;3 (2 on last loop) = 111/12
		; +2 (ldy at the top)=113/114 (as stated, one less on last loop) 
		
	rts ; overhead, not counted...6
	
; short about 1 cycle every 6 lines, not counting the overhead (113.5 vs 113.667)
; examples
;ldx #6 = 5.98 scanlines
;ldx #60 = 59.90 scanlines
;ldx #240 = 239.64 scanlines
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Assets for the Nesdev Compo 2016

Post by dougeff »

I forgot to mention... this code absolutely can not cross a page boundary. It would be best to place it exactly at the start ($8000) of the ROM, so that any expansion won't accidrntally throw off the cycle count. (By putting half of the code in one page, and the other half in another, causing branches to take an extra cycle).
nesdoug.com -- blog/tutorial on programming for the NES
team_disposable
Posts: 129
Joined: Sat Oct 15, 2016 8:52 am

Re: Assets for the Nesdev Compo 2016

Post by team_disposable »

Hi Nathan,

Thanks for posting this - I used it last night to figure out how to implement tokumaru's LZSS routine. It's a really nicely designed layout.

Really useful, thanks!
na_th_an
Posts: 558
Joined: Mon May 27, 2013 9:40 am

Re: Assets for the Nesdev Compo 2016

Post by na_th_an »

You're welcome. Glad somebody found it useful.
User avatar
OscarRichard
Posts: 30
Joined: Sun Jul 29, 2012 9:58 am
Location: Mexico
Contact:

Re: Assets for the Nesdev Compo 2016

Post by OscarRichard »

Hi, I know it's too late but in fact I passed my game to Unrom mapping in order to have more data space for levels and other stuff and it was useful.

However I'm actually having the same problem above. I can play music but can't play sfx sounds.
Does someone know what's wrong? What did you do guys?

Greetings.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: Assets for the Nesdev Compo 2016

Post by dougeff »

See your other thread.
nesdoug.com -- blog/tutorial on programming for the NES
Post Reply