A program contains:
program keyword;const section;var section;begin;end keyword;Example:
program Minimal;
const
DefaultBackgroundColor: nes_color = $21;
var
BackgroundColor: nes_color;
FrameCounter: byte;
RenderingEnabled: boolean;
procedure Initialize(Start: byte; Enabled: boolean);
begin
FrameCounter := Start;
RenderingEnabled := Enabled;
end;
begin
BackgroundColor := DefaultBackgroundColor;
Initialize($00, true);
nes.set_background_color(BackgroundColor);
nes.run;
end.
The declaration sections must appear in this order. The main block completes the program and contains the top-level initialization sequence.