The Language Reference
The reference manual for nel, a language which is intended to run on the original Nintendo Entertainment System. This language discards the mnemonics and restricted syntax of other 6502 assemblers and replaces it with a new syntax, while still mapping to the same 6502 machine code. It gives the direct control like any other assembly language, but with the syntactic flavoring of a higher-level language.
nel changes syntax for the better. It introduces language keywords and new syntactic constructs, instead of relying on dot-prefixed .directives
. It no longer mandates obscure whitespace rules. It combines similar 6502 instructions into condensed groups (this: get src
, instead of lda
, ldx
, ldy
, tax
, txs
, and so forth). The result is more legible assembly.
- Directives
-
The Header Directive, using the
ines
keyword to setup the output file. -
Relocation Directives, using the
in
keyword to layout different parts of the program. -
Inclusion Directives, using the
include
keyword to require an external source file.
-
The Header Directive, using the
- Definitions
-
Bank Definitions, using the
bank
keyword to declare sections of RAM, PRG ROM and CHR ROM. -
Label Definitions, using the
def
keyword to point to a particular section. -
Constant Definitions, using the
let
keyword. -
Enumeration Definitions, using the
enum
keyword to declare several sequential constants. -
Variable Definitions, using the
var
keyword. -
Scoping, using a
begin
/end
block. -
Package Definitions, using a
package
block.
-
Bank Definitions, using the
- Statements
-
Branches, using
goto
andgoto ... when
statements. -
Subroutines, using
call
andreturn
statements. -
Interrupts, setting up NES's interrupt vectors and using
resume
statements. -
Instructions, of form
this: command, command, ...
-
Data Statements, for emitting
byte
orword
data into the code. -
Binary Embeds, by using the
embed
keyword to insert a binary file verbatim. -
Empty Statements, using a semi-colon
;
. -
If Statements, using
if ... then
/elseif
/else
for conditional compilation on constant expressions, and a convenient shorthand for runtime branching on flags. -
While Statements, using
while
as a shorthand for loops done zero or more times. -
Repeat Statements, using
repeat
as a shorthand for loops done one or more times, and for infinite loops.
-
Branches, using
- Miscellaneous
- Integer Literals for decimal, hexadecimal or binary integers.
- String Literals for textual data.
- Comments for documenting and debugging your code.
- Constant Expressions for combining terms and literals.
- Registers & Memory Addressing Modes which affect how an expression should be interpreted in regards to an instruction.
- Processor Status Flags for use in various conditional branches and instructions.