Family BASIC

Started by Doc, July 30, 2006, 12:09:48 am

Previous topic - Next topic

satoshi_matrix

Navigating The interface of the Famicom Basic is fairly easy, espically if you can read katakana. When turned on, a cheesy futuristic Computer sceen shows flashing colours and making beeps and bloops. It'll do this for about 30 seconds, or hit F1 to skip it.

It asks for your name. Type it in English.

Next, it asks you what program you want to start. By defult, it will ask you to run GAME BASIC. Hit F1 for Yes, F2 For No, F3 to go back and F4 for help (I think)

If you select no, it'll ask to start the Calculator program. Hit F1 for yes, F2 for no.
Again, it'll ask to start the Muisc Program. Hit F1 for yes, F2 for no.
Then it will ask if you want to start the Message Board program. F1 for yes, F2 for no. If you hit no, it'll loop back to GAME BASIC.

That's all I've learned thus far, I need to fiddle with it some more.

UglyJoe

OK, that's version 2 or 2.1 (assuming my roms were audited correctly...).  Version 3 is missing the funny computer interface, but comes with some sample games (and possibly has a more robust version of basic).

The version of basic used is called NS-HUBASIC (Nintendo/Sharp HudsonBASIC).  If you google that, you might be able to dig up some free reference material (though most likely in Japanese).

Here's a list of all the commands you can use, which I found listed in the rom:

GOTO DIM KEY - POS
GOSUB REM COLOR MOD CSRLIN
RUN STOP DEF / CHR$
RETURN CONT CGEN * HEX$
RESTORE CLS SWAP ABS INKEY$
THEN CLEAR CALL ASC RIGHT$
LIST ON LOCATE STR$ LEFT$
SYSTEM OFF PALET FRE SCR$
TO CUT ERA LEN
STEP NEW XOR PEEK
SPRITE POKE OR ND
PRINT CGSET AND GN
FOR VIEW NOT PC
NEXT MOVE <> TAB
PAUSE END >= MID$
INPUT PLAY <= STICK
LINPUT BEEP = STRIG
DATA LOAD > XPOS
IF SAVE < YPOS
READ POSITION+ VAL


I'm working on dumping the code for the sample games.  Nearly there, just the katakana bits that php is choking on :P.

satoshi_matrix

I'd love to find V3 of the Famicom Basic, but nobody sells it!

satoshi_matrix

Oh wow. Thanks so much for that! Anythign you can tell me further would be a giant help!  That list has lots of detailed info! Can you read kanji? I would love for someone with a more robust knowledge of Japanese to be able to translate the manual. I can scan pages if you or anyone else can translate!

UglyJoe

