home *** CD-ROM | disk | FTP | other *** search
- {$symtab-,$pagesize:84,$linesize:131,$debug-,
- $title:'SAVDIS.PAS -- Save - Display CRT Data'}
- { COPYRIGHT @ 1982
- Jim Holtman and Eric Holtman
- 35 Dogwood Trail
- Randolph, NJ 07869
- (201) 361-3395
- }
- {$mathck-}
-
- module save_display;
- {$include:'simterm.inc'}
- {$include:'graph.inc'}
-
- var
- first_time : boolean;
- one_line_save_area : string(160);
- display_buffer_addr [external] : word;
- bot_mem,top_mem : word;
- next_ptr : ads of string(160);
- retrace_flag [external] : boolean;
- value first_time := TRUE;
-
- function xfreemem : word;
-
- external;
-
- function xmaxmem : word;
-
- external;
-
- procedure init;
-
- var
- inc : word;
-
- begin
- first_time := FALSE;
- bot_mem := xfreemem; {bottom of free memory}
- top_mem := xmaxmem-10; {top of free memory}
- if top_mem < bot_mem then begin
- next_ptr := ads one_line_save_area;
- {FAKE it}
- bot_mem := next_ptr.s;
- top_mem := bot_mem;
- end
- else begin
- top_mem := bot_mem+((top_mem-bot_mem) div 10)*10;
- next_ptr.r := 0;
- next_ptr.s := bot_mem;
- end;
- while next_ptr.s <= top_mem do begin
- {blank at most 64K at a time}
- next_ptr^[1] := ' '; {blank out the buffer}
- next_ptr^[2] := chr(7);
- if (top_mem - next_ptr.s) > #FFF then inc := #FFF
- else inc := top_mem - next_ptr.s + 10;
- {move the buffer on top of itself}
- movesl(ads next_ptr^[1],ads next_ptr^[3],inc*16);
- next_ptr.s := next_ptr.s+inc;
- end;
- next_ptr.s := bot_mem;
- writeln(output,'Display Save Area = ',(top_mem-bot_mem) div 10,
- ' lines.');
- end;
-
- procedure save_line(line : CRT_SIZE;
- inc : INC_LIMIT);
-
- var
- display_buf : ads of char;
-
- begin
- if first_time then init;
- display_buf.s := display_buffer_addr;
- display_buf.r := wrd(2*line*(RIGHT_MAR+1));
- if retrace_flag then moves_wait(display_buf,next_ptr,LINE_SIZE)
- else movesl(display_buf,next_ptr,LINE_SIZE);
- next_ptr.s := next_ptr.s + wrd(10*inc);
- if next_ptr.s < bot_mem then next_ptr.s := top_mem
- else if next_ptr.s > top_mem then next_ptr.s := bot_mem;
- end;
-
- procedure display_line(line : CRT_SIZE;
- inc : INC_LIMIT);
-
- var
- display_buf : ads of char;
-
- begin
- if first_time then init;
- display_buf.s := display_buffer_addr;
- display_buf.r := wrd(2*line*(RIGHT_MAR+1));
- if retrace_flag then moves_wait(next_ptr,display_buf,LINE_SIZE)
- else movesl(next_ptr,display_buf,LINE_SIZE);
- next_ptr.s := next_ptr.s + wrd(10*inc);
- if next_ptr.s < bot_mem then next_ptr.s := top_mem
- else if next_ptr.s > top_mem then next_ptr.s := bot_mem;
- end;
- end.
-