PROGRAM getscrn; {fills a hi res display with data from a file that was saved to disk by savscrn. Copyright 1984 by N.T.Carnevale. Permission granted for nonprofit use.} CONST GRAFSCREEN=2; {use only hires screen 2 with PCPI v.2 CP/M} {$I PCP.INC} {$I APLGR/G.INC} {$I APLGR/H.INC} TYPE string70=string[70]; byte=char; screenline=array [1.._BPL] of byte; figfile=FILE of screenline; VAR ans:char; scrn:integer; PROCEDURE delay; VAR i,j:integer; BEGIN FOR i:=0 TO 500 DO FOR j:=1 TO 500 DO; END; FUNCTION promptans(prompt:string70):char; VAR ans:char; BEGIN write(prompt); readln(ans); promptans:=upcase(ans); END; FUNCTION rowstart(row,page:integer):integer; {calculate the starting address corresponding a line or row number} VAR pagebase:integer; BEGIN IF page=1 THEN pagebase:=HIRESPAGE1 ELSE pagebase:=HIRESPAGE2; rowstart:=pagebase + $28*(row SHR 6) + (((row SHR 3) MOD 8) SHL 7) + ((row MOD 8) SHL 10); END; PROCEDURE doit; {simple read a screen from disk & write to specified screen} VAR filnam:string[12]; f:figfile; linenum:integer; temp:screenline; {temporary array to hold a line from the screen} BEGIN write('File to read: '); readln(filnam); assign(f,filnam); reset(f); hiresgr(scrn,FULLSCREEN); {shows the screen without clearing it} FOR linenum:=0 TO (HIVRES-1) DO BEGIN {read _BPL bytes from the file into temporary storage} read(f,temp); {write the bytes to the display memory, starting at the address that corresponds to the line number} _wrhostdata(addr(temp[1]),rowstart(linenum,GRAFSCREEN),_BPL); END; close(f); END; BEGIN textscreen(1); {start in text display} hirespatch; {install register-loading routines} scrn:=GRAFSCREEN; REPEAT hiresgr(scrn,FULLSCREEN); {shows the screen without clearing it} delay; textscreen(1); {return to the text display} ans:=promptans('Replace that with data from a file? '); IF ans='Y' THEN BEGIN doit; delay; textscreen(1); ans:=promptans('Do it again? '); END; UNTIL ans<>'Y'; END. {end of PROGRAM getscrn}