unit coolopt;
INTERFACE
procedure options(puff:pointer);

IMPLEMENTATION
uses crt,coolutil,coollow,coolmaus;
type p64k=array[0..64000] of byte;
var    opfmem:^p64k;

const fonthoehe=6;   {fontconstanten}
      fontbreite=5;   {hoehe;maxbreite}
      fontsize=fontbreite*fonthoehe+1;{breitebyte}
      asciilist:array[1..55] of char='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,;"!?-+/*()[]=šŽ™';

procedure options(puff:pointer);

procedure print(text:string;dest,font:pointer);
var s,i,y,x:word;
    buch:byte;
begin
  for y:=0 to fonthoehe-1 do begin
    for s:=0 to fonthoehe do
      move(mem[seg(dest^):ofs(dest^)+(s+1)*320],mem[seg(dest^):ofs(dest^)+s*320],fontbreite*byte(text[0]));
    for i:=1 to byte(text[0]) do begin
      buch:=byte(text[i])-32;
        for x:=0 to fontbreite-1 do
          mem[seg(dest^):ofs(dest^)+x+fonthoehe*320+(i-1)*fontbreite]:=
          mem[seg(font^):ofs(font^)+x+y*fontbreite+buch*fontsize];
    end;
    delay(30);
  end;
end;


procedure initoptfont;
var i,x,y:word;
    fseg,pseg:word;

  procedure getletter(fontseg,fontofs,scrseg,scrofs:word);
    var x,y:word;
    begin
      for y:=0 to fonthoehe-1 do
        for x:=0 to fontbreite-1 do
          mem[fontseg:fontofs+y*fontbreite+x]:=
             mem[scrseg:scrofs+y*320+x];
    end;  {unterprocedure getletter}


begin
  fseg:=seg(opfmem^);
  pseg:=seg(puff^); (*data3.hm5 ist in pseg($a000)*)
     (*space*)
  fillchar(opfmem^,64000,0);

  x:=ofs(puff^);
  for i:=1 to 55 do begin(* ABCDEFGHIJKLMNOPQRSTUVWXYZ()!?" *)
   getletter(fseg,ofs(opfmem^)+(byte(asciilist[i])-32)*fontsize,pseg,x);
   x:=x+fontbreite;
  end;
end;


var f:file;
    pal:array[1..768] of byte;
begin
  new(opfmem);

  assign(f,pfad+'pics\layout5.s13');
  reset(f,1);   {*LOAD S13}
  seek(f,1000);
  blockread(f,puff^,64000);
  close(f);

  assign(f,pfad+'pics\layout4.s13');
  reset(f,1);   {*LOAD S13}
  blockread(f,pal,768);
  seek(f,1000);
  blockread(f,mem[$a000:0],64000);
  close(f);
  setpal(@pal);

  initoptfont;



  repeat
            {****SOUNDKARTE****}
    print('SCHEISSDING',ptr($a000,320*36+103),opfmem);
    print('SCHWACHSINN',ptr($a000,320*49+193),opfmem);
    print('NURMUELL',ptr($a000,320*62+123),opfmem);
    print('SCHEISSMOD',ptr($a000,320*78+110),opfmem);

    print('170',ptr($a000,320*36+208),opfmem);
    print('6',ptr($a000,320*36+256),opfmem);
    print('9',ptr($a000,320*36+300),opfmem);

  until (knopf<>0) or keypressed;

  while keypressed do readkey;
  dispose(opfmem);
end;

begin
end.

