JULY 13TH, 2024
Family Basic (www.nesworld.com)
APRIL 17 2017


Way back in 1996 I stumbled upon a japanese webpage about the Family Basic released in Japan, a device that would let you make your own mini games for the Famicom, and you were even able to store your work on a cassette tape, oh my! But as my Japanese is very limited I wrote the author and asked him if it would be possible to make an english translation of his excellent work. The answer was positive even though his English was a bit rough. To be totally honest, I've probably never met a more friendly person in my life. Over the years NESWORLD has had a few face lifts and some of the older content has dissapeared during these upgrades, either because it was too outdated or incorrect, other stuff just vanished for no reason, and the Family Basic page was in that last category.

But while browsing some old backups of NESWORLD is ended up on the Family Basic page and decided to add it to the website again, exactly as it was translated back in the day. Thanks again to Akiyoshi for the great work.

Family BASIC

The personal computer which I bought first.
It releases it in April, 1984. Hope retail price 14,800 yen.

A photograph of a pamphlet.
(Click to see big photo)

That is designed as peripheral equipment for "Family Computer" of Nintendo, and BASIC has been usable with Family Computer by adding a keyboard to expansion connector and basic cartridge to cartridge slot.
IF connected a cassette deck to a keyboard, more and was able to store a program for cassette tape.

A free area of BASIC is 2Kbyte (It was expanded later).
All these free areas are using SRAM, and save program for short time with dry battery(SUM-3 *2) in BASIC cartridge.
But, I alomost not use it for the reason this system is unreliable.

Because cartridge connector of Nintendo is easy to produce contact defectiveness, there may have been the thing that a program disappears by contact defectiveness when the preservation switches it on.
Naturally, CPU is Nintendo custom version of 6502 same as Nintendo.
This removed BCD commands from 6502 and had PSG function in a chip.

A characteristic of BASIC

"Family BASIC" system softwear named by "NS-HuBASIC".
This BASIC is based on Sharp-Hudson BASIC series and custom improved for Nintendo (I think maybe the top 'N' is capital of "Nintendo"). All the numerical value became 16bit integer type.

Character set followed ASCII, but alphabet handling large letter only, and replacement filled up KATA-KANA.
What a dot mark of a voiced sound and a p-sound do not separation!
And it is prepared as a font completely. It will be consideration for use age group being low that thought mainly on Japanese.

(translated with note:
Japanese alphabet is separate about 3 group. That is KATA-KANA , HIRA-KANA , and KANJI.
As KATA-KANA and HIRA-KANA relation is so big and small letter of english alphabet. KATA-KANA and HIRA-KANA often bind called "KANA".
Number of KANA is 48 characters and combination of change pronounce mark.As a result of number of KANA is 80 characters.

By the way, number of KANJI is over than hundred thousand character.But computer can handle at the moment is about six thousand.)
The most characteristic of this BASIC is easy function of SPRITE and background (BG) screen. It is special feature of game machine as Nintendo.

BG screen is the text plane which is what is called, and Nintendo has two plane of BG screen memory.
These two plane repeat it and cannot layer display it, but it can connect to a direction of length or breadth and can scroll.
(this is decided by wiring in a cartridge. There was not scroll function in Family BASIC, but connect it to the side direction)

Family BASIC used one of screen for text plane, and other one with the respect that a picture could be pictured in freely already.
Picture is make with picture editor who can call it from BASIC.
Origin display system was like a text plane, for that reason picture edit possible only by combination of pattern prepared. But ready pattern have lot kind, it can draw interesting picture.
That drawn picture plane was copied by text plane by one BASIC function. So even game of made in few free areas, have look nice screen.

On a background prepared therefore, it can move SPRITE smoothly. SPRITE could display a thing of 16*16 dot, and the pattern was selected as this beforehand, too.

Pattern of SPRITE characters.
(Click to see All pattern)

BASIC have two function of SPRITE display.
One is same as other BASIC, appointed position and pattern, then display SPRITE pattern. Other function that moved freely while doing it to an animation at a speed appointed in a direction appointed from a position appointed already.
These two function could each display SPRITE to eight plane, and on the screen was able to display 16 plane of SPRITE by a total.A unit size of SPRITE on Nintendo can display it to 64 pieces with 8*8 dot simultaneously.
Display method with Family BASIC is not effective, but even late BASIC was epoch-making with SPRITE which moved smoothly enough colud display.

