unit punt_vid;
(**********************) interface (****************************)
TYPE
PSchermo=^TipoSchermo;
TipoSchermo=array[1..25,1..80] of record
ch:char;
at:byte;
end;
(*array identico alla memoria video*)
Pschermata=^schermata;
schermata=record
schermo:TipoSchermo;
prox,prec:Pschermata;
end;
(*lista doppia che andr… a memorizzare le schermate*)
var
video:PSchermo;
corrente,precedente,successivo,ultimo,primo:Pschermata;
procedure punt_avanti;
(*memorizza ultima schermata*)
procedure punt_indietro;
(*ritorno alla schermata precedente*)
procedure azzera_punt_video;
(*azzera lista puntatori*)
(********************) IMPLEMENTATION (********************)
procedure punt_avanti;
begin
if primo=nil
then begin
new(corrente);
primo:=corrente;
ultimo:=corrente;
corrente^.prox:=nil;
corrente^.schermo:=video^;
end
else begin
precedente:=corrente;
new(corrente);
precedente^.prox:=corrente;
ultimo:=corrente;
corrente^.prox:=nil;
ultimo^.prec:=precedente;
corrente^.schermo:=video^;
end;
end;
procedure punt_indietro;
begin
if ultimo <> primo
then begin
corrente:=ultimo;
ultimo:=corrente^.prec;
dispose(corrente);
corrente:=ultimo;
video^:=corrente^.schermo;
end;
end;
procedure azzera_punt_video;
begin
if primo=nil then exit;
corrente:=primo;
while corrente<>nil
do begin
successivo:=corrente^.prox;
dispose(corrente);
corrente:=successivo;
end;
primo:=nil;
end;
begin
new(video);
if mem[$0000:$0449]=7
then video:=ptr($B000,$0000)
else video:=ptr($B800,$0000);
primo:=nil;
end.