Page 3 of 7

Re: NES Programming Blog

Posted: Thu Feb 04, 2016 9:58 pm
by dougeff
I tried it, works perfectly, I'm going to update the MIDI section to indicate the better method, Bavi_H.

Options/Preferences/MIDI/ 96 ticks per quarter note.

You get 4 rows per note in Famitracker 0.4.2, through MIDI import.

Re: NES Programming Blog

Posted: Thu Feb 11, 2016 9:36 am
by heardtheword
Very nice tutorials! I didn't even realize C was an option for NES programming.

You might want to consider adding a slight background to the code examples so it's easier to tell what is code instead of explanation. Otherwise, great stuff!

Re: NES Programming Blog

Posted: Thu Feb 11, 2016 10:57 am
by dougeff
Thanks, I'll consider making color changes to the code...probably better I should improve the code, maybe.

I'm considering adding a few pages on ASM lessons, but I'm not sure how I should organize it. I don't want to go alphabetically, as some documents do...I wanted to start with simple LDA, STA...but it occurred to me that some of the more complicated LDA modes (indirect) probably shouldn't go on the first page...

Maybe I should start with math and bit shifting, and simple zero page LDA, STA.

Re: NES Programming Blog

Posted: Thu Feb 11, 2016 4:24 pm
by Sogona
dougeff wrote:I'm considering adding a few pages on ASM lessons, but I'm not sure how I should organize it. I don't want to go alphabetically, as some documents do...I wanted to start with simple LDA, STA...but it occurred to me that some of the more complicated LDA modes (indirect) probably shouldn't go on the first page...

Maybe I should start with math and bit shifting, and simple zero page LDA, STA.
I'd say start with explaining what the Accumulator and index registers are, and then introducing LDA, STA; LDX, STX; LDY, STY. Then explain the difference between an address and an immediate value (With maybe a brief mention of the zero-page). After that, you could gradually introduce new instructions, categorized by math, bitwise operations, logic, etc., and then later on go into more advanced addressing methods like Indexed and Indirect.

Just an idea.

Re: NES Programming Blog

Posted: Tue Feb 16, 2016 9:42 am
by Diskover
First of all , thank dougeff for the work he has done in his blog. He had long needed a tutorial and hands. I must also apologize for my bad English . This post has been translated by Google translator .

However , there are many things that escape me despite being fairly well explained .

My radical doubt ignorance when it comes to creating longer than two simple horizontal scroll Nametables levels.

How I can do to make the updating nametable go slowly while the background moves ?

Thank you.

PD: en español debajo de estas lineas.

Antes de nada, dar las gracias a dougeff por el trabajo que ha hecho en su blog. Hacía tiempo que necesitaba tener un tutorial así entre manos. También debo disculparme por mi mal ingles. Este post ha sido traducido mediante Google Traductor.

No obstante, hay muchas cosas que se me escapan pese a estar bastante bien explicado.

Mi duda radical en el desconocimiento a la hora de crear niveles más largos que dos simples Nametables en scroll horizontal.

¿Como puedo hacer para que el nametable se vaya actualizando poco a poco mientras avanza el background?

Gracias.

Re: NES Programming Blog

Posted: Tue Feb 16, 2016 10:27 am
by tepples
Keep the camera position in a variable. This camera position defines what area is visible. From it, you can calculate the position of the column of tiles that is next to appear. If the camera has not yet advanced to a new column of tiles, there's nothing new to see, so don't update anything. But if it has, then prepare a list of tile numbers, and then copy it into nametable memory during the next vblank.

Image
The camera, represented by a red bracket, has advanced into the column of blocks that need to be updated.

Re: NES Programming Blog

Posted: Tue Feb 16, 2016 4:27 pm
by dougeff
To add a bit...

'camera position' = Horizontal Scroll, the first number stored at register $2005

When Horizontal Scoll rolls over (>255) you tell it to change base nametables, controlled by the $2000 register.

xxxx xx00 = nametable #0, left screen
xxxx xx01 = nametable #1, right screen

Nerdy Nights also has a tutorial on this...

