Welcome, Guest. Please login or register.
Did you miss your activation email?
May 20, 2019, 05:53:27 AM
Home Famicom World Search Calendar Login Register

+  Famicom World
|-+  Family Computer
| |-+  Famicom / Disk System (Moderators: manuel, L___E___T)
| | |-+  The (unofficial) Family BASIC reference manual *now with new revision!*
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: The (unofficial) Family BASIC reference manual *now with new revision!*  (Read 9630 times)
infiniteNOP
Famicom
**
Posts: 33


« on: November 03, 2013, 05:08:36 AM »

Hello everyone,
I made a reference manual for Famicom's FAMILY BASIC V3. It is licensed under CC-BY-SA (http://creativecommons.org/licenses/by-sa/3.0/).
You can download it from http://www.filedropper.com/famibasicrefference (PDF file) and http://www.filedropper.com/famibasicrefference_1 (ODT source).
EDIT:Download from attachments section!
The current revision is: 2
Feedback is always appreciated! Smiley
NOTE:If you cannot see the attachments section, then please log in/register
« Last Edit: May 31, 2014, 07:33:28 AM by linuxlalala » Logged

Previously known as linuxlalala
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #1 on: November 08, 2013, 10:41:57 AM »

Good job on this Linuxlalala! Smiley
A few comments.

Correct me if I'm wrong, but although jump instructions like GOTO and GOSUB may be considered bad practice by C programmers, in the case of BASIC and machine languages they are more or less necessary.

RESTORE command is explained in the Family Basic manual (not in the V3 one though). Check my signature for a link to the translated manual. Normally when you use a READ statement it will read the first DATA statement it can find in your program. But if you first use RESTORE [line no.] it will start reading from your specified line number instead.

The SYSTEM command doesn't produce any errors in V3 as far as I know. It should take you to a screen that says something like "Set the Backup Switch to ON if you want data to remain, and then turn off your Famicom". It's not really a system menu or anything but it's included in V3 for V1/V2 users that are used to type SYSTEM before turning off their Famicom. This way you can turn on the backup switch without strange things to happen (which happens if it's on in BASIC mode).

LINPUT is like INPUT but with a few changes:
  • "," can also be used as input data by the user.
  • Only one variable may be inputted by the user.
  • No "?" will be displayed when it waits for user input.
  • The initial character string may only contain max 31 characters, and will also be part of the result (these 31 characters includes data inputted by the user).

More detailed info in the Famibe manual.


Where did you see the OFF command? I can't find it, neither among the 74 commands in Family Basic nor among the 26 new commands in V3.
« Last Edit: November 08, 2013, 10:49:45 AM by P » Logged

infiniteNOP
Famicom
**
Posts: 33


« Reply #2 on: November 08, 2013, 11:13:57 AM »

I don't know Japanese, so that message seemed like an error to me Smiley. The off command was inserted by accident -just confused NS-HUBASIC with some other BASIC...
Anyway, thank you for your corrections P, will enter them in the new revision as soon as I finish writing it!
« Last Edit: November 08, 2013, 11:40:34 AM by linuxlalala » Logged

Previously known as linuxlalala
infiniteNOP
Famicom
**
Posts: 33


« Reply #3 on: November 11, 2013, 05:49:16 PM »

 POWBUMPPOW
New revision out, containing various changes and corrections, useful tables and several new commands.
Download:
PDF File: http://www.filedropper.com/famibasicrefference
ODT Source File: http://www.filedropper.com/famibasicrefference_1
Logged

Previously known as linuxlalala
uXe
Famiclone
*
Australia Australia
Posts: 4



« Reply #4 on: January 18, 2014, 11:49:27 PM »

The file(s) don't seem to be available anymore! Cry

Could you please re-upload? (pretty please!)
Logged
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #5 on: January 20, 2014, 12:20:36 AM »

I have the PDF: http://www.filedropper.com/famibasicrefference



Here's some more feedback for linuxlalala


CLEAR actually has two uses:
1)If used with no parameters, all variable and array values become 0, and all string variable values become "" (null strings).
2) If a memory address is passed as a parameter (&H77FF or less in V2, and &H6FFF or less in V3), memory for your BASIC program and variables will be reserved only up to that address (instead of all the way up to &H77FF/&H6FFF). Useful for inline assembly in which you are supposed to reserve the memory up until where your assembly routine starts (so that your BASIC program doesn't accidentally overwrites your assembly routines). This will also reset variables.
You can check available memory left with "PRINT FRE" or "?FRE" to see that it has decreased after using CLEAR [address].

Here's an example of how to properly use the CALL command:

1)
First you'll need a 6502 assembly routine of course. Here's a simple one for testing:
Code:
 NOP
  NOP
  NOP
  RTS
This code will do nothing except waste a few clock cycles of time (too fast to notice it though) but if Family Basic doesn't crash running this code you know that it works.

