{This demo program demostrates the usage of several functions in the }
{'MINI.OBJ' file                                                     }
{$debug-}
program demomini( input, output );
var
  dice, i, screennum, page, numcol, row, column, start, stop : integer;
  freq[static] : array[ 1 .. 8 ] of integer;

value	{ initialize the frequency array }
  freq[ 1 ] := 523; freq[ 2 ] := 587; freq[ 3 ] := 659; freq[ 4 ] := 698;
  freq[ 5 ] := 784; freq[ 6 ] := 880; freq[ 7 ] := 988; freq[ 8 ] := 1046;

{$include:'b:mini.inc'}
begin
  screennum := SCREENMODE( page, numcol );  { get the satus of current screen }
  if screennum = 7 then
    SCREEN(7)				    {clear the monochrome screen}
  else
    SCREEN(4);			      {set the graphics mode so that we }
				      {can use the WRITEDOT procedure later}
  screennum := SCREENMODE( page, numcol );  { get the satus of current screen }
  READCURSOR(page, row, column, start, stop); {get the cursor status }
  writeln('Cursor at row=',row:2,' column=',column:2, ' start=',start:3,
				 ' stop=',stop:3);
  writeln;

  writeln('Screen mode =', screennum:3, '  Page=', page:3,
	  ' Number_of_column=', numcol:3);

  writeln;
  writeln;
  writeln('Memory =',  NUMMEMORY : 5,'KB');
				{ call the function 'NUMMEMORY' ot get RAM size}

  writeln;
  writeln('Simulating a dice:');
  for i := 1 to 40 do begin
    dice := ( RND mod 6 ) + 1;		       {RND returns a random number }
						{  in the range 0 to 65535 }
    write(dice:2);
  end;

  writeln;
  if screennum <> 7 then begin	  { No graphics for Monochrome display (mode=7)}
    for i := 0 to 199 do
      WRITEDOT(i, i, i mod 4);
    for i := 0 to 4 do
      writeln('Color at (', i:1, ',', i:1, ')=',  READDOT(i, i) : 3);
  end
  else
    writeln('Can not display graphics on the monochrome monitor');

  for i := 1 to 8 do
    SOUND( freq[i], 100 );     { one second for each note }

  SOUND(0, 100);	       { silence for one second }

  for i := 8 downto 1 do
    SOUND( freq[i], 50 );     { half second for each note }
end.
