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

uses
  Crt, StringUtils, Graph;

var
  eff_loop_var : byte;
  eff_cnt : byte;
  eff_string : string;
// Effectus example:
// PEEK and POKE demo
var
  n : byte;  // n_byte_array
  mem : word;  // mem_byte_array
  CH : byte absolute 764;  // CH_byte_array
  COL : byte absolute 710;  // COL_byte_array

procedure WAITFORKEYProc;
begin
 WHILE CH=255 do begin
  end;
  CH := 255;
end;

procedure MAINProc;
begin
  Write(Chr(125));
  eff_string := '';
  Write('Effectus example:');  // Print 1
  Writeln;
  eff_string := '';
  Write('PEEK demonstration');  // Print 1
  Writeln;
  Writeln('');
  n := Peek(CH);
  eff_string := '';
  Write('Shadow register 764 currently holds:');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write(n);  // Print 2
  Writeln;
  Writeln('');
  n := Peek(710);
  eff_string := '';
  Write('Shadow register 710 currently holds:');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write(n);  // Print 2
  Writeln;
  Writeln('');
  n := Peek(559);
  eff_string := '';
  Write('Shadow register 559 currently holds:');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write(n);  // Print 2
  Writeln;
  Writeln('');
  mem := DPeek($0230);
  eff_string := '';
  Write('Display List Pointer(DLISTL/DLISTH)');  // Print 1
  Writeln;
  eff_string := '';
  Write('address:');  // Print 1
  Writeln;
  Writeln('');
  eff_string := '';
  Write(mem);  // Print 2
  Writeln;
  Write('', eol, '', eol, 'POKE demonstration', eol, '');
  eff_string := '';
  Write('Press any key to change color!');  // Print 1
  Writeln;
  WAITFORKEYProc;
  COL := 0;
  eff_string := '';
  Write('Press any key to change color again!');  // Print 1
  Writeln;
  WAITFORKEYProc;
  Poke(710, 212);
  eff_string := '';
  Write('And again!');  // Print 1
  Writeln;
  WAITFORKEYProc;
  n := 65;
  Poke(710, n);
  eff_string := '';
  Write('Last time!');  // Print 1
  Writeln;
  WAITFORKEYProc;
  n := 184;
  Poke(COL, n);
  WAITFORKEYProc;
end;

begin
  MAINProc;
end.
