Family BASIC Lessons

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

Who knows, the engine of this program can support sprites larger than 2x2 tiles?
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

The command DEF SPRITE allows you to define each 8x8 sprite (OAM entry) manually, if I remember correctly, while DEF MOVE will automatically make an animated 2x2 character metasprite. It was a long time ago I played around with this so I can't really help, sorry.
lancuster wrote:How to paste code into Nestopia?
It's in the emulator menu I think. Or just press F12.
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

So I can insert sprites Mario or another character from another game without any changes? I'm asking to know if the game will work normally after I specify a larger number of tiles.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

Yes it should work. Though I'd test with a few sprites first to make sure it works as you expect. You need to follow the same format for animations to work.

I checked the manual and it seems DEF SPRITE doesn't simply make an OAM entry as I thought. It makes an animated 2x2 character big metasprite if you pass a 1 to parameter B (as explained in the manual on page 88). You have to pass 0 to parameter B if you only want a single 8x8 dot sprite (but it's also animated).

Just remember that doing bigger metasprites is going to take more code and therefore also use up more program memory.
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

Clear. How to use the editor background and music which commands are responsible for it? I tried to draw back, but nothing happened.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

The background editor is accessed from a new command in V3, you type BGTOOL (in earlier versions you just access it from the BASIC menu). V3 also allows saving the background to battery RAM. Read the original manual (not the V3 manual) on how to use it, and read the V3 manual to see how you save and such in V3.

Sound is done using an MML (Music Macro Language) which allows you to use the APU's two square channels and the triangle channel. It's done with the PLAY command (page 80~81 in the original manual). Sound effects are simple to do in MML, but if you want to make background music that runs in parallel to your game using MML, you'll have to write a sound engine that runs every main loop of your program.

For the noise channel you either have to POKE the APU registers or write the sound engine in 6502 subroutines and CALL them.
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

I understand that a "spacebar" is responsible for the printing of tiles on the screen, and F1-F4 - for their palette. But I don't know how to choose the other tiles.
Also I wanted to clarify, whether the use of abbreviations to save more space for code.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

Have you downloaded the manual at all? It explains how to use the editor better than I can.

Yes if memory is a concern you can sacrifice readability by using more abbreviations and cut down on spaces (the interpreter mostly ignores spaces). I've never done it, but I also never done a big enough project where memory became a problem.
Attachments
fabaman-t_v1.0.txt
The rest of the manual is in this text file, but it's mostly not related to BASIC.
(43.32 KiB) Downloaded 166 times
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

It turns out that the program can only play 7 notes plus the change of tone and other indicators?..
By the way, about BGTOOL in this document is not a word. Give me some examples or tutorials.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

lancuster wrote:It turns out that the program can only play 7 notes plus the change of tone and other indicators?..
The MML gives you full control of the square duty cycle setting (Y0~Y3), hardware saw envelope flag (M1 and M0 for on and off respectively) and volume (V0~V15, V0 is silent and V15 is loudest, only works for square channel and if saw envelope is off). You also have six full octaves (O0~O5) with twelve notes each (A~#F, plus a "rest" note R), eight levels of tempo per note (T1~T8) and a length counter per note (x0~x9).
Square channel 1 is called channel A in the manual, Square channel 2 is B and the Triangle channel is C. You can play all three of them at the same time as explained in the manual (multiphonic).

Making a sound engine in Family BASIC is probably very memory consuming so it's quite rare to see games with background music. Most games only use it for sound effects or when playing a short Title Screen or Game Over melody when the game isn't accepting input from the player, so that a sound engine isn't needed.
By the way, about BGTOOL in this document is not a word. Give me some examples or tutorials.
BGTOOL is a command in V3 only, and the original manual doesn't mention it. The name of the actual editor is BG GRAPHIC. Usage is explained on page 40 in the manual. The main difference in V3 is that you don't type SYSTEM (that will shut down the game), instead you type BGTOOL to access it. Read from page 40 and ask again if there's something that's not clear.


The V3 manual can be found here. I included the translation in the attachment of this post.
Attachments
fambasv3_t.txt
Translated V3 manual. Translation is incomplete but the most important parts are translated, including the register for the commands that are new in V3 and how to use the new backup features.
(41.06 KiB) Downloaded 164 times
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

I just got back to deal. :wink:
I would like to find out what values are responsible for including BIGTOOL and other commands that can't be entered on a standard keyboard, due to the lack of such keys. Who can tell how to find these values in the ROM to move commands to existing keys for programming without a proprietary keyboard?
Like this:
CTRL+W - change language to English
CTRL+V - change language to Japanese
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Family BASIC Lessons

Post by Pokun »

It's BGTOOL not BIGTOOL and doesn't require any special characters to enter. But it's only available in V3. If it doesn't work I guess you are running V1 or V2.

I'm not sure what you are talking about standard keyboard. There is only one keyboard for Famicom unless you are using a Famiclone one? Or are you running on an emulator? The emulator should emulate all keys, but it may fail to support all PC keyboards. Some emulators doesn't allow my Swedish keyboard to use all keys (I forgot which).

For control codes look at page 104 in the manual. For example CTR+V is the same as the kana key and CTR+W goes back into alphanumeric mode. CTR+G is the same as entering BEEP and the most useful of all: CTR+D (restores sprites, palettes etc to default).
lancuster
Posts: 235
Joined: Thu Feb 18, 2016 3:20 am
Contact:

Re: Family BASIC Lessons

Post by lancuster »

Pokun wrote:It's BGTOOL not BIGTOOL and doesn't require any special characters to enter. But it's only available in V3. If it doesn't work I guess you are running V1 or V2.

I'm not sure what you are talking about standard keyboard. There is only one keyboard for Famicom unless you are using a Famiclone one? Or are you running on an emulator? The emulator should emulate all keys, but it may fail to support all PC keyboards. Some emulators doesn't allow my Swedish keyboard to use all keys (I forgot which).

For control codes look at page 104 in the manual. For example CTR+V is the same as the kana key and CTR+W goes back into alphanumeric mode. CTR+G is the same as entering BEEP and the most useful of all: CTR+D (restores sprites, palettes etc to default).
On the emulator. I tried to find the missing keys on the keyboard (like "GRAPH") and didn't find them. On Virtuanes doesn't want to be printed ":" and ";". Because STТONES only supports Virtuanes, I'll have to have programming on it.
Image
User avatar
Gilbert
Posts: 564
Joined: Sun Dec 12, 2010 10:27 pm
Location: Hong Kong
Contact:

Re: Family BASIC Lessons

Post by Gilbert »

The online help of VirtuaNES lists some of the key assignments:
STOP: End
CLR/HOME: Home
GRAPH: Press and hold/release PageDown,PageUp
KANA: F12
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Family BASIC Lessons

Post by tepples »

Gilbert wrote:GRAPH: Press and hold/release PageDown,PageUp
How practical is that on laptops where PageDown and PageUp are behind the Fn modifier key? On a Dell Inspiron 11 3000 series, for example, they're Fn+Down and Fn+Up.
Post Reply