2)
Assemble your assembly subroutine (web assembler here http://www.e-tradition.net/bytes/6502/assembler.html).
With the example code we get:
Code:
EA EA EA 60


3) Now for the BASIC code. First CLEAR the memory area before where you want to put your assembly subroutine. For this example with V2 we'll use address &H7700 for the subroutine, so we type: "CLEAR &H76FF".
If you are using V3 you'll need to put it in between &H6100 and &H6FFF or something.


4) Put your assembled subroutine in memory with POKE: "POKE &H7700,&HEA,&HEA,&HEA,&H60".


5) Finally CALL your subroutine: "CALL &H7700"


In our example it will look like this:

Example code for V2:
Code:
10 CLEAR &H76FF
20 POKE (&H7700),&HEA,&HEA,&HEA,&H60
30 CALL &H7700

Example code for V3:
Code:
10 CLEAR &H66FF
20 POKE (&H6700),&HEA,&HEA,&HEA,&H60
30 CALL &H6700

Type run and if it says "OK" without crashing it means it worked.

I hope I got everything right. For an assembly subroutine that actually do something, check out UglyJoe's awesome ROB control routine (although he doesn't use CLEAR)! http://www.famicomworld.com/forum/index.php?topic=9691.0
« Last Edit: March 16, 2014, 07:44:36 AM by P » Logged

UglyJoe
Administrator
Disk-kun
*****
Gender: Male
United States United States
Posts: 5431



WWW
« Reply #6 on: January 20, 2014, 12:38:06 AM »

(although he doesn't use CLEAR)!

Gasp.  There's no harm since my demo program is so small, but the principal of it is important and I'm surprised that I missed it!  I must have been too caught up in 6502 assembly at the time to remember.
Logged
uXe
Famiclone
*
Australia Australia
Posts: 4



« Reply #7 on: January 20, 2014, 03:28:02 AM »


Thanks! Grin
Logged
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #8 on: January 20, 2014, 10:35:02 AM »

Here's a more fun example of a subroutine that actually does something instead of just NOPs (no operation), this time for V3.

Code:
 LDA #$5
  STA $6800
  RTS
This assembly code will load (LDA) the number 5 and store (STA) it at the memory location at the address &H6800.

When we assemble it we get the following hexadecimal numbers:
Code:
A9 05 8D 00 68 60


Then let's make a program that first POKEs the value 3 into memory at &H6800 and prints it out (using PEEK) to make sure that it has the value 3. Then write our subroutine that changes it to 5 and CALLs it. And finally we print &H6800 out again to make sure that it has changed to 5.
Code:
10 CLEAR &H66FF
20 POKE(&H6800),3
30 PRINT PEEK(&H6800)
40 POKE(&H6700),&HA9,&H5,&H8D,&H0,&H68,&H60
50 CALL &H6700
60 PRINT PEEK(&H6800)
When you enter RUN the program should first print out the number 3 and then 5, and there we have our proof that our subroutine actually worked. Of course we could just use POKE again to change the value in a memory location but where's the fun in that??

Advice: In order to make that code work in V2, just add &H1000 to all the addresses in the code (ie. change &H6800 to &H7800) and change the &H68 in the assembly subroutine into &H78.
« Last Edit: January 20, 2014, 11:18:47 AM by P » Logged

Issun
Disk System
***
Posts: 167


« Reply #9 on: January 20, 2014, 12:17:04 PM »

Wow, so you can use inline assembly in family basic! I didn't know that. Although with the small amount of RAM and no CHR-RAM (it's only ROM right?) you'd be pretty limited in what you could do. Interesting nonetheless!  Smiley
Logged
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #10 on: January 20, 2014, 09:26:35 PM »

Yes that makes it much more powerful. And yes it only has CHR ROM so we can't edit graphics in software. My guess is that it's because it's one of the earlier games for Famicom before CHR RAM became more common.
« Last Edit: January 21, 2014, 09:37:16 AM by P » Logged

80sFREAK
Sharp C1
*****
Gender: Male
Posts: 1191

Hardware freak


« Reply #11 on: January 20, 2014, 11:08:28 PM »

Each thead about Family asic makes me blow off the dust from my sketches and write couple more lines of code.

[teaser mode on] JF-13 based hardware with 8kB SRAM, but without battery backup. CHR RAM, if there is enough room after removing composer/messagepad. SD card slot. [teaser mode off]
Logged

I don't buy, sell or trade at moment.
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #12 on: January 21, 2014, 01:09:48 PM »

Sounds promising. Smiley But can't you use the V3 ROM? It already has all that other stuff already removed and you can reach BG GRAPHIC directly from the BASIC OS in V3.
Logged

zerolanding
Famiclone
*
Gender: Male
United States United States
Posts: 3



« Reply #13 on: March 16, 2014, 12:12:07 AM »

Hey there fellas!
  I'm getting my feet wet in family basic, and having a blast with it. Happy to see that there are so many active users of this program. Printed a hard copy of the V.2 manual, and learning a lot. Could someone post a new link for the reference manual?
Logged
P
FamicomBox
*****
Gender: Male
Sweden Sweden
Posts: 3367


« Reply #14 on: March 16, 2014, 07:45:43 AM »

Updated the link to the PDF in my post.
Logged

Pages: [1] 2 Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!