Hello, 8-bit world
Your first two lines of NES BASIC. Print a message and make the machine yours.
HELLO.BAS
10 PRINT "HELLO FROM NES BASIC"
20 END01 THE EXAMPLE LIBRARY
Eight complete programs from the free guide. Read the code, try it in the actual ROM, then make it your own.
Your first two lines of NES BASIC. Print a message and make the machine yours.
10 PRINT "HELLO FROM NES BASIC"
20 ENDAsk for a name, store a string, and build a personal greeting.
10 INPUT "YOUR NAME";N$
20 A$="HELLO, "+N$
30 PRINT A$
40 IF N$="" THEN PRINT "EMPTY NAME"
50 ENDCall a subroutine and return to the next instruction.
10 GOSUB 100
20 PRINT "BACK"
30 END
100 PRINT "IN SUBROUTINE"
110 RETURNAdd the numbers from 1 to 5 with a FOR / NEXT loop.
10 A=0
20 FOR I=1 TO 5
30 A=A+I
40 NEXT I
50 PRINT "TOTAL=";A
60 ENDCreate a frame, a diagonal, and a pixel on the real graphics canvas.
10 SCREEN 1
20 COLOR 42,15
30 RECT 8,8,119,55
40 LINE 0,0,127,63
50 PSET 64,32
60 ENDMake a short melody with the NES pulse channel.
10 SOUND 1,60,20
20 WAIT 20
30 SOUND 1,64,20
40 WAIT 20
50 SOUND 1,67,30
60 WAIT 30
70 ENDRead controller events with INKEY$ and inspect their byte codes.
10 K$=INKEY$
20 IF K$="" THEN GOTO 10
30 PRINT "CODE=";ASC(K$)
40 GOTO 10Put a ship on screen and move it with the controller.
10 SCREEN 1:X=80
20 SPRITE 0,X,100,0
30 J=JOY(1)
40 X=80+J/128*8
50 MOVE 0,X,100
60 WAIT 1:GOTO 30