http://nintendoage.com/forum/messagevie ... adid=36958

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 9:17 am
by Diskover
The truth is that this is very complicated . At the end I relied on lesson number 11 dougeff to get done scrolling .

I climb a small demo: https://www.dropbox.com/home/public/NES ... 022016.nes

Why did the rare artifacts appear in the sky ? My NameTable is not it. By not charging it :roll:

Image

PD : Remember that 'm programming based on the lessons dougeff

Spanish:
La verdad es que esto es muy complicado. Al final me he basado en la lección número 11 de dougeff para conseguir hacer scrolling.
Os subo una pequeña demo.
¿Por que me aparecen los artefactos raros en el cielo? Mi Nametable no es así. No se por que carga eso :roll:

PD: Recordad que estoy programando basandome en las lecciones de shiru

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 9:32 am
by dougeff
Definitely attribute table has wrong color palette defined for those bits of screen. Maybe you're writing too many byes to the PPU, and it's corrupting the attribute table.

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 10:13 am
by Diskover
dougeff wrote:Definitely attribute table has wrong color palette defined for those bits of screen. Maybe you're writing too many byes to the PPU, and it's corrupting the attribute table.
Mmmm , I've been messing with the code of the lesson 10 and if I modify the allocation of tiles from heaven , the same fault occurs.

Simply assigning address 1 where previously put 0 in the tiles, and skips the error.

const unsigned char METATILES[]={
0, 0, 0, 0, //0 sky
....

Image

const unsigned char METATILES[]={
1, 1, 1, 1, //0 sky
...

Image

Could it be a problem of the code itself ? Any misconfiguration ?

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 10:19 am
by dougeff
I'll look at it later today.

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 10:23 am
by Diskover
dougeff wrote:I'll look at it later today.
Thanks!!! :P

Re: NES Programming Blog

Posted: Sat Feb 20, 2016 2:42 pm
by dougeff
Apparently I forgot how to do math when I wrote this one, and it was only by dumb luck that it worked to begin with.

The tile buffering system was buggy...each was overflowing into the next one because...

(in BufferMT.c)...

while (index < 16){

should have been...

while (index < 15){

Since the screen is only 15 metatiles high (*16 pixels = 240)...and it should index from 0-14.

And I also increased the buffer sizes (in lesson11.c)...slightly larger than we need, but now easier to read in the hex editor debugging tool...

unsigned char BUFFER1[32];//left column 1
unsigned char BUFFER2[32];//right column 1
unsigned char BUFFER3[32];//left column 2
unsigned char BUFFER4[32];//right column 2

(before I erroneously had them 26, but was indexing up to 30).

Anyway, the link has been updated...sorry for the trouble.

http://dl.dropboxusercontent.com/s/08oi ... sson11.zip

Re: NES Programming Blog

Posted: Sun Feb 21, 2016 7:47 am
by Diskover
Ouh yeah!!! Thank you dougeff :D

Indeed , that was the problem . I keep messing with this demo. :wink:

Re: NES Programming Blog

Posted: Sun Feb 21, 2016 2:26 pm
by Diskover
Continuing research the code, I decided to increase the number of rooms 4 to 5 (for example)

I created a new CSV called A5.csv
I stuck a #include " BG / A5.csv "
In the array ROOMS [ ] I added (int) & A5
In move_logic() function, variable Room &= 3 converted it to 4.
In New_Room() function, RoomB &= 3 variable became to 4.
In the main() function, RoomPlus &= 3 variable became to 4.

Still, I can not get this new room appears.

Am I skipping a step?

Spanish:
Continuando con la investigación del código, me propuse aumentar el numero de habitaciones de 4 a 5 (por ejemplo)

Creé un nuevo CSV llamado A5.csv,
Metí un #include "BG/A5.csv"
En el array ROOMS[] añadí (int) &A5
En la función move_logic, la variable Room &= 3 la convertí a 4.
En la función New_Room, la variable RoomB &= 3 la convertí a 4.
En la función main, la variable RoomPlus &= 3 la convertí a 4.

Pese a todo, no consigo que aparezca esta nueva habitación.

¿Me estoy saltando algún paso?