// Effectus auto-generated Mad Pascal source code listing
program nescrollPrg;

uses
  Crt, StringUtils;

var
  eff_loop_var : byte;
  eff_cnt : byte;
  eff_string : string;
// Effectus example:
// Horizontal scrolling demo
var
  DL : array[0..14] of byte = ($70, $70, $70, $52, $00, $40, $52, $60, $40, $52, $C0, $40, $41, $00, $20);  // DL_byte_array
  HSCROL : byte absolute $D404;  // HSCROL_byte_array
  RANDOM : byte absolute $D20A;  // RANDOM_byte_array
  SDLSTL : word absolute $230;  // SDLSTL_byte_array
  SCREENI : word = $4000;  // SCREENI_byte_array

procedure WAITProc(F : byte); assembler;
  asm
  lda F
    .by $18 $65 $14 $C5 $14 $D0 $FC $60 
end;
procedure MAINProc;
var
  HSCROLI : byte absolute $CA;  // HSCROLI_byte_array
  A : byte;  // A_byte_array
  B : byte;  // B_byte_array
  C : byte;  // C_byte_array
begin
  SDLSTL := word(@DL);
  HSCROLI := $F;
  repeat
  if  HSCROLI=$B  then begin
  A := (RANDOM AND 15)+33;
  B := (RANDOM AND 15)+33;
  C := (RANDOM AND 15)+33;
  Poke(SCREENI, A);
  Poke(SCREENI+$60, B);
  Poke(SCREENI+$C0, C);
  Poke(SCREENI+$30, A);
  Poke(SCREENI+$30+$60, B);
  Poke(SCREENI+$30+$C0, C);
  Inc(DL[4]);
  Inc(DL[7]);
  Inc(DL[$A]);
  Inc(SCREENI);
  if  DL[4]=$30  then begin
  DL[4] := 0;
  DL[7] := $60;
  DL[$A] := $C0;
  SCREENI := $4000;
  end;  // if
  HSCROLI := $F;
  end;  // if
  HSCROL := HSCROLI;
  Dec(HSCROLI);
  WAITProc(1);
  until false;
end;

begin
  MAINProc;
end.
