MADE FOR THE NES. READY FOR YOUR IDEAS. NO ACCOUNT NEEDED.
NESBASICBY NDB SOFTWARE

05 NES BASIC PROGRAMMING GUIDE

Strings and text values

A$ through Z$ are 26 string variables, independent of A through Z. They default to empty strings. String assignment, copying, concatenation and comparison are real typed operations. A$="HELLO", B$=A$ and C$=A$+"!" are valid direct fragments. The + operator concatenates strings only when both operands are strings.

Numeric and string values do not convert silently. A$=42, A=A$ or A$+1 raises TYPE MISMATCH. Use STR$ to make decimal text from an integer, or VAL to parse a whole decimal string. This makes a program's intended conversion visible.

An empty literal is "". To include a quotation mark, double it inside a literal: A$="SAY ""HI""" stores SAY "HI". String INPUT treats typed spaces and quotation marks as data rather than source syntax. Empty string input is valid.

All six comparison operators work between strings. Comparison is lexicographic on unsigned byte codes: an equal prefix sorts before a longer string. Thus "A" sorts before "AA". Comparison gives numeric 1/0. A string cannot be compared to a number without an explicit conversion. The uppercase-oriented font is not a Unicode collation system.

A stored or concatenated string can contain at most 63 bytes. All 26 variables share a compacted 256-byte pool. Empty strings use no pool bytes. Expressions also use a bounded 128-byte temporary arena. STRING TOO LONG means a result exceeds the length limit; STRING SPACE FULL means shared/temporary capacity is exhausted. The old destination survives a failed assignment. Shorten or clear values, or use CLEAR when it is safe to reset all values.

NES BASIC
10 INPUT "YOUR NAME";N$
20 A$="HELLO, "+N$
30 PRINT A$
40 IF N$="" THEN PRINT "EMPTY NAME"
50 END

RUN, enter NES USER and submit. The result is HELLO, NES USER. RUN again and submit an empty answer: the program prints HELLO, followed by EMPTY NAME. The empty test compares N$ to an empty string, not to numeric zero. This listing is also the first complete project in Chapter 13.

Try Meet your program Download the source ↓