This BASIC was released to Ver.3.
Ver.1 was bundled during release right after, some month . It was this version that I sent to a handle, but what a friend bought afterwards became Ver.2 entirely.
It is that a function of SCR$ was added to the difference of Ver.2 and Ver.1. But a function of "examined character code indicated by a screen", but there was not it, and there was it was never different in width of game that could be made.

I wanted this order and telephoned the support center of Nintendo, and I was free of charge, and Nintendo gave it according to exchange.
But this service seems to have been done to the chisel which "complained" how.
Ver.3 was released in form of other being on the selling side of the market. A cartridge color was changed in red from black, too whether the reason was because I discriminated it.
A special feature of Ver.3 is twice the size of free area (4Kbyte), four games having entered ROM as a sample, support order of program making (example RENUM,AUTO,etc.) were what was made.

But I seem to have done it by advertising, and sound perception function does not employment.
(I saw that TV-CF of Family BASIC Ver.3 cartridge, a boy sayd to microphone on controller 2 as "Family BASIC exclusive cartridge , Version threeeeee." and drawing big heart mark on screen.
Because most people thinking, Ver.3 have new function of input microphone. But not.
By the way, this game is one of sample game in ROM. Microphone input test make by PEEK function.)

The culture of Family BASIC

As for the Family BASIC, a price has been cheap, and a considerable people seems to have bought it.
Mostly people drop out by reason of "cannnot as make a game simply as expect", "if did it was able to make game, but compared unfavorably it with on the maket package".
But Family BASIC became treat with various personal computer magazines even it.

I think whether perhaps it was not "MICOM BASIC Magazine" that began reception in the first place.
In BASIC Magazine, a game of reader contribution was carried in form of special report already in release right after of Family BASIC, and contribution work was carried at one or two paces every month afterwards. (I have contribution too. And appear it some times.)

Hudson Soft published a primer to programming of a game with Family BASIC as comic with casstte tape. Sample program made with a book on a cassette tape.

With "Program Pochette", a program of Family BASIC was put.
Perhaps I think that it is this magazine that first carried "machine language work" of Family BASIC.(the contents were joke programs)

And two wheels which moved forward with culture were "Beep" and "Backup KATSUYOU Technic" what is called "BacKatsu".
BacKatsu investigated hardware structure of Nintendo as a tool with Family BASIC thoroughly.
Beep investigated software structure of FamilyBasic thoroughly in order there was a little memory, and struck limitation of much Family BASIC of limit, and to tear it.
First the result begins to appear in Beep, and even BASIC Magazine becomes take natural before long.

A program promoted efficiency of thoroughly saves waste of a program and does not use an order prepared by ROM.

Utilized by program was housed inside as for the variable of one character is 1Byte and immdiate value is 2Byte,omitted all the blanks, multi-statement bug of omit ':' at specific condition, 'IF' sentence bug of omit 'THEN' too, used Boolean operation as it was possible, and "DATA" sentence was packed behind 'IF' sentence that a flow did not reach.
Nintendo utilized that it was memory-maped I/O and music used POKE and played it and SPRITE used POKE and display it and utilized a rest of work memory of the main body in an arrangement, and data were packed in V-RAM for a background at time.

Everyone could imagine it easily, the ultimate memory efficiency was brought by all machine code.
But an assembler cannot be made with small memory of family basic,whatever person having other personal computers. So most persons seem to have done assemble work by own hand.
By the way, it is not an effort of averageness that promote efficiency of memory by hand assemble entirely.

Moreover BacKatsu finished tuned BASIC which worked by disk system (a cartridge is RAM of 32K) .
What I cannot introduce because I do not test it is disappointing when grow if does not pass through this place.

A detailed of Nintendo

Though it is further information, in the main what I knew by thing / rumor that it was used by oneself. And understood forget much. There may be a mistake.

May be, readable beyond this point, only to person of deep knowledge.


