home *** CD-ROM | disk | FTP | other *** search
- { toshiba -/send printer codes to the TOSHIBA printer }
-
- program toshiba;
-
- const
- program_name = 'P1351';
- rev_no = '1.21';
- rev_date = '10/11/85';
- sys_date : string[8] = ' ';
-
- type
- string4 = string[4];
- string64 = string[64];
- string127 = string[127];
-
- var
- line,select_code,rc : integer;
- escape,
- bel : char;
- parm_select : string127;
- select : string[2];
- in_line_command : boolean;
-
- { ************************************************************************** }
-
- procedure colors(text,background : integer);
-
- { This procedure permits the change of both text and background colors }
- { with one procedure call, available colors are: }
-
- { 0 = black 6 = brown 12 = light red }
- { 1 = blue 7 = light gray 13 = light magenta }
- { 2 = green 8 = dark gray 14 = yellow }
- { 3 = cyan 9 = light blue 15 = white }
- { 4 = red 10 = light green }
- { 5 = magenta 11 = light cyan }
-
- { text colors from 16 thru 31 will blink }
-
- begin
- textcolor(text);
- textbackground(background);
- end;
- { *************************************************************************** }
-
- procedure clear_screen(text,background : integer);
- begin
- colors(text,background);
- clrscr;
- colors(15,0);
- write('Program: ',program_name:8,' Rev number:',rev_no:5);
- gotoxy(1,3);
- colors(text,background);
- end;
-
- { ************************************************************************** }
-
- procedure getparm(var s:string127);
- var
- parms : string127 absolute CSEG:$80;
- begin
- s := ''; { parms[1] exists even when length is zero }
- while (length(parms) > 0) and (parms[1] = ' ') do
- delete(parms,1,1);
- while (length(parms) > 0) and (parms[1] <> ' ') do
- begin
- s := s + Parms[1]; delete(parms,1,1)
- end
- end;
-
- { ************************************************************************** }
-
- procedure selection_menu;
- begin
- clear_screen(15,0);
- writeln(' 2 - Expanded Print On 4 - Condensed Print On');
- writeln(' 3 - Expanded Print Off 5 - Condensed Print Off');
- writeln;
- writeln(' 6 - Six Lines/Inch 7 - Eight Lines/Inch 8 - Nine Lines/Inch');
- writeln;
- writeln(' 9 - Data Mode - Character Font 0 (12 cpi)');
- writeln(' 10 - Data Mode - Character Font 0 (10 cpi)');
- writeln;
- writeln(' 11 - Courier - Character Font 1 (12 cpi)');
- writeln(' 12 - Elite --- Character Font 2 (10 cpi)');
- writeln;
- writeln(' (P1351 and P351 Only) (P351 Font Cartridge Only)');
- writeln(' 13 - Font 4 14 - Font 5 15 - Font 6 16 - Font 7');
- writeln;
- writeln(' 17 - 10 CPI 18 - 12 CPI 19 - 15 CPI 20 - 17 CPI 21 - 20 CPI');
- writeln;
- writeln(' 22 - Initialize Printer');
- writeln;
- writeln(' 99 - EXIT TO SYSTEM 98 - Command Line Instructions');
- writeln;
- writeln(' Select desired option by number : ');
- writeln(' Options selected = ');
- line:=20;
- end;
-
- { ************************************************************************** }
-
- procedure program_instructions;
- begin
- clear_screen(15,0);
- writeln('Command format - P1351 <c> <c1> <c2> ... <cn>');
- writeln;
- writeln(' If no inline codes are specified the program will display the selection');
- writeln(' menu as it is now doing.');
- writeln;
- writeln(' If inline codes are specified the program will send the appropriate');
- writeln(' code(s) to the printer and then stop execution. No selection menus');
- writeln(' will be displayed and no opportunity to select additional code will be');
- writeln(' given.');
- writeln;
- writeln(' Codes are specified in the command line by specifying the selsction');
- writeln(' number from the selection menu.');
- writeln;
- writeln(' Examples:');
- writeln(' C>P1351 3 will send compressed print codes to the printer.');
- writeln(' C>P1351 7 will send 8 lines per inch code to the printer.');
- writeln(' C>P1351 4 17 14 will set the printer to non-compressed mode');
- writeln(' select 10 cpi and font 4.');
- writeln;
- writeln('Press any key to return to selection menu');
- repeat read(kbd) until keypressed;
- selection_menu;
- end;
-
- { ************************************************************************** }
-
- procedure send_code;
- begin;
- case select_code of
- 1 : write(lst,^G); { bel }
- 2 : write(lst,^['!'); { expanded_on }
- 3 : write(lst,^['"'); { expanded_off }
- 4 : write(lst,^['*0'^['['); { font0 & condensed on }
- 5 : write(lst,^[']'); { condensed_off }
- 6 : write(lst,^['L08'); { six_lpi }
- 7 : write(lst,^['L06'); { eight_lpi }
- 8 : write(lst,^['L05'); { nine lpi }
- 9 : write(lst,^['*0'^['E10'); { font0 & twelve cpi }
- 10 : write(lst,^['*0'^['E12'); { font0 & ten cpi }
- 11 : write(lst,^['*1'^['E10'); { font1 & twelve cpi }
- 12 : write(lst,^['*2'^['E12'); { font2 & ten cpi }
- 13 : write(lst,^['*4'); { font4 }
- 14 : write(lst,^['*5'); { font5 }
- 15 : write(lst,^['*6'); { font6 }
- 16 : write(lst,^['*7'); { font7 }
- 17 : write(lst,^['E12'); { ten cpi }
- 18 : write(lst,^['E10'); { twelve cpi }
- 19 : write(lst,^['E08'); { fifteen cpi }
- 20 : write(lst,^['E07'); { seventeen cpi }
- 21 : write(lst,^['E06'); { twenty cpi }
- 22 : write(lst,^[^Z'I'); { initialize }
- else
- writeln('Illegal printer code: ',select_code:4);
- end;
- end;
-
- { ************************************************************************** }
-
- procedure selection;
- begin
- selection_menu;
- repeat
- repeat
- begin
- gotoxy(36,23);
- write(' ');
- gotoxy(36,23);
- select:='**';
- buflen:=2;
- read(select);
- val(select,select_code,rc);
- end;
- until select_code in [2..7,9..22,98,99];
- if select_code = 98 then
- program_instructions
- else
- send_code;
- gotoxy(line,24);
- write(select:5);
- line:=line+5;
- until select_code = 99;
- end;
-
- { ************************************************************************** }
-
- begin;
- { determine if inline commands exist }
- getparm(parm_select);
- if parm_select = '' then
- in_line_command := false
- else
- in_line_command := true;
- { process inline commands }
- if in_line_command then
- repeat
- val(parm_select,select_code,rc);
- send_code;
- getparm(parm_select);
- until parm_select = '';
- { display menu and capture command requests }
- if not in_line_command then
- begin
- selection;
- clear_screen(15,0);
- end;
- end.
-
-
-
- { REV 1.20 09/15/85 }
- { The Code was modified so that inline commands would be sent }
- { to the printer without presenting the selection menu. }
- { Instructions for using the command line were added and variables }
- { were replaces with literals. Some undocumented codes were added. }
-