May 11, 2007, 10:14:14 pm #34 Last Edit: May 12, 2007, 08:25:20 am by UglyJoe
Ok, I've got one of the game scripts dumped.  It looks like it matches the console's output (that's the LIST command, btw), so you can give it a try if you want.  At the very least, it'll give you an idea of what the syntax looks like:

10 '"AREA 88 V7.3"
20 T=O=U=C=H=D=I=K=L=M=N=P=S=V=X=Y=MA=X0=X1=Y0=Y1=PP=Q
30 DIM D(1),V(1),F(8),SC(1),S(1)
40 L=9:MA=2:N=3:V=7:C=7:S(0)=4:S(1)=4
50 X0=70:Y0=80:X1=110:Y1=60
60 D(0)=3:V(0)=2:D(1)=7:V(1)=2:F(0)=3:F(1)=3:MA=MA+1:U=N:M=1
70 SPRITE ON:CGSET 1,1:PLAY"T1Y2M1V9O3R1":PALETS 1,13,48,38,18
80 FOR I=15 TO 18:A$=A$+SCR$(I,22):NEXT:H=VAL(A$)
90 GOSUB 1070
100 VIEW:FORP=0TO200:LOCATERND(27),RND(23):PRINTCHR$(205);:NEXT:P=0
110 '
120 I=P+6:IF F(P) THEN ON F(P) GOSUB 670,700,680:GOTO 150
130 IF M=P THEN GOSUB 390:GOTO 150
140 GOSUB 210
150 IF MOVE(I)=0 THEN ERA I
160 GOSUB 530
170 GOSUB 800
180 ON F(8)+1 GOSUB 940,1040
190 P=1-P:GOTO 120
200 '
210 S=STICK(P):T=STRIG(P)
220 IF T<>4 THEN F(I)=1
230 IF S+T=0 THEN RETURN
240 IFS=0THEN350
250 S=-1*(S=8)-3*(S=1)-5*(S=4)-7*(S=2)-2*(S=9)-4*(S=5)-6*(S=6)-8*(S=10)
260 Q=D(P)
270 IF S=Q THEN 350
280 IF Q>4 THEN 310
290 IF (S>Q AND S<=Q+4) THEN 320
300 GOTO 330
310 IF (S>=Q-4 AND S<Q)THEN 330
320 Q=Q+1:GOTO 340
330 Q=Q-1
340 PP=-1*(Q>8)-8*(Q<1):Q=-Q*(PP=0)+PP:D(P)=Q
350 IF T AND4 THEN IF F(I) THEN V(P)=V-V(P):F(I)=0
360 DEF MOVE(P)=SPRITE (P+8,D(P),V(P),255,1):MOVE P
370 IF T>7 THEN DEF MOVE(I)=SPRITE(12,D(P),1,80,0,P):POSITION I,(XPOS(P)+4)MOD256,(YPOS(P)+4)MOD256:MOVE I
380 RETURN
390 '
400 K=K-1:IF K>0 THEN RETURN
410 T=0:D=0:X=(XPOS(1-P)-XPOS(P))/13:Y=(YPOS(1-P)-YPOS(P))/13
420 IF X>0 THEN D=3
430 IF X<0 THEN D=7
440 IF Y>0 THEN D=D+5
450 IF Y<0 THEN D=D+1:IF X<0 THEN D=16
460 IF X AND Y THEN D=D/2
470 S=2:O=D-D(P):IF(0<O AND O<5)OR O<-3 THEN S=1
480 IF O=0 THEN S=0
490 IF V(1-P)<>V(P) THEN T=4
500 IF MOVE(I)=0 OR RND(10)=0 THEN T=T+8
510 IF X*X+Y*Y>200 THEN RETURN
520 K=RND(L):GOTO 220
530 '
540 D=CRASH(0):IF D>0 AND D<6 THEN O=0:GOSUB 590
550 D=CRASH(1):IF D>1 AND D<6 THEN O=1:GOSUB 590
560 D=CRASH(6):IF D>0 AND D<6 THEN O=6:GOSUB 610
570 D=CRASH(7):IF D=0 OR (D>1 AND D<6)THEN O=7:GOSUB 610
580 RETURN
590 X=ABS(XPOS(O)-XPOS(D)):Y=ABS(YPOS(O)-YPOS(D)):IF X<10 AND Y<10 THEN IF MOVE(O) AND MOVE(D) AND F(D)=0 AND F(O)=0 THEN F(O)=1:F(D)=1:IF D>1 THEN 650
600 RETURN
610 X=ABS(XPOS(O)-XPOS(D)-4):Y=ABS(YPOS(O)-YPOS(D)-4):IF X<8 AND Y<8 THEN IF MOVE(O) AND MOVE(D) AND F(D)=0 THEN ERA O:F(D)=1:GOTO 630
620 RETURN
630 IF D<2 THEN SC(O-6)=SC(O-6)+10:RETURN
640 SC(O-6)=SC(O-6)+1+F(8)*4
650 DEF MOVE(D)=SPRITE(10,RND(9),RND(3)+4,10):MOVE D:PLAY"O4C":RETURN
660 '
670 F(P)=2:DEF MOVE(P)=SPRITE(10,D(P),V(P),70/V(P),0):MOVE P:PLAY"O"+HEX$(P+3)+"GG":S(P)=S(P)-1:RETURN
680 IF P=M OR STRIG(P)+STICK(P) THEN F(P)=0:POSITION P,X0+P*X1,Y0+P*Y1
690 RETURN
700 IF MOVE(P) THEN RETURN
710 F(P)=3:ERA P
720 IF SC(0)>H AND M<>0 THEN H=SC(0)
730 IF SC(1)>H AND M<>1 THEN H=SC(1)
740 IF L<1 THEN L=5
750 LOCATE 0,20:PRINT"SCORE ",SC(0),SC(1),"LEVEL":PRINT"SHIPS",S(0),S(1),L;" ":PRINT"HI-SCORE",H,
760 IF S(P)>0 THEN RETURN
770 IF M=P THEN L=L-1:S(P)=4:GOTO 740
780 IF M=-1 THEN M=P:PRINT P;" COM":PLAY"EE":RETURN
790 LOCATE 10,10:PRINT "GAME OVER":PLAY"O1C5CDED6C4C5":PAUSE 200:RUN
800 '
810 X=XPOS(P)/8-1:Y=YPOS(P)/8-2
820 IF X<0 OR X>27 OR Y<0 OR Y>23 THEN 880
830 IF SCR$(X,Y)<>""THEN 880
840 S=ASC(SCR$(X,Y,1))
850 IF S=P+1 THEN 880
860 IF F(P)=0 THEN F(P)=1
870 '
880 IF MOVE(I)=0 THEN RETURN
890 X=(XPOS(I)-12)/8:Y=(YPOS(I)-20)/8
900 IF X<0 OR X>27 OR Y<0 OR Y>23 THEN RETURN
910 IF SCR$(X,Y)<>"" THEN RETURN
920 S=ASC(SCR$(X,Y,1)):IF S=P+1 THEN RETURN
930 ERA I:LOCATE X,Y:PRINT " ";:RETURN
940 '
950 FOR I=2 TO MA:IF MOVE(I)OR F(I)=2 THEN 980
960 IF F(I)=1 THEN GOSUB 990:GOTO 980
970 DEF MOVE(I)=SPRITE (C,RND(9),RND(3)+C/2,80,0):MOVE I
980 NEXT:RETURN
990 '
1000 F(I)=0:ERA I:POSITION I,120,120:IF U<MA THEN F(I)=2
1010 U=U-1:IF U=0 THEN F(2)=0:F(8)=1:RETURN
1020 IF U<0 THEN U=N:F(2)=0:F(3)=0:F(4)=0:F(5)=0:F(8)=0:C=C-2:L=L-1:IF C<2 THEN C=7:IF M>-1 THEN S(1-M)=S(1-M)+1
1030 RETURN
1040 IF F(2) THEN I=2:GOTO990
1050 IF MOVE(2)=0 THEN DEF MOVE(2)=SPRITE(2,RND(8)+1,RND(3)+1,10,0):MOVE 2
1060 RETURN
1070 '
1080 VIEW:RESTORE 1070
1090 FORP=0TO200:LOCATERND(27),RND(23):PRINTCHR$(205):NEXT
1100 LOCATE8,3:PRINT"STAR KILLER"
1110 FOR P=0 TO 1:LOCATE 10,10+P*8:DEF MOVE(P)=SPRITE(P+8,D(P),2,30):POSITION P,X0+P*X1,Y0+P*Y1:MOVE P
1120 IF MOVE(P) THEN 1120
1130 READ A$:FOR I=1 TO LEN(A$):PRINT MID$(A$,I,1);:PLAY"C":NEXT:NEXT
1140 FOR P=2 TO 3:LOCATE 10,17+P:READ A$:FOR I=1 TO LEN(A$):PRINT MID$(A$,I,1);:PLAY"C":NEXT:NEXT:LOCATE1,22:PRINT"フタリ デ アソビマスカ(Y/N)";:M=-1
1150 A$=INKEY$(0):IFA$="N"THENM=1
1160 PAUSE80:RETURN
1170 DATA "PLAYER 1","PLAYER 2","   OR","COMPUTER"


Note that on lines 830 and 910, there is a blue dot being used in the comparisons.  I'm not entirely sure what that's supposed to be or, worse, how you go about inputting it with the keyboard.



Also, in case you didn't figure it out yet, the backspace key is the break key.  I don't know how familiar you are with basic, but the break key becomes your best friend very quickly  ;D.  Basically, it halts execution of your code.  So, if you mess up and your game or whatever totally messes up, you can hit Backspace to go back to a console.

It's getting late here, so I have to call it quits.  I'll dump the other games sometime this weekend (or monday).

vealchop

QuoteI'd love to find V3 of the Famicom Basic, but nobody sells it!


Got it! Brand new unopened in box! Got a lucky break on ebay, the dude selling it didnt even put "famicom" into the listing. so i got it for SUPER cheap  :D
-chop

satoshi_matrix

Awesome work! Um.....what does all that code tell me? lol sorry, I have no idea what any of it means/the value of knowing it!  :(

Sad thing is, I dont know any BASIC. I'm looking for some sort of guide to teach me it. Do you know any guides online? I've looked up NS-HUBASIC, and yeah all the sites are general info sites in Japanese, and all the regular BASIC guides I can find through google turn out to be Visual Basic which doesn't apply here.

Also: could someone translate the manual if I were to post scanns?

UglyJoe

Haha, I guess it was a bit overkill  ;D

The best site I could find (by searching for ファミリーベーシック) was here:

http://page.freett.com/familybasic/index.html

It's in Japanese, of course, but it actually explains the commands and gives a few (short) sample programs for you to try.  All you have to do is type in the source code (this includes the line numbers!) and then type RUN.  For example:

10 PRINT "HELLO"
20 GOTO 10
RUN


That will type HELLO over and over again until you hit backspace.  You can type CLS to clean up the mess afterwards.  If you want to see your code, type LIST and it will scroll it at you.  If you need to edit a line, just type it again.  For example, after typing/running/breaking the above code, you could then type

10 PRINT "GOODBYE"


Typing LIST will now show you that you've overwritten line 10.  I'm not sure if there's a way to LIST only a particular line of code, but it looks like you can (using LIST 10 or LIST 10 20, something like that).

I'm finding this to be quite interesting, so I'll write up some more later.  I can't translate the manual for it, but I'd like to see it :D

satoshi_matrix

Thanks for the info! You're a godsend! Do you know of a site where I could learn Basic UJ?

UglyJoe

Hrmm...not really.  I learned what I know from QBasic and its help file (and a bit from my brother).  The syntax is pretty much the same (although that's probably true of all old flavors of basic).

I'll try and write up a really short tutorial later (basically just me taking notes while I play around with some source code).  That might take a few days, though.

satoshi_matrix

I just won two books on ebay: Basic BASIC and Advanced BASIC. According to the seller, apparently they are two of the best published books on BASIC from the 80s. Dunno if he was just trying to sell it to me though. I'll have to see when the books arrive.

satoshi_matrix

One thing I really want to know: How do I switch back and forth between Katakana and English? I seem to do be able to switch, but once I'm in Japanese I have no idea how to get back.

UglyJoe

Hmm...I'm only using an emulator.  I have the Kana key (the one between right-shift and return) mapped to Ins.  I press it once, I'm in kana mode.  I press it again, I'm out of kana mode.  It also looks like you can hit Ctrl+V to get into Kana mode, and press Ctrl+W to get back to Alphanumeric mode.

satoshi_matrix

If possible, could you send me the Famicom BASIC rom as well as info on whatever emulator is nessesary to run it? Do you just use a standard modern keyboard? how did you get that support? There must be a plugin I would assume. email me at satoshimatrix@hotmail.com. Using the computer emulator could be helpful to switch back and forth between it and the internet for info. If you have 2.1 as well as 3.0 I'd like both, but whatever you got is fine. Thanks!

satoshi_matrix

Got your email. Thank you very much! :)

I'll get on scanning the manual for the Famicom Basic. If not a translation, maybe you could tell me a bit about each page?  Some of it is written in BASIC, which I currently can't understand but you should be able to.