A thing of Nintendo uses a custom version of 6502 for CPU. 6502 is CPU which became famous for what was used for Apple//.
In 6502, there is only six register.

One of this is program counter at 16bit. And other registers is 8bit.
One of 8bit register is stack pointer, and other one is flag register which both register uses by system.
Two of them are index register among three remainders.
This adds to a remainder with an accumulator (general purpose register) with one of them.

-------------------A (accumulator)
-------------------X (index)
-------------------Y (index)
PC (program counter)
-------------------S (stack pointer)
-------------------P (flag)

Only for one accumulator, and a way of thinking that nothing is completed seems to be at a glance right, but wrong.
Memory of 6502 is bound with unit of measure of "page" every 256Byte, and page 0 to be possible for various numeration with A register .

In other words when I think this point by there is 6502 with 256 register.

The reason of index register X Y is only 8bit is enough to addressing in page. And stack pointer becomes 8bit for the equal reason, too, and the page 1 is used for stack area by all means.

Because there is not only one general purpose register, it is to be it in the thing that every computational instruction aims at this register. On this account there is only one operand to mnemonic of 6502.
And there is not direct relational, but, as for the mnemonic, assembly code of 6502 becomes very beautiful so that it is expressed with alphabet of three characters by all means.

Display system of Nintendo

Seemingly it does seem to "be not possible", and hardware of Nintendo becomes deep hardware of the depths like 6502 that is the CPU, too.

As for the SPRITE which is the greatest special feature, 64 pieces of 8*8 dot, four-colored (transparent one color of us) things are usable.
As for these SPRITE, there is limit in the number to stand in line for line buffer expantion sideways, but this limit number becomes eight of times instead of four which were common sense of those days.
(because the size of SPRITE which was common sense of those days most was 16*16 dot, it is to be in a thing that the size of display the screen is equal) SPRITE character is put in ROM (it was RAM in disk system), and 256 characters can keep.

Display character can flip vertical and horizontal, select color palette in four,and choice display layer at front or back of BG screen.

A SPRITE to be expressed by 4byte of representation coordinate (X,Y), representation character, and representation attribute. And total SPRITE number is 64, as a result of SPRITE total use memory is 256 bytes which is just 1 page of 6502 addressing.

Size of screen consists of by setting a character of separate 8*8 dot beside SPRITE with 256*240 dot. That character can select four color in four palette, too.
However, the palette was able to be appointed every 16*16 dot area that made four characters.

As for the size of true page, there was 256*256 dot, and this had 2 page. And there 2 page was connected with it, and the direction connected with it was able to select the side or length by connection in ROM cartridge.
Relational of this true page and display screen can be changed with scrolling register, but there is not superimpose.

Scrolling does not include raster scrolling feature.
But there was very interesting facility with Nintendo which "to interrupt when the SPRITE number 0 was developed by line buffer " (popular called name "zero bomb").
So I will put the SPRITE number 0 done transparently at the point that wants to do raster scrolling. And change scrolling register in interrupt routine, a result can raster scrolling.

Sound generator of Nintendo

Sound generator of Nintendo is had built-in custom CPU.
I think that in a sense this is that maker did "not regard a sound as important", but become the sound sourse which is interesting in its own way.

As for the sound sourse of Nintendo, there is 5 channel, and 3 are PSG.
However, as for this PSG only generation square wave. It is reason of Nintendo sound was tight.

As for 2 channel is able to change duty rate (up-down rate) for four phases, which means change tone.
Remaining 1 channel can not change duty rate. But it sound tone like a sine wave for base pattern.

This 2 channels and 1 channel of PSG have differnt output system as chip (it is done mixing on a circuit bord), and the remodeling that this was utilized, and seemed to output a stereo was done well.

Among 2 channels of sound sourse remainder, 1 channel is noise. This was used for explosion sounds well.
And the last 1 channel was delta PCM, but it was rare with Nintendo which used 6502, for reason PCM sound sourse used lot of memory.

In disk system, FM sound sourse 1 voice of 2 operator becomes usable in addition to this, but does not know a detailed thing.

(translated with note:
Family Computer Disk System is sale only in Japan.)

(origin page makes at 1996/ 9/28 and translating at 1997/ 3/23)