home *** CD-ROM | disk | FTP | other *** search
- (*****************************************************************************)
- (* *)
- (* F U L L S C R E E N E D I T O R *)
- (* *)
- (* *)
- (* By Martine Wedlake *)
- (* *)
- (* This programme may be copied, or modified in any way for non- *)
- (* commercial uses. If you would like to use this programme in a business *)
- (* environment please write me for licencing, and so I can keep track of *)
- (* its success. If you like this programme a donation would be awfully *)
- (* nice of you. Thanks! *)
- (* Martine Wedlake *)
- (* 4551 N.E. Simpson St. *)
- (* Portland Or *)
- (* 97218 *)
- (* *)
- (*****************************************************************************)
-
- program screen_editor;
- {$C-} {Turn off user interrupt}
- {$U-}
- const
- base_screen=$b800;
- configfile='EDSCREEN.CNF'; {The configureation filename}
- helpfile='EDSCREEN.HLP'; {The help screen filename}
- max_levels=19; {The maximum number of graphic levels}
- version='V1.0';
- type
- character_12_array=array[1..12] of char;
- str12=string[12];
- Str20=string[20];
- str64=string[64];
- graph_type=array[1..max_levels,1..8] of char;
- config=record {for data file...}
- graphic_letters:graph_type;
- insert_mode:boolean;
- help:boolean;
- forg:integer;
- back:integer;
- help_path:str64;
- end;
-
- var
- graphic_level, {The level of the graphic characters}
- forground, {colours}
- background:integer;
- insert, {if insert on}
- blinking, {if blink on}
- help_on_disk:boolean; {if help found on the disk}
- graphic:graph_type; {storage for graphic chars}
- helpPath,
- default_path:str64;
-
- PROCEDURE Dir(msk:character_12_array;subdir:boolean);
- TYPE
- RegRec=record
- AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags : INTEGER;
- end;
- VAR
- attribute:integer;
- regs:regrec;
- dta:array [1..43] of byte;
- namr:str20;
- mask:character_12_array;
- error,
- i:integer;
- BEGIN
- mask:=msk; {doesn't seem to work otherwise}
- fillchar(dta,sizeof(dta),0); {blank out dta and resulting name}
- FillChar(namr,sizeof(namr),0);
- regs.ax := $1A00; {Function to set dta address}
- regs.ds := seg(dta); {ds:dx is the location of dta}
- Regs.DX := Ofs(DTA);
- msdos(regs);
- error := 0;
- regs.ax := $4E00; {function to search for first match}
- regs.ds := seg(mask); {ds:dx is the location of filename}
- regs.dx := ofs(mask);
- regs.cx := 22; {search for any attribute setting}
- msdos(regs);
- attribute:=mem[seg(dta):ofs(dta)+21]; {get files attribute}
- error := regs.ax and $FF; {if error returned, ie no file}
- i := 1;
- if (error = 0) then {get name from DTA}
- repeat
- namr[i] := chr(mem[seg(dta):ofs(dta)+29+i]);
- i := i + 1;
- until not (namr[I-1] in [' '..'~']) or (i>20);
- namr[0] := chr(i-1); {set length of the returning string}
- if ((subdir) and (attribute=16)) or (not subdir) then
- write(NamR:20); {write name only if the correct kind of file}
- while (error = 0) do {loop until error}
- begin
- Error := 0;
- regs.ax := $4F00; {function to search for next match}
- regs.cx := 22; {again.. look for any file }
- msdos( regs );
- attribute:=mem[seg(dta):ofs(dta)+21]; {get the attribute of the file}
- error := regs.ax and $FF; {return error...}
- i := 1;
- REPEAT {create string}
- namr[i] := chr(mem[seg(dta):ofs(dta)+29+i]);
- i := i + 1;
- until not (namr[i-1] in [' '..'~'] ) or (i > 20);
- namr[0] := chr(i-1);
- if (((subdir) and (attribute=16)) or (not subdir)) and (error=0) then
- write(NamR:20); {check file}
- end;
- end; {end of Dir}
-
- procedure video(cond:boolean);{--------------Turns on or off the display}
- begin
- repeat until port[$3da] and 8=8; {wait for video sync}
- if cond then
- port[$3d8]:=mem[$40:$65] or 8 {restore display}
- else
- port[$3d8]:=$25; {turn off display by setting regs}
- end; {end of video procedure}
-
- PROCEDURE cursor(on:BOOLEAN);{---------------This sets the cursor on/off}
- CONST
- video_io=$10; {this is the interrupt number}
- VAR
- regs:RECORD CASE INTEGER OF {this sets up the registers}
- 1: (AX,BX,CX,DX,BP,DI,SI,DS,ES,Flags: INTEGER);
- 2: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);
- END;
- BEGIN
- IF on THEN {if the user wants a cursor then}
- BEGIN
- regs.ch:=$06; {set the registers up for display}
- regs.cl:=$07; {ch = start line, cl = end line}
- END
- ELSE {else, the cursor is not displayed}
- BEGIN
- regs.ch:=$20; {set the register up for non-}
- regs.cl:=$00; {display, ch=$20 doesn't display}
- END;
- regs.ah:=$01;
- regs.al:=$00;
- Intr(video_io,regs);
- END;
-
- function exist(filename:str12) {------tests if a file exists}
- :boolean;
- var
- f_test:file;
-
- begin
- assign(f_test,filename);
- {$I-}
- reset(f_test);
- {$I+}
- exist:=(ioresult = 0);
- close(f_test);
- end; {End of function exist}
-
- procedure beep;
- begin
- sound(85);
- delay(400);
- nosound;
- end;
-
- procedure put_status(del:boolean);{-----------Puts status line on line 25}
- var
- x,
- y,
- counter:integer;
- begin
- cursor(false);
- x:=wherex;
- y:=wherey;
- textcolor(white); {Set colour and such}
- textbackground(black);
- gotoxy(1,25);
- if del then clreol;
- gotoxy(10,25);
- write('Forg: Back: Graph:'); {Put info on screen, but NO DATA}
- gotoxy(48,25); {EXCEPT for graphic chars}
- for counter:=1 to 8 do
- begin
- textcolor(white);
- write(counter);
- textcolor(lightblue);
- write(graphic[graphic_level,counter],' ');
- end;
- textcolor(forground);
- textcolor(background);
- gotoxy(x,y);
- cursor(true);
- end; {End of Put_status}
-
- procedure show_status;{----------------------Fills in the status line with data}
- var
- x,y:integer;
- begin
- cursor(false);
- x:=wherex;
- y:=wherey;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- write('[',x:2,',',y:2,']'); {Put in co-ordinates}
- textcolor(forground);
- textbackground(background);
- gotoxy(16,25);
- write(forground:2); {Put colours on status line}
- gotoxy(26,25);
- write(background:2);
- textcolor(white);
- textbackground(black);
- gotoxy(38,25);
- write(graphic_level:2); {write out the graph level}
- gotoxy(42,25);
- if insert then write('INS') else write('OVR');{Insert or Overstrike}
- textcolor(forground);
- textbackground(background);
- gotoxy(x,y);
- cursor(true);
- end; {end of show_status}
-
- procedure waitkey;
- var
- key:char;
- begin
- repeat until keypressed;
- while keypressed do read(kbd,key);
- end;
-
- procedure fatal_error(error:integer);{-------Called if unexpected happens}
- var
- x,
- y:integer;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- clreol;
- beep;
- case error of
- $F0:write('Disk Write Error - Disk full.');
- $F1:write('Disk Directory Full - Too many files on root directory.');
- else write('Unknown Error - The Error number (IOResult) is: ',error:2);
- end;
- write(' << Press a key >>');
- waitkey;
- textcolor(forground);
- textbackground(background);
- put_status(true);
- gotoxy(x,y);
- end; {End of procedure fatal_error}
-
- procedure initialize_editor(set_screen:boolean);{Initializes the variables}
- var
- f_configure:file of config;
- configure:config;
- level,
- letter,
- error:integer;
- begin
- if not exist(configfile) then {if no config file on disk then}
- begin {set defaults...}
- graphic[1,1]:=#205; {Graphic character defaults}
- graphic[1,2]:=#186;
- graphic[1,3]:=#187;
- graphic[1,4]:=#201;
- graphic[1,5]:=#188;
- graphic[1,6]:=#200;
- graphic[1,7]:=#206;
- graphic[1,8]:=#215;
- graphic[2,1]:=#196;
- graphic[2,2]:=#179;
- graphic[2,3]:=#191;
- graphic[2,4]:=#218;
- graphic[2,5]:=#217;
- graphic[2,6]:=#192;
- graphic[2,7]:=#197;
- graphic[2,8]:=#216;
- graphic[3,1]:=#180;
- graphic[3,2]:=#195;
- graphic[3,3]:=#194;
- graphic[3,4]:=#193;
- graphic[3,5]:=#185;
- graphic[3,6]:=#204;
- graphic[3,7]:=#203;
- graphic[3,8]:=#202;
- graphic[4,1]:=#184;
- graphic[4,2]:=#213;
- graphic[4,3]:=#190;
- graphic[4,4]:=#212;
- graphic[4,5]:=#183;
- graphic[4,6]:=#214;
- graphic[4,7]:=#189;
- graphic[4,8]:=#211;
- graphic[5,1]:=#181;
- graphic[5,2]:=#198;
- graphic[5,3]:=#208;
- graphic[5,4]:=#210;
- graphic[5,5]:=#182;
- graphic[5,6]:=#199;
- graphic[5,7]:=#207;
- graphic[5,8]:=#209;
- graphic[6,1]:=#219;
- graphic[6,2]:=#220;
- graphic[6,3]:=#221;
- graphic[6,4]:=#222;
- graphic[6,5]:=#223;
- graphic[6,6]:=#176;
- graphic[6,7]:=#177;
- graphic[6,8]:=#178;
- graphic[7,1]:=#142;
- graphic[7,2]:=#143;
- graphic[7,3]:=#146;
- graphic[7,4]:=#128;
- graphic[7,5]:=#144;
- graphic[7,6]:=#153;
- graphic[7,7]:=#154;
- graphic[7,8]:=#165;
- graphic[8,1]:=#131;
- graphic[8,2]:=#132;
- graphic[8,3]:=#133;
- graphic[8,4]:=#134;
- graphic[8,5]:=#145;
- graphic[8,6]:=#160;
- graphic[8,7]:=#166;
- graphic[8,8]:=#032;
- graphic[9,1]:=#130;
- graphic[9,2]:=#136;
- graphic[9,3]:=#137;
- graphic[9,4]:=#138;
- graphic[9,5]:=#139;
- graphic[9,6]:=#140;
- graphic[9,7]:=#141;
- graphic[9,8]:=#161;
- graphic[10,1]:=#147;
- graphic[10,2]:=#148;
- graphic[10,3]:=#149;
- graphic[10,4]:=#162;
- graphic[10,5]:=#167;
- graphic[10,6]:=#032;
- graphic[10,7]:=#032;
- graphic[10,8]:=#032;
- graphic[11,1]:=#129;
- graphic[11,2]:=#150;
- graphic[11,3]:=#151;
- graphic[11,4]:=#163;
- graphic[11,5]:=#032;
- graphic[11,6]:=#032;
- graphic[11,7]:=#032;
- graphic[11,8]:=#032;
- graphic[12,1]:=#135;
- graphic[12,2]:=#152;
- graphic[12,3]:=#164;
- graphic[12,4]:=#168;
- graphic[12,5]:=#159;
- graphic[12,6]:=#158;
- graphic[12,7]:=#157;
- graphic[12,8]:=#173;
- graphic[13,1]:=#155;
- graphic[13,2]:=#156;
- graphic[13,3]:=#171;
- graphic[13,4]:=#172;
- graphic[13,5]:=#174;
- graphic[13,6]:=#175;
- graphic[13,7]:=#169;
- graphic[13,8]:=#170;
- graphic[14,1]:=#226;
- graphic[14,2]:=#127;
- graphic[14,3]:=#233;
- graphic[14,4]:=#240;
- graphic[14,5]:=#228;
- graphic[14,6]:=#232;
- graphic[14,7]:=#234;
- graphic[14,8]:=#032;
- graphic[15,1]:=#224;
- graphic[15,2]:=#225;
- graphic[15,3]:=#227;
- graphic[15,4]:=#229;
- graphic[15,5]:=#230;
- graphic[15,6]:=#231;
- graphic[15,7]:=#233;
- graphic[15,8]:=#236;
- graphic[16,1]:=#237;
- graphic[16,2]:=#238;
- graphic[16,3]:=#239;
- graphic[16,4]:=#241;
- graphic[16,5]:=#242;
- graphic[16,6]:=#243;
- graphic[16,7]:=#244;
- graphic[16,8]:=#245;
- graphic[17,1]:=#246;
- graphic[17,2]:=#247;
- graphic[17,3]:=#248;
- graphic[17,4]:=#249;
- graphic[17,5]:=#250;
- graphic[17,6]:=#251;
- graphic[17,7]:=#252;
- graphic[17,8]:=#253;
- graphic[18,1]:=#003;
- graphic[18,2]:=#004;
- graphic[18,3]:=#005;
- graphic[18,4]:=#006;
- graphic[18,5]:=#024;
- graphic[18,6]:=#025;
- graphic[18,7]:=#026;
- graphic[18,8]:=#027;
- graphic[19,1]:=#001;
- graphic[19,2]:=#002;
- graphic[19,3]:=#016;
- graphic[19,4]:=#017;
- graphic[19,5]:=#018;
- graphic[19,6]:=#023;
- graphic[19,7]:=#019;
- graphic[19,8]:=#020;
- help_on_disk:=true; {other defaults..}
- helpPath:='A:\';
- insert:=false;
- forground:=lightgray;
- background:=black;
- end
- else {Config file found so load info}
- begin
- assign(f_configure,configfile);
- {$i-}
- reset(f_configure);
- read(f_configure,configure);
- close(f_configure);
- {$i+}
- error:=ioresult;
- if error<>0 then fatal_error(error); {Unexpected has happened}
- with configure do
- begin
- help_on_disk:=help; {set internal variables}
- helpPath:=Help_path;
- insert:=insert_mode;
- forground:=forg;
- background:=back;
- graphic:=graphic_letters; {set graphic chars}
- end;
- end;
- blinking:=false; {Blink always false at start}
- graphic_level:=1; {graph level at 1}
- getdir(0,default_path);
- if set_screen then
- begin
- textbackground(background); {set colour on scren}
- textcolor(forground);
- clrscr; {after colour change to set background}
- put_status(false); {display status line}
- end;
- end; {end of initialize_editor}
-
-
- procedure quit;{-----------------------------if user wants to exit..}
- var
- x,
- y:integer;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- clreol;
- write('Do you really want to quit [Y/N] ? '); {validate purpose}
- repeat
- read(kbd,key);
- key:=upcase(key);
- if (key<>'Y') and (key<>'N') then beep;
- until key in['Y','N'];
- if key='Y' then
- begin
- clrscr;
- chdir(default_path);
- halt;
- end;
- put_status(true);
- gotoxy(x,y);
- end; {end of quit}
-
- {$i title.pas}
-
- procedure put_char(x,y,lett,colour:integer);{Puts char on screen fast}
- begin
- mem[base_screen:((y-1)*160)+(x-1)*2]:=lett; {x,y are normal co-ordinates}
- mem[base_screen:((y-1)*160)+(x-1)*2+1]:=colour; {colour is NOT turbo it is DOS standard}
- end; {end of put_char}
-
- function last_pos(y:integer):integer;{---------Find last position on line}
- var
- x,
- dummy:integer;
- lett:char;
- begin
- x:=80; {loops until character is found}
- repeat
- lett:=chr(mem[base_screen:(y-1)*160+(x-1)*2]);
- x:=x-1;
- until (lett<>' ') or (x=0);
- last_pos:=x+1;
- end; {end of last_pos}
-
- function first_pos(y:integer):integer;{--------Like above except other way}
- var
- x,
- dummy:integer;
- lett:char;
- begin
- x:=1;
- repeat
- lett:=chr(mem[base_screen:(y-1)*160+(x-1)*2]);
- x:=x+1;
- until (lett<>' ') or (x=82);
- if x=82 then x:=2;
- first_pos:=x-1;
- end; {end of first_pos}
-
- procedure do_delete;{--------------------------deletes at cursor}
- var
- x,
- tempx,
- tempy,
- colour,
- letter:integer;
- begin
- if wherex<=last_pos(wherey) then {check validity}
- begin
- tempx:=wherex;
- tempy:=wherey;
- for x:=wherex+1 to last_pos(wherey) do
- begin
- letter:=mem[base_screen:((wherey-1)*160)+((x-1)*2)]; {move letters left}
- colour:=mem[base_screen:((wherey-1)*160)+(x-1)*2+1];
- put_char(x-1,wherey,letter,colour);
- end;
- gotoxy(last_pos(wherey),wherey);
- write(' ');
- gotoxy(tempx,tempy);
- end;
- end; {end of do_delete}
-
- procedure do_backspace;{-----------------------will delete like backspace}
- var
- letter,
- dummy,
- tempx,
- tempy,
- x,
- colour:integer;
- begin
- tempx:=wherex;
- tempy:=wherey;
- if wherex>1 then
- begin
- if insert then {if insert then move line over}
- begin
- if wherex<last_pos(tempy)+2 then
- begin
- for x:=wherex to last_pos(tempy) do
- begin
- letter:=mem[base_screen:((tempy-1)*160)+((x-1)*2)];
- colour:=mem[base_screen:((tempy-1)*160)+(x-1)*2+1];
- put_char(x-1,tempy,letter,colour);
- end;
- gotoxy(last_pos(tempy),tempy);
- write(' ');
- if last_pos(tempy)=80 then
- begin
- gotoxy(tempx,tempy-1);
- end
- else
- begin
- gotoxy(tempx,tempy);
- end;
- end
- end
- else write(^h' '); {else..don't worry about it}
- gotoxy(wherex-1,tempy);
- end;
- end; {End of backspace}
-
- procedure move_right;{-------------------------used for inserting characters}
- var
- letter,
- colour,
- x,
- y,
- dummy:integer;
- begin
- y:=wherey;
- for x:=last_pos(wherey) downto wherex-1 do {move right by going thru loop}
- begin
- if x<>80 then {check if past margin}
- begin
- letter:=mem[base_screen:((y-1)*160)+(x-1)*2];
- colour:=mem[base_screen:((y-1)*160)+(x-1)*2+1];
- put_char(x+1,y,letter,colour);
- end;
- end;
- end; {end of move_right}
-
- procedure save;{-------------------------------Saves the screen to disk}
- var
- x,
- y,
- counter,
- error:integer;
- screen:array[0..1920] of integer absolute base_screen:0;
- f_screen:file;
- name:string[12];
- do_it:boolean;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- clreol;
- name:=''; {input info required}
- do_it:=true;
- write('Enter filename to save [CR = Exit] : ');
- buflen:=12;
- read(name);
- if name='' then do_it:=false; {check if user wants to exit}
- if pos('.',name)=0 then
- if length(name)>8 then name:=copy(name,1,8)+'.SCR'
- else
- name:=name+'.SCR';
- if do_it then
- begin
- if exist(name) then {check if file on disk already}
- begin
- gotoxy(1,25); {yes - so ask if delete old}
- clreol;
- write('WARNING - File already exists! Overwrite [Y/N] ? ');
- repeat
- read(kbd,key);
- key:=upcase(key);
- if (key<>'Y') and (key<>'N') then beep;
- until key in['Y','N'];
- if key='N' then do_it:=false; {set flag in response}
- end;
- if do_it then {if user wants to save it then..}
- begin
- assign(f_screen,name);
- {$i-}
- rewrite(f_screen);
- video(false);
- blockwrite(f_screen,screen,30); {blockwrite the array which is at}
- close(f_screen);
- {$i+}
- video(true); {absolute of the screen memory}
- error:=ioresult;
- if error<>0 then fatal_error(error); {unexpected happened}
- end;
- end;
- put_status(true);
- gotoxy(x,y);
- end; {end of save}
-
- procedure load(mode:byte);{--------------loads in picture from disk}
- var
- x,
- y,
- counter,
- error:integer;
- screen,
- screen1:array[0..2000] of integer;
- f_screen:file;
- name:string[12];
- use:string[7];
- do_it:boolean;
- key:char;
- begin
- case mode of
- 1:use:='load';
- 2:use:='overlay';
- 3:use:='examine';
- end;
- x:=wherex;
- y:=wherey;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- clreol;
- name:=''; {ask info}
- do_it:=true;
- write('Enter filename to ',use,' [CR = Exit] : ');
- buflen:=12;
- read(name);
- if name='' then do_it:=false; {tried to limit disk access}
- if pos('.',name)=0 then
- if length(name)>8 then name:=copy(name,1,8)+'.SCR'
- else
- name:=name+'.SCR';
- if do_it then {chose not to use "AND" structure so that}
- begin {exist function would not be called if CR entered}
- if mode=3 then move(mem[base_screen:0],screen1,4000);
- if exist(name) then {check if file on disk}
- begin
- assign(f_screen,name); {yes so load, similar to save..}
- {$i-}
- reset(f_screen);
- blockread(f_screen,screen,30);
- close(f_screen);
- {$i+}
- error:=ioresult;
- if error<>0 then fatal_error(error) {unexpected happened}
- else
- begin
- if (mode=2) then
- begin
- for counter:=0 to 1920 do
- if screen[counter]<>$0720 then memw[base_screen:counter*2]:=screen[counter];
- end
- else
- move(screen,mem[base_screen:0],3840);
- end;
- end
- else {file isn't found}
- begin
- gotoxy(1,25); {write warning}
- clreol;
- write('WARNING - File not found! <<< Press A Key >>>');
- waitkey;
- end;
- if (mode=3) and exist(name)then
- begin
- gotoxy(1,25);
- clreol;
- gotoxy(32,25);
- cursor(false);
- write('<<< Press a Key >>>');
- waitkey;
- cursor(true);
- move(screen1,mem[base_screen:0],4000);
- end;
- end;
- put_status(true);
- gotoxy(x,y);
- end; {end of load}
-
- procedure show_graphic;{------------------------prints all the graphic chars}
- var
- screen:array[0..2000] of integer; {for saving screen}
- x,
- y,
- counter,
- counter1:integer;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- video(false); {save screen}
- move(mem[base_screen:0],screen,4000);
- video(true);
- cursor(false);
- textcolor(white);
- textbackground(blue);
- clrscr;
- gotoxy(27,2);
- writeln('The Graphic Character Set'); {write out the array}
- writeln;
- writeln('':8,'Level Graphic chars at ALT #');
- for counter:=1 to max_levels do
- begin
- textcolor(white);
- textbackground(blue);
- write('':9,counter:2,' ');
- for counter1:=1 to 8 do
- begin
- textcolor(white);
- write(counter1:4,' ');
- if counter mod 2=0 then
- textcolor(lightred)
- else
- textcolor(yellow);
- write(graphic[counter,counter1]);
- end;
- writeln;
- end;
- textcolor(white);
- textbackground(blue);
- gotoxy(29,wherey);
- write('<<< Press any Key >>>');
- repeat until keypressed;
- read(kbd,key);
- if keypressed then read(kbd,key);
- video(false); {restore screen}
- move(screen,mem[base_screen:0],4000);
- video(true);
- cursor(true);
- gotoxy(x,y);
- end; {end of show_graphic}
-
- procedure help;{--------------------------------displays help screen}
- var
- counter,
- x,
- y:integer;
- screen:array[0..2000] of integer; {for saving screen}
- help:array[0..1920] of integer; {for the blockread}
- f_help:file;
- key:char;
- begin
- cursor(false);
- textcolor(white);
- textbackground(black);
- x:=wherex;
- y:=wherey; {SAVE the SCREEN}
- video(false);
- move(mem[base_screen:0],screen,4000);
- video(true);
- if Help_on_disk then {check if help on disk}
- begin
- assign(f_help,helppath+helpfile);
- {$i-}
- reset(f_help);
- blockread(f_help,help,30);
- video(false);
- clrscr;
- move(help,mem[base_screen:0],3840);
- video(true);
- close(f_help);
- {$i-}
- if ioresult<>0 then help_on_disk:=false {if unexpected then no help on disk}
- end;
- if not help_on_disk then {if no help on disk then output internal help}
- begin
- clrscr; {ACTUAL HELP MESSAGE}
- writeln(' The keys are defined as...');
- writeln;
- writeln(' Alt - F = Forground Alt - B = Background');
- writeln(' Alt - L = Load Alt - S = Save');
- writeln(' Alt - O = Overlay Alt - X = Examine picture');
- writeln(' Alt - R = Read directory Alt - P = Set path');
- writeln(' Alt - = = Blink toggle Alt - ''-'' = Do lines');
- writeln(' Alt - W = Wipe screen Alt - H = This help screen');
- writeln(' Alt - Q = Quit Alt - G = Show graphic');
- writeln(' Alt - Y = Delete line Alt - N = Insert line');
- writeln(' Alt - C = Center line Alt - M = Mark block with colour');
- writeln(' Alt - K = Copy block Alt - D = Delete block');
- writeln(' Alt - V = Move block Alt - 1-8 = Out graphic char');
- writeln(' Alt - 9 = Graph level-1 Alt - 0 = Graph level+1');
- writeln;
- writeln(' Alt - A = Alter configuration on disk');
- writeln;
- gotoxy(29,wherey);
- write('<<< Press a key >>>');
- end;
- waitkey;
- video(false); {restore screen}
- move(screen,mem[base_screen:0],4000);
- video(true);
- textcolor(forground);
- textbackground(background);
- gotoxy(x,y);
- cursor(true);
- end; {end of help}
-
- procedure clear;{-------------------------------clears the screen}
- var
- x,
- y:integer;
- key:char;
- begin
- textcolor(white);
- textbackground(black);
- x:=wherex;
- y:=wherey;
- gotoxy(1,25);
- clreol; {validate intentions}
- write('Do you really want to clear the screen [Y/N]? ');
- repeat
- read(kbd,key);
- key:=upcase(key);
- if (key <>'Y') and (key<>'N') then beep;
- until key in['Y','N'];
- if key='Y' then
- begin
- textcolor(forground); {Clear screen with correct colours}
- textbackground(background);
- clrscr;
- x:=1; {for homing the cursor}
- y:=1;
- end;
- put_status(true);
- gotoxy(x,y);
- end; {end of clear}
-
- procedure erase_line;{--------------------------uses internal routine delline}
- begin
- window(1,1,80,24);
- delline;
- window(1,1,80,25);
- end; {end of erase_line}
-
- procedure insertline;{--------------------------Like above}
- begin
- window(1,1,80,24);
- insline;
- window(1,1,80,25);
- end; {end of insertline}
-
- procedure do_graphic(letter:integer);{----------outputs graphic key hit}
- begin
- case letter of
- 09: begin
- graphic_level:=graphic_level-1; {decrement key hit}
- if graphic_level<1 then graphic_level:=max_levels;
- put_status(false);
- end;
- 10: begin
- graphic_level:=graphic_level+1; {increment key hit}
- if graphic_level>max_levels then graphic_level:=1;
- put_status(false);
- end;
- 1..8:begin
- if graphic[graphic_level,letter]<>' ' then {if space then don't do anything}
- begin
- if insert then move_right; {check insert mode}
- write(graphic[graphic_level,letter]);{output the character}
- end;
- end;
- end;
- if wherey=25 then gotoxy(80,24); {check if at last pos on screen}
- end; {end of do_graphic}
-
- procedure next_word;{----------------------------moves by word}
- var
- y,
- x,
- counter:integer;
- begin
- y:=wherey;
- counter:=wherex;
- x:=wherex;
- repeat {find position of space}
- counter:=counter+1;
- until (mem[base_screen:(wherey-1)*160+(counter-1)*2]=32) and (mem[base_screen:(wherey-1)*160+counter*2]<> 32) or (counter
- = 79);
- if counter>=79 then counter:=x-1;
- gotoxy(counter+1,y); {move cursor to position}
- end; {end of next_word}
-
- procedure Previous_word;{------------------------like above, but in reverse}
- var
- y,
- x,
- counter:integer;
- begin
- y:=wherey;
- x:=wherex;
- counter:=wherex-1;
- repeat
- counter:=counter-1;
- until ((mem[base_screen:(wherey-1)*160+(counter-1)*2]=32)
- and (mem[base_screen:(wherey-1)*160+counter*2]<>32)) or (counter<=0);
- if counter<=0 then counter:=x-1;
- gotoxy(counter+1,y);
- end; {end of previous_word}
-
- procedure center_line;{--------------------------centres line on screen}
- var
- line:array[1..80] of integer;
- length,
- start,
- x,
- y,
- counter:integer;
- begin
- x:=wherex;
- y:=wherey;
- length:=last_pos(y)-first_pos(y)+1; {find start & end positions}
- start:=((80-length) div 2);
- for counter:=1 to length do {read line into array}
- line[counter]:=memw[base_screen:(y-1)*160+(first_pos(y)+counter-2)*2];
- gotoxy(1,y);
- clreol; {erase line}
- for counter:=0 to length-1 do {output line to screen}
- begin
- memw[base_screen:(y-1)*160+(start+counter)*2]:=line[counter+1];
- end;
- if y<24 then y:=y+1;
- gotoxy(x,y);
- end; {end of center_line}
-
- procedure do_lines;{------------------------------does the lines mode}
- var
- x,
- y:integer;
- key,
- key1:char;
- begin
- repeat {repeat until alt - hit}
- x:=wherex;
- y:=wherey;
- show_status; {show cursor location}
- gotoxy(73,25);
- textcolor(black);
- textbackground(white);
- write('LINES'); {inform user of mode}
- textcolor(forground);
- textbackground(background);
- gotoxy(x,y);
- read(kbd,key);
- if (key=#27) and keypressed then {read in char}
- read(kbd,key1)
- else
- key1:=#0;
- case ord(key1) of {do actions ...}
- 35:help;
- 72:if y>1 then {cursor Up}
- begin
- write(graphic[graphic_level,2]);
- gotoxy(x,y-1);
- end;
- 80:if y<24 then {Cursor down}
- begin
- write(graphic[graphic_level,2]);
- gotoxy(x,y+1);
- end;
- 77:if x<80 then write(graphic[graphic_level,1]);{cursor right}
- 75:if x>1 then {cursor left}
- begin
- write(graphic[graphic_level,1]);
- gotoxy(x-1,y);
- end;
- else if key1<>#130 then beep;
- end;
- until key1=#130; {alt - is #130}
- x:=wherex;
- y:=wherey;
- gotoxy(73,25);
- textbackground(black);
- clreol;
- textbackground(background);
- gotoxy(x,y);
- end; {end of do_lines}
-
- procedure Delete_section(startx,endx,starty,endy:integer); {removes part of screen}
- var
- x,
- y:integer;
- begin
- textcolor(forground);
- textbackground(background);
- if (endx-startx>1) and (endy-starty>1) then
- begin
- window(startx,starty,endx,endy);
- clrscr;
- window(1,1,80,25);
- end
- else
- for x:=startx to endx do
- begin
- for y:=starty to endy do
- begin
- gotoxy(x,y);
- write(' ');
- end;
- end;
- end; {end of delete_section}
-
- procedure copy_section(startx,endx,starty,endy,newx,newy:integer;delete:boolean); {copies section of screen}
- var
- counter1,
- counter2:integer;
- screen:array[1..80,1..24] of integer;
- begin
- for counter1:=startx to endx do {loop through section and dump to array}
- begin
- for counter2:=starty to endy do
- begin
- if (counter1-startx+newx<=80) then
- screen[counter1,counter2]:=memw[base_screen:(counter2-1)*160+(counter1-1)*2];
- end;
- end;
- if delete then delete_section(startx,endx,starty,endy); {delete section if move is used}
- for counter1:=startx to endx do
- begin {dump array to screen}
- for counter2:=starty to endy do
- begin
- if (counter1-startx+newx<=80) then
- memw[base_screen:(counter2-starty-1+newy)*160+(counter1-startx-1+newx)*2]:=screen[counter1,counter2];
- end;
- end;
- end; {end of copy_section}
-
- procedure get_xy(var x,y:integer);
- var
- key,
- key1:char;
- begin
- repeat
- read(kbd,key);
- if (key=#27) and keypressed then
- read(kbd,key1)
- else
- key1:=#0;
- case ord(key1) of
- 71:gotoxy(first_pos(wherey),wherey); {Home}
- 72:if wherey>1 then gotoxy(wherex,wherey-1); {Cursor up}
- 73:gotoxy(1,1); {Pg Up}
- 75:if wherex>1 then gotoxy(wherex-1,wherey); {Cursor Lft}
- 77:if wherex<80 then gotoxy(wherex+1,wherey); {Cursor Rgt}
- 79:if (last_pos(wherey)<>80) and (last_pos(wherey)<>1) then {End}
- gotoxy(last_pos(wherey)+1,wherey)
- else
- gotoxy(last_pos(wherey),wherey);
- 80:if wherey<24 then gotoxy(wherex,wherey+1); {Cursor Dn}
- 81:gotoxy(80,24); {Pg dn}
- 115:previous_word; {CTRL - Left}
- 116:Next_word; {CTRL - Right}
- else if key<>#13 then beep;
- end;
- until key=#13;
- x:=wherex;
- y:=wherey;
- end;
-
- procedure mark_colour;{---------------------------colours a block}
- var
- x,
- y,
- startx,
- endx,
- starty,
- endy,
- counter1,
- counter2:integer;
- orgcolour:byte;
- key,
- key1:char;
- begin
- x:=wherex;
- y:=wherey;
- gotoxy(1,25);
- textcolor(white);
- textbackground(black); {ask for co ordinates}
- clreol;
- write('Mark block colour: Put cursor at UPPER LEFT corner of block. CR when done');
- gotoxy(x,y);
- get_xy(startx,starty);
- orgcolour:=mem[base_screen:(starty-1)*160+(startx-1)*2+1];
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour xor 255;
- gotoxy(1,25);
- write('Mark block colour: Put cursor at LOWER RIGHT corner of block.');
- gotoxy(startx,starty);
- get_xy(endx,endy);
- put_status(true);
- show_status;
- textcolor(white);
- textbackground(black);
- if (startx<=endx) and (starty<=endy) then {if invalid co ordinates then do nothing}
- begin
- for counter1:=startx to endx do {loop thru and colour section}
- begin
- for counter2:=starty to endy do
- mem[base_screen:(counter2-1)*160+(counter1-1)*2+1]:=mem[base_screen:$0f21];
- end;
- end
- else
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour; {restore block markers}
- gotoxy(x,y);
- end; {end of mark_block}
-
- procedure Delete_block;{--------------------------removes a section of screen}
- var
- x,
- y,
- startx,
- endx,
- starty,
- endy,
- counter1,
- counter2:integer;
- orgcolour,
- forg:byte;
- key,
- key1:char;
- begin
- x:=wherex;
- y:=wherey;
- gotoxy(1,25);
- textcolor(white);
- textbackground(black); {get co ordinates}
- clreol;
- write('Delete block:Put cursor at UPPER LEFT corner of block. CR when done');
- gotoxy(x,y);
- get_xy(startx,starty);
- orgcolour:=mem[base_screen:(starty-1)*160+(startx-1)*2+1];
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour xor 255;
- gotoxy(1,25);
- write('Delete block:Put cursor at LOWER RIGHT corner of block.');
- gotoxy(startx,starty);
- get_xy(endx,endy);
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour;
- if (startx<=endx) and (starty<=endy) then {if valid co-ordiantes then do delete}
- delete_section(startx,endx,starty,endy);
- put_status(true);
- gotoxy(x,y);
- end; {end of delete_block}
-
- procedure copy_block(delete:boolean);{------------copy a block, also move}
- var
- x,
- y,
- startx,
- endx,
- starty,
- endy,
- newx,
- newy,
- counter1,
- counter2:integer;
- orgcolour1,
- orgcolour2:byte;
- key,
- key1:char;
- name:string[4];
- begin
- if delete then name:='Move' else name:='Copy'; {for screen output}
- x:=wherex;
- y:=wherey;
- gotoxy(1,25);
- textcolor(white);
- textbackground(black);
- clreol; {get co-ordinates}
- write(Name,' block: Put cursor at UPPER LEFT corner of block. CR when done');
- gotoxy(x,y);
- get_xy(startx,starty);
- orgcolour1:=mem[base_screen:(starty-1)*160+(startx-1)*2+1];
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour1 xor 255;
- gotoxy(1,25);
- write(name,' block: Put cursor at LOWER RIGHT corner of block.');
- gotoxy(startx,starty);
- get_xy(endx,endy);
- orgcolour2:=mem[base_screen:(endy-1)*160+(endx-1)*2+1];
- mem[base_screen:(endy-1)*160+(endx-1)*2+1]:=orgcolour2 xor 255;
- if (startx<=endx) and (starty<=endy) then
- begin
- gotoxy(1,25);
- write(name,' block: Put cursor at position to copy block. ');
- gotoxy(startx,starty);
- get_xy(newx,newy);
- mem[base_screen:(endy-1)*160+(endx-1)*2+1]:=orgcolour2;
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour1;
- copy_section(startx,endx,starty,endy,newx,newy,delete);
- end
- else
- begin
- mem[base_screen:(endy-1)*160+(endx-1)*2+1]:=orgcolour2;
- mem[base_screen:(starty-1)*160+(startx-1)*2+1]:=orgcolour1;
- end;
- put_status(true);
- gotoxy(x,y);
- end; {end of copy_block}
-
- procedure read_directory;{------------------------reads in directory}
- var
- counter,
- x,
- y:integer;
- screen:array [0..2000] of integer;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- cursor(false);
- move(mem[base_screen:0],screen,4000);
- textcolor(white);
- textbackground(black);
- clrscr;
- gotoxy(32,1);
- write('Directory of Files');
- gotoxy(1,4);
- textbackground(blue);
- dir('????????.SCR',false);
- clreol;
- textbackground(black);
- gotoxy(32,25);
- write('<<< Press a key >>>');
- waitkey;
- move(screen,mem[base_screen:0],4000);
- cursor(true);
- gotoxy(x,y);
- end; {End of read directory}
-
- procedure do_paths;{------------------------------Will allow you to ChDir}
- var
- path:string[54];
- x,
- y:integer;
- screen:array [0..2000] of integer;
- key:char;
- begin
- x:=wherex;
- y:=wherey;
- cursor(false);
- move(mem[base_screen:0],screen,4000);
- textcolor(white);
- textbackground(black);
- clrscr;
- gotoxy(26,1);
- write('Directory of Subdirectories');
- gotoxy(1,4);
- textcolor(yellow);
- getdir(0,path);
- write('Current SubDir: ',path);
- gotoxy(1,6);
- textcolor(white);
- textbackground(blue);
- dir('????????.???',true);
- clreol;
- textcolor(white);
- textbackground(black);
- gotoxy(1,25);
- clreol;
- write('Enter path to change to [CR = Exit]: ');
- path:='';
- cursor(true);
- buflen:=42;
- read(path);
- cursor(false);
- if path<>'' then
- begin
- {$i-}
- chdir(path);
- {$i+}
- if ioresult<>0 then
- begin
- gotoxy(1,25);
- clreol;
- write(^G,'[',path,'] Not valid. <<< Press a Key >>>');
- waitkey;
- end;
- end;
- move(screen,mem[base_screen:0],4000);
- gotoxy(x,y);
- end; {End of do_paths}
-
- procedure alter_flags;{---------------------------Change the configuration on disk}
- var
- screen:array[0..2000] of integer;
- configure:config;
- f_configure:file of config;
- x,
- y:integer;
-
- procedure disp_screen; {Display the config screen}
- begin
- textcolor(white);
- textbackground(blue);
- clrscr;
- gotoxy(20,3);
- write('A L T E R C O N F I G U R A T I O N');
- gotoxy(10,5);
- write('Use arrow keys to position cursor. Press RETURN to Activate');
- textcolor(lightgray);
- gotoxy(5,8);
- write('Insert Mode At Start :');
- gotoxy(5,10);
- write('Look To Disk For Help :');
- gotoxy(5,12);
- write('Path For Help :');
- gotoxy(5,14);
- write('Forground At Start :');
- gotoxy(5,16);
- write('Background At Start :');
- gotoxy(5,18);
- write('The Graphic Letter Set:');
- gotoxy(5,20);
- write('Exit Configuration :');
- gotoxy(9,22);
- textcolor(white);
- write('Press [');
- textcolor(white + blink);
- write('+');
- textcolor(white);
- write('] to increase Graph Level, [');
- textcolor(white+blink);
- write('-');
- textcolor(white);
- write('] to decrease Graph Level.');
- gotoxy(27,24);
- write('Press <SPACE BAR> to reset.');
- end;
-
- procedure display_info(y,level,letter:integer); {Put the info on the screen}
- var
- counter:integer;
- begin
- textcolor(lightgray);
- gotoxy(30,8);
- if insert then write('ON ') else write('OFF');
- gotoxy(30,10);
- if help_on_disk then write('YES') else write('NO ');
- gotoxy(30,12);
- clreol;
- write(HelpPath);
- gotoxy(30,14);
- write(forground:2);
- gotoxy(30,16);
- write(background:2);
- gotoxy(45,14);
- textcolor(forground);
- textbackground(background);
- write('Colour');
- textcolor(white);
- textbackground(blue);
- gotoxy(45,16);
- write('Graph Level: ',level:2);
- gotoxy(30,18);
- for counter:=1 to 8 do
- begin
- textcolor(white);
- write(counter);
- textcolor(lightgray);
- write(' ',graphic[level,counter],' ');
- end;
- gotoxy(30,20);
- write('':10);
- if y<>18 then gotoxy(70,16);
- clreol;
- case y of
- 08:begin
- gotoxy(30,8);
- textcolor(blue);
- textbackground(white);
- if insert then write('ON ') else write('OFF');
- textcolor(white);
- textbackground(blue);
- end;
- 10:begin
- gotoxy(30,10);
- textcolor(blue);
- textbackground(white);
- if help_on_disk then write('YES') else write('NO');
- textcolor(white);
- textbackground(blue);
- end;
- 12:begin
- gotoxy(30,12);
- textcolor(blue);
- textbackground(white);
- write(Helppath);
- textcolor(white);
- textbackground(blue);
- end;
- 14:begin
- gotoxy(30,14);
- textcolor(blue);
- textbackground(white);
- write(forground:2);
- textcolor(white);
- textbackground(blue);
- end;
- 16:begin
- gotoxy(30,16);
- textcolor(blue);
- textbackground(white);
- write(background:2);
- textcolor(white);
- textbackground(blue);
- end;
- 18:begin
- gotoxy(70,16);
- textcolor(white);
- write('ASCII = ');
- clreol;
- write(ord(graphic[level,letter]):3);
- gotoxy(letter*6+26,18);
- textbackground(white);
- textcolor(blue);
- write(graphic[level,letter]);
- textcolor(white);
- textbackground(blue);
- end;
- 20:begin
- gotoxy(30,20);
- textcolor(blue);
- textbackground(white);
- write('':10);
- textcolor(white);
- textbackground(blue);
- end;
- end;
- end;
-
- procedure do_input; {Read in the input and work with it}
- var
- numstr:string[3];
- letter,
- level,
- num,
- y,
- code:integer;
- saved,
- leave:boolean;
- key,
- key1:char;
- begin
- leave:=false;
- level:=1;
- letter:=1;
- y:=8;
- cursor(false);
- repeat
- repeat
- key:=#0;
- key1:=#0;
- display_info(y,level,letter);
- read(kbd,key);
- if keypressed then read(kbd,key1);
- case ord(key1) of
- 72:if y>8 then y:=y-2 else y:=20;
- 80:if y<20 then y:=y+2 else y:=8;
- 77:if (y=18) then
- if letter<8 then letter:=letter+1 else letter:=1;
- 75:if (y=18) then
- if letter>1 then letter:=letter-1 else letter:=8;
- end;
- if key='-' then if level>1 then level:=level-1 else level:=19;
- if key in['=','+'] then if level<19 then level:=level+1 else level:=1;
- if key=' ' then initialize_editor(false);
- until key=#13;
- case y of
- 8:insert:=not insert;
- 10:Help_on_disk:=not help_on_disk;
- 12:begin
- gotoxy(40,10);
- write('Enter NEW Path for EdScreen.HLP');
- gotoxy(30,12);
- cursor(true);
- repeat until keypressed;
- clreol;
- read(helppath);
- cursor(false);
- gotoxy(40,10);
- clreol;
- end;
- 14:if forground<15 then forground:=forground+1 else forground:=0;
- 16:if background<7 then background:=background+1 else background:=0;
- 18:begin
- gotoxy(20,17);
- write('Enter ASCII for character to replace:');
- repeat
- cursor(true);
- gotoxy(59,17);
- clreol;
- buflen:=3;
- read(numstr);
- cursor(false);
- val(numstr,num,code);
- if code<>0 then write(^g);
- until code=0;
- graphic[level,letter]:=chr(num);
- gotoxy(20,17);
- clreol;
- end;
- 20:begin
- gotoxy(30,20);
- write('Do you want the Configuration saved [Y/N] ? ');
- cursor(true);
- repeat
- read(kbd,key);
- key:=upcase(key);
- until key in ['Y','N'];
- leave:=true;
- saved:=key = 'Y';
- end;
- end;
- until leave;
- if saved then
- begin
- with configure do
- begin
- insert_mode:=insert;
- graphic_letters:=graphic;
- help:=help_on_disk;
- help_path:=helpPath;
- forg:=forground;
- back:=background;
- end;
- assign(f_configure,'EDSCREEN.CNF');
- rewrite(f_configure);
- write(f_configure,configure);
- close(f_configure);
- end;
- cursor(true);
- end;
-
- begin {}{}{MAIN FOR alter_Flags}
- x:=wherex;
- y:=wherey;
- move(mem[base_screen:0],screen,4000);
- disp_screen;
- do_input;
- move(screen,mem[base_screen:0],4000);
- gotoxy(x,y);
- textcolor(forground);
- textbackground(background);
- end; {}{}{End of alter_flags}
-
- procedure process_key(letter:char);{-------------interprets user input}
-
- {This procedure processes the one-scan code type keys. Ie normal. It
- will act on the control keys such as ^C and backspace as well as outputting
- the normal keys}
-
- begin
- case letter of
- ' '..#255:begin {normal keys}
- if insert then move_right;
- write(letter);
- end;
- ^C :quit;
- ^H :do_backspace; {backspace}
- ^M :if wherey<24 then writeln; {CR}
- ^J :if wherey<24 then gotoxy(wherex,wherey+1);{LF}
- ^I :if wherex<72 then gotoxy(wherex+8,wherey);{TAB}
- else beep;
- end;
- if wherey=25 then gotoxy(80,24); {last spot on screen}
- end; {end of process_key}
-
- procedure process_special(letter:char);{----------interpretes double key codes}
-
- {This is the procedure that handles all the special commands in the editor.
- All the alt keys are here. }
-
- begin
- case ord(letter) of
- {***** =-=-=-=-=-=-=- Commands -=-=-=-=-=-=-=- *******}
- 16:quit; {Alt-Q - Quit}
- 17:clear; { W - Wipe Screen}
- 19:Read_directory; { R - Read Directory}
- 21:erase_line; { Y - Delete line}
- 24:load(2); { O - Overlay}
- 25:Do_paths; { P - Path stuff}
- 30:Alter_flags; { A - Alter Flags}
- 31:save; { S - save picture}
- 32:delete_block; { D - Delete block}
- 33:begin { F - Forground}
- forground:=forground+1;
- if blinking then forground:=forground xor 16; {turn off blink}
- if forground>15 then forground:=0; {for wrap-around}
- if blinking then forground:=forground xor 16; {Restore blink}
- end;
- 34:show_graphic; { G - Show graphics}
- 35:help; { H - help}
- 37:copy_block(false); { K - Copy block}
- 38:load(1); { L - load in picture}
- 45:load(3); { X - examine picture}
- 46:center_line; { C - Centre line}
- 47:copy_block(true); { V - Move Block}
- 48:begin { B - Background}
- background:=background+1;
- if background>7 then background:=0;
- end;
- 49:insertline; { N - insert line}
- 50:mark_colour; { M - Mark colours}
- 120..129:do_graphic(ord(letter)-119); { 0-9 - graphic}
- 130:do_lines; { "-" - lines}
- 131:begin { = - hilight eg blink}
- forground:=forground xor 16;
- blinking:=not blinking;
- end;
- {****** -=-=-=-=-= Editing commands -=-=-=-=-=-=-= *******}
- 15:if wherex>8 then gotoxy(wherex-8,wherey); {Shift TAB}
- 71:gotoxy(first_pos(wherey),wherey); {Home}
- 72:if wherey>1 then gotoxy(wherex,wherey-1); {Cursor up}
- 73:gotoxy(1,1); {Pg Up}
- 75:if wherex>1 then gotoxy(wherex-1,wherey); {Cursor Lft}
- 77:if wherex<80 then gotoxy(wherex+1,wherey); {Cursor Rgt}
- 79:if (last_pos(wherey)<>80) and (last_pos(wherey)<>1) then {End}
- gotoxy(last_pos(wherey)+1,wherey)
- else
- gotoxy(last_pos(wherey),wherey);
- 80:if wherey<24 then gotoxy(wherex,wherey+1); {Cursor Dn}
- 81:gotoxy(80,24); {Pg dn}
- 82:insert:=not insert; {insert hit}
- 83:do_delete; {delete hit}
- 115:previous_word; {CTRL - Left}
- 116:Next_word; {CTRL - Right}
- 117:clreol; {CTRL - END}
- else beep;
- end;
- end; {end of process special}
-
- procedure do_edit;{-------------------------------Main editing procedure}
-
- {This is the main editing loop of the programme. It is just an endless loop
- that accepts keys and processes them}
-
- var
- key,
- special:char;
- begin
- repeat {endless loop}
- show_status;
- read(kbd,key);
- if (key=#27) and (keypressed) then {check special key}
- begin
- read(kbd,special);
- process_special(special);
- end
- else
- process_key(key);
- until false;
- end; {end of do_edit}
-
- begin{******************************************** MAIN PROGRAMME}
- titlescreen; {title}
- do_edit; {editing loop}
- end. {end of programme}