It is currently Sat Oct 21, 2017 10:51 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: How to draw sprite?
PostPosted: Thu Mar 23, 2017 11:26 am 
Offline

Joined: Thu Mar 23, 2017 11:23 am
Posts: 24
Hello.
I'm learning NES programming. I use C as main language(cc65 compiler).
How to draw sprite on screen?


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 12:26 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1781
Location: DIGDUG
Someone should really write a tutorial or blog about this. :wink:

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 12:29 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1306
Write a few bytes to some RAM dedicated to being an OAM buffer ($200-$2FF often), and then start an OAM DMA by writing whatever you feel like to $4014 (OAMDMA).

OAM properties: https://wiki.nesdev.com/w/index.php/PPU_OAM

The register to begin a DMA: https://wiki.nesdev.com/w/index.php/PPU ... ers#OAMDMA

Doing it in C isn't particularly different, though I'm not positive what the most semantically correct way of ensuring your sprite buffer is page-aligned is using cc65.


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 1:38 pm 
Offline

Joined: Thu Mar 23, 2017 11:23 am
Posts: 24
mikejmoffitt wrote:
Write a few bytes to some RAM dedicated to being an OAM buffer ($200-$2FF often), and then start an OAM DMA by writing whatever you feel like to $4014 (OAMDMA).

OAM properties: https://wiki.nesdev.com/w/index.php/PPU_OAM

The register to begin a DMA: https://wiki.nesdev.com/w/index.php/PPU ... ers#OAMDMA

Doing it in C isn't particularly different, though I'm not positive what the most semantically correct way of ensuring your sprite buffer is page-aligned is using cc65.

Any example?


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 1:40 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10065
Location: Rio de Janeiro - Brazil
Some developers have released the source code for projects they've written in C. Look for Shiru's games, for example.


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 2:57 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1781
Location: DIGDUG
Also, Mojon Twins program in C with Shiru's neslib. I believe they've released source code. (It might have comments in Spanish).

http://www.mojontwins.com/juegos_mojonos/

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 3:39 pm 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 351
Nope, comments are in English. I keep development diaries, but they are in Spanish, sadly. They could be interesting.

Our nesdev compo entries @ github:

https://github.com/mojontwins/Wo-Xiang-Niao-Niao
https://github.com/mojontwins/Lala
https://github.com/mojontwins/GoddessR

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 5:09 pm 
Offline

Joined: Thu Mar 23, 2017 11:23 am
Posts: 24
I'm Russian, i can't understand Spain.
Thanks for links, i take look at neslib.
But what about normal docs?


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Thu Mar 23, 2017 5:41 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1781
Location: DIGDUG
Shiru is Russian. He sometimes answers questions on the NintendoAge forum.

His website, btw https://shiru.untergrund.net

Many of his source codes are posted there also.
And, look for a download on this page https://shiru.untergrund.net/articles/p ... s_in_c.htm
...called "these small example programs"

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Fri Mar 24, 2017 12:47 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 351
What dougeff has linked is what got me started. I wrote my first game with the info contained in Shiru's article and an early incarnation of neslib, and this site's wiki for HW reference.

_________________
http://www.mojontwins.com


Top
 Profile  
 
 Post subject: Re: How to draw sprite?
PostPosted: Fri Mar 24, 2017 8:35 am 
Offline

Joined: Thu Mar 23, 2017 11:23 am
Posts: 24
I send private message to shiru in VK.
Thanks :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 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