It is currently Sat Oct 19, 2019 8:21 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Sep 20, 2018 4:20 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
Does anyone think I should increase the # of metatiles? Currently my code can use up to 51 (5 bytes each). But with a slight modification, that could be 102.

In my mind (before) you could swap metatile definitions for each type of level. I thought 51 should be enough.

Just wondering what other people think.

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


Top
 Profile  
 
PostPosted: Thu Sep 20, 2018 5:28 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2317
Location: Fukuoka, Japan
Since it's a tutorial for learning about the nes, yes, it should be fine. Once the user know enough to do things on their own, they can update the code and add those extra metatile they are missing. It should be part of the learning process anyway, to extend to make it work the way you want :)


Top
 Profile  
 
PostPosted: Fri Sep 21, 2018 12:58 am 
Offline

Joined: Mon May 27, 2013 9:40 am
Posts: 543
Most of my games use 16 or 32 as per "section", I think it's more than enough.

_________________
http://www.mojontwins.com


Top
 Profile  
 
PostPosted: Fri Sep 21, 2018 7:08 am 
Offline
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 627
Location: Central Illinois, USA
Banshaku wrote:
Since it's a tutorial for learning about the nes, yes, it should be fine. Once the user know enough to do things on their own, they can update the code and add those extra metatile they are missing. It should be part of the learning process anyway, to extend to make it work the way you want :)


Agreed. It's a tutorial, not an all-purpose framework. Arbitrary limitations are fine. People following your tutorials are eventually going to have to learn to do things themselves.

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
PostPosted: Fri Sep 21, 2018 10:38 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
True. Just trying to anticipate "how do I expand your code to do X" questions.

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


Top
 Profile  
 
PostPosted: Tue Dec 11, 2018 6:55 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
I wrote a function for changing song speed manually (a while back).

It occurred to me today, as I was working on music code, that you could have greater flexibility over song speed, AND not interfere with Fxx effects if you instead adjusted the FT_TEMPO_STEP_L and FT_TEMPO_STEP_H.

Bigger for faster.

I might edit my code... later (I'm busy).

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


Top
 Profile  
 
PostPosted: Tue Sep 17, 2019 11:25 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
Updated the neslib Sprite functions to remove the "sprid" parts. one sprite is 11% faster, metasprite is 5% faster. fewer passed arguments = faster.

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


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 12:30 am 
Offline
User avatar

Joined: Sat Aug 31, 2019 2:12 pm
Posts: 17
Hi! Thanks for the update! :)

I've been trying to "load" it into 8bitworkshop, but without success yet.
No matter what I do, a reference to the "old" neslib is probably hardcoded somewhere in their IDE.
I'll keep trying, nevertheless.

@Doug, is neslib.h and neslib.s independent from nesdoug.h and nesdoug.s?

_________________
Image


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 12:59 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3737
Location: Indianapolis
wonder wrote:
I've been trying to "load" it into 8bitworkshop, but without success yet.
No matter what I do, a reference to the "old" neslib is probably hardcoded somewhere in their IDE.


You could try the LIBARGS special command, put it in the comments like here (but add in crt0, that's for an assembly example):
viewtopic.php?f=2&t=19215#p242505

It implies that crt0 and neslib are linked by default.


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 4:13 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
Quote:
is neslib.h and neslib.s independent from nesdoug.h and nesdoug.s?


Correct. neslib was written by Shiru 6 years. The version in 8bitworkshop is a more recent fork. The version that I use is also an unrelated fork, which I modified yesterday.

nesdoug is code specific to my tutorial, and meant to be a companion library to neslib, which I felt was not complete.

But you can make a complete game without the nesdoug files, you will just not be able to follow my tutorial.

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


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 7:15 am 
Offline
User avatar

Joined: Sat Aug 31, 2019 2:12 pm
Posts: 17
I've started to setup an NES development environment on my Ubuntu VM.

I can compile and run 01_Hello without problems.

Instructions:
Code:
# Install an emulator (eg. Nestopia)
sudo apt install nestopia

# Install CC55
cd $HOME
mkdir -p nes && cd nes
git clone https://github.com/cc65/cc65.git
make

# Add CC65 to your path environment variable
echo '# NesDev' >> $HOME/.bashrc
echo 'export CC65_HOME="$HOME/nes/cc65"' >> $HOME/.bashrc
echo 'export PATH="$PATH:$CC65_HOME/bin"' >> $HOME/.bashrc


Now you can git clone the 01_Hello repository.
The windows file 'compile.bat' won't work here,
so I created a new file named 'compile.sh':

Code:
#!/bin/bash

name="$1"

cc65 -Oirs "$name.c" --add-source
ca65 crt0.s
ca65 "$name.s" -g

ld65 -C nrom_32k_vert.cfg -o "$name.nes" crt0.o "$name.o" nes.lib -Ln labels.txt

rm *.o

mv labels.txt  BUILD/
mv "$name.s"   BUILD/
mv "$name.nes" BUILD/

nestopia "BUILD/$name.nes"


When done, don't forget to
Code:
chmod +x compile.sh


Now it's simple:
Code:
# Assuming 01_Hello exists in 'projects'
cd $HOME/nes/projects
cd 01_Hello
./compile.sh hello


I'll convert the bash script to a Makefile when I have some time. :)

_________________
Image


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 11:15 am 
Offline

Joined: Thu Nov 24, 2011 7:16 am
Posts: 213
dougeff wrote:
Updated the neslib Sprite functions to remove the "sprid" parts. one sprite is 11% faster, metasprite is 5% faster. fewer passed arguments = faster.


Where I download it? I've looked at your github but I don't see it.

_________________
Projects:
Shadow of the Beast (port)
The Sword of Ianna
The Banketh - The Video Game

My website: RetroNES


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 1:28 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
Every tutorial, from 01_Hello to 29_Powerpad.

In main folders, crt0.s changed to include SPRID as an internal variable.

In LIB folders, neslib.h and neslib.s updated. oam_spr() and oam_meta_spr() specifically.

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


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 2:43 pm 
Offline
User avatar

Joined: Sat Aug 31, 2019 2:12 pm
Posts: 17
@Dougeff, in neslib.h you have the following declaration:
Code:
//set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
//returns sprid+4, which is offset for a next sprite
// Note: sprid removed for speed
void __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr);


The docstring says it returns something, but the return type is void. I would suggest:
Code:
//set sprite in OAM buffer, chrnum is tile, attr is attribute, sprid is offset in OAM in bytes
//increments the sprid by 4 bytes, which is the offset for the next sprite
// Note: sprid removed for speed
void __fastcall__ oam_spr(unsigned char x,unsigned char y,unsigned char chrnum,unsigned char attr);

_________________
Image


Top
 Profile  
 
PostPosted: Wed Sep 18, 2019 4:22 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2575
Location: DIGDUG
Fixed. Removed old comments about return values.

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 30 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: 8bitMicroGuy, Google Adsense [Bot], MSN [Bot] and 4 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