I Made a NES Pong Thing

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

Moderator: Moderators

Post Reply
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

I Made a NES Pong Thing

Post by nicklausw »

Yes, I know, this is my third time making pong for a console, but this is just my way with getting familiar with a console. :wink:

Anyway yeah, I ported pong to the NES. Note that this version gets no inspiration from Nerdy Nights, which can be either good or bad, I can't remember.

I had actually attempted to do this a few months ago, but on a relative's computer, as mine was getting repairs. The relative's computer freaked out and deleted the source, and my PC's hard drive was damaged past restoration, so...yeah.


The source can be found here. Written for ca65. Its throne resides in my pong repo, because three different repos for the same game is. Well. Weird.

My to do list:
* make the source code readable (more comments)
* make the AI beatable (random value magic)
* make the source build into two roms: pong_ai.nes, which is you versus the computer, and pong_vs.nes, you versus player two.

Please give as much feedback as possible. As I said, that's the main reason I keep making pong games in the first place.
Attachments
pong.nes
(16.02 KiB) Downloaded 269 times
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: I Made a NES Pong Thing

Post by dougeff »

Rather than make a better Pong, wouldn't you like to branch out into a more complex game?

Or, do what you want...
It would be nice if moving the paddle up or down during ball collision would change it's direction/speed.

ca65 has random number generator code, btw...it's under stdlib.h.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: I Made a NES Pong Thing

Post by nicklausw »

dougeff wrote:Rather than make a better Pong, wouldn't you like to branch out into a more complex game?
My dilemma is what console, what tools, and what time.
It would be nice if moving the paddle up or down during ball collision would change it's direction/speed.
Direction, I can do. Speed, I can't.
ca65 has random number generator code, btw...it's under stdlib.h.
You're talking about cc65; I'm using assembly. Will check out the C stuff, though, because it wouldn't be my first time taking something from there. ("My" NES defines)
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: I Made a NES Pong Thing

Post by dougeff »

Nope... The code is asm. Take a look. Cut/Paste it out of stdlib.h

...or maybe it was rand.s...
https://github.com/cc65/cc65/blob/maste ... mon/rand.s
nesdoug.com -- blog/tutorial on programming for the NES
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: I Made a NES Pong Thing

Post by lidnariq »

nicklausw wrote:You're talking about cc65; I'm using assembly. Will check out the C stuff, though, because it wouldn't be my first time taking something from there.
You can still call functions from the cc65 runtime even in a pure-asm project.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: I Made a NES Pong Thing

Post by dougeff »

...what lidnariq said...

I think you have to type something like...

.import _rand, _srand

And CA65 automatically knows what you're talking about... I'm away from my computer at the moment, so I can't test it. Maybe you also need to have an include. (?)

And then later...jsr _rand will put a pseudorandom number in A [and X].
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: I Made a NES Pong Thing

Post by nicklausw »

I'd rather just do copy-paste (and maybe "sorry") than go through the trouble of having to rely on the C suite.
User avatar
dougeff
Posts: 3079
Joined: Fri May 08, 2015 7:17 pm

Re: I Made a NES Pong Thing

Post by dougeff »

This worked for me...(no need to include anything)

Code: Select all

	.import		_rand
	.import		_srand

.segment	"CODE"
	;you should first put a seed value in...
	jsr _srand

	jsr _rand ;then this generates a new random number
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
rainwarrior
Posts: 8733
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: I Made a NES Pong Thing

Post by rainwarrior »

The linker would need to know where to find _rand. It's in the common lib, but you can just look at the code yourself if you like:
https://github.com/cc65/cc65/blob/maste ... mon/rand.s

Alternatively, I put a simple PRNG implementation on the wiki a while back because it kept coming up: http://wiki.nesdev.com/w/index.php/Rand ... _generator
Post Reply