nes-pascal

Built-in types

NES Pascal provides three built-in types. Each occupies one byte, but the types are distinct and are not implicitly converted.

nes_color

nes_color occupies one byte and represents an NES palette value. Its allowed range is $00..$3F.

Valid:

const
    BackgroundColor: nes_color = $21;

Invalid:

const
    BackgroundColor: nes_color = $80;

Expected diagnostic:

E4002 path/to/source.nsp:4:34

Value $80 is not valid for type nes_color.

Allowed range: $00..$3F.

byte

byte occupies one byte and accepts hexadecimal values from $00 through $FF.

const
    Maximum: byte = $FF;

A larger value produces E4003.

boolean

boolean occupies one byte. false is represented by zero and true by one. No hexadecimal-to-boolean conversion is allowed.

const
    RenderingEnabled: boolean = true;

Assignments and operator operands must obey the exact type rules described in Assignments and Expressions.

Procedure value parameters currently support only byte and boolean. nes_color remains valid for constants and global variables but produces E4005 when used as a parameter type.