This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

How to draw sprite?

How to draw sprite?
by on (#191742)
Hello.
I'm learning NES programming. I use C as main language(cc65 compiler).
How to draw sprite on screen?
Re: How to draw sprite?
by on (#191743)
Someone should really write a tutorial or blog about this. :wink:
Re: How to draw sprite?
by on (#191744)
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.
Re: How to draw sprite?
by on (#191748)
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?
Re: How to draw sprite?
by on (#191749)
Some developers have released the source code for projects they've written in C. Look for Shiru's games, for example.
Re: How to draw sprite?
by on (#191751)
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/
Re: How to draw sprite?
by on (#191753)
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
Re: How to draw sprite?
by on (#191760)
I'm Russian, i can't understand Spain.
Thanks for links, i take look at neslib.
But what about normal docs?
Re: How to draw sprite?
by on (#191762)
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"
Re: How to draw sprite?
by on (#191781)
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.
Re: How to draw sprite?
by on (#191796)
I send private message to shiru in VK.
Thanks :)