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

04 NES BASIC PROGRAMMING GUIDE

Language fundamentals

Numbers are checked signed 16-bit integers: -32768 through 32767. A division truncates toward zero, so -7/3 is -2. Overflow raises OVERFLOW rather than silently wrapping. Dividing by zero raises DIVISION BY ZERO. Integer INT is an identity operation; the language has no decimal fraction type to round.

There are 26 numeric variables, A through Z. Assignment can be written A=42 or LET A=42. A variable defaults to zero. Multi-letter names such as TOTAL and names with digits such as X1 are unsupported. Choose a letter and use REM to say what it means. String A$ is a separate variable from numeric A.

Expressions support unary +/-, multiplication/division, addition/subtraction, parentheses and comparisons. Precedence is unary, then multiply/divide, then add/subtract or string concatenation, then comparisons. For example, 2+3*4 is 14; (2+3)*4 is 20. Comparisons = <> < > <= >= produce numeric 1 for true and 0 for false. There are no AND/OR/NOT or bitwise operators in this edition.

A colon separates statements on the same source line. REM ignores the remainder of its line, including colons and words that would otherwise be keywords. Use comments for intent and units. Keywords inside a quoted string are text. Unclosed double quotes raise SYNTAX ERROR. Extra punctuation is not ignored.

Line numbers range from 1 to 65535, independently of the signed numeric value range. A program holds at most 128 lines and 3072 tokenized source bytes. Keywords are compact tokens, so typed character count is not the same as stored byte count. The expression parser has a guarded nesting limit, and FOR/GOSUB share an eight-frame control stack. Keep expressions and nesting modest.