home *** CD-ROM | disk | FTP | other *** search
- 1000 GOSUB 1280:PRINT" <<< RDPLT >>>":PRINT:' cls, display header
- 1010 PRINT"Purpose:":PRINT:PRINT" To plot from a data file which contains HPGL command strings.":PRINT
- 1020 PRINT"Method:":PRINT:PRINT" The data file must be sequential ascii file, records delimited"
- 1030 PRINT" by commas and contain valid HPGL instructions.":PRINT:PRINT:PRINT:INPUT"Press ENTER to continue",A$
- 1040 STATP%=133:DATP%=132:CTCP%=137:' Status port, Data port, CTC port - Z80-SIO, STATP%=89, DATP%=88 for the 8251 UART
- 1050 GOSUB 1280:M%=22:N%=1:GOSUB 1290:INPUT"The plotter is HP? (Y/N) ",A$:IF A$<>"Y" AND A$<>"N"THEN 1050
- 1060 FACIT=1+(A$="Y"):GOSUB 1290:INPUT"Setup the serial port? (Y/N) ",A$:IF A$<>"Y" AND A$<>"N"THEN 1060
- 1070 IF A$="Y" THEN GOSUB 1140
- 1080 M%=22:N%=1:GOSUB 1290:LINE INPUT"Filename: ",A$:IF A$="" THEN 1110 ELSE 1090:' no checking on validity of filename
- 1090 FF$=A$:GOSUB 1290:INPUT"Ready to plot? (Y/N) ",A$:IF A$<>"Y" AND A$<>"N"THEN 1090
- 1100 IF A$="Y" THEN GOSUB 1600
- 1110 M%=22:N%=1:GOSUB 1290:INPUT"Exit this program? (N) ",A$:IF A$="Y" THEN END ELSE 1000
- 1120 '
- 1130 ' Suroutine to setup the serial port and set the plotter to xon/xoff handshake
- 1140 OUT(STATP%),24:OUT(STATP%),4:OUT(STATP%),68:OUT(CTCP%),71:' channel reset, 16x clock, async, 1 stop, data for CTC
- 1150 IF FACIT=0 THEN OUT(CTCP%),16 ELSE OUT(CTCP%),4:' CTC divider, 2400/9600 baud (HP-7225/FACIT)
- 1160 OUT(STATP%),3:OUT(STATP%),193:' 8 data, Rx enable, DCD/CTS inactive
- 1170 OUT(STATP%),5:OUT(STATP%),104:' 8 data, Tx enable, DTR/RTS inactive
- 1180 M%=22:N%=1:GOSUB 1290:INPUT"Include plotter setup commands (N)";A$:IF A$<>"Y" THEN RETURN
- 1190 P$=CHR$(27)+".(":GOSUB 1370:' turn plotter on (playing safe, changing paper may turn it off)
- 1200 P$=CHR$(27)+".@;0:":GOSUB 1370:' reset the plotter, cancell hardwire h/s (default is hardwire h/s for HP)
- 1210 P$=CHR$(27)+".I80;;17:":GOSUB 1370:' set the plotter buffer treshold, set X-on/X-of protocol (X-on char)
- 1220 P$=CHR$(27)+".N;19:":GOSUB 1370:' set X-off character (fill buffer if there is a space for 80 bytes)
- 1230 IF FACIT=0 THEN P$="IN;DF;IP0,0,11420,8140;VS"+STR$(VS%)+";":GOSUB 1370:RETURN:' init to HP (defaults)
- 1240 P$="IN;DF;IP0,0,10880,7640;VS"+STR$(VS%)+";":GOSUB 1370:' init command to FACIT plotter (defaults)
- 1250 RETURN:' all nicely in a file - can be coppied later to a plotter with no worries
- 1260 '
- 1270 ' Subroutines to control the screen (Televideo terminal)
- 1280 PRINT CHR$(27)CHR$(43):RETURN:' to clear the whole screen
- 1290 GOSUB 1310:PRINT CHR$(27)CHR$(89):GOSUB 1310:RETURN:' clear to the end of screen (foreground)
- 1300 GOSUB 1310:PRINT CHR$(27)CHR$(84):GOSUB 1310:RETURN:' to clear line at the cursor address
- 1310 PRINT CHR$(27)CHR$(61)CHR$(M%+31)CHR$(N%+31);:RETURN:' for direct cursor address
- 1320 '
- 1330 ' Subroutine to send a command string to the plotter (set for x-on/x-off handshake protocol)
- 1340 ' Comment OUT that part of this subroutine that is not relevant to your system. The label of the subroutine
- 1350 ' is always 1370 and the RETURN statement is at the very end of this subroutine.
- 1360 '-----------------------
- 1370 ' LPRINT P$:' for those who are using parallel connection or when the system does the handshake
- 1380 '-----------------------
- 1390 ' The following is for Z80 SIO, status port is 133, data 132. Change to suit to your system.
- 1400 FOR L%=1 TO LEN(P$):' start the data send loop
- 1410 S%=INP(STATP%):' read RR0, 0 = rec buffer empty, 1 = full
- 1420 IF (S% AND 1)=0 THEN 1470:' send char if rec buff empty
- 1430 D%=INP(DATP%):' read char from the rec buffer
- 1440 IF D%=19 THEN 1430:' it is X-off char, so loop
- 1450 IF D%=17 THEN 1470:' it is X-on char, so send another char
- 1460 OUT(STATP%),48:GOTO 1410:' reset on all other chars (incl err) and go for more
- 1470 IF (S% AND 4)=0 THEN 1410:' transmit buffer not empty, so loop
- 1480 OUT(DATP%),ASC(MID$(P$,L%,1)):NEXT:' send a char of the string
- 1490 '-----------------------
- 1500 ' The following is for the 8251 UART, status port is 89, data 88. Change to suit your system.
- 1510 ' IF(INP(STATP%) AND 2)=0 THEN 1530:' is there a Rx char? jump if not
- 1520 ' C%=INP(DATP%):IF C%=17 THEN C%=0 ELSE IF C%=19 THEN C%=1:' Rx char into a variable
- 1530 ' IF C%<>0 THEN 1510 ELSE 1540:' loop if x-off
- 1540 ' FOR L%=1 to LEN(P$):' start sending data
- 1550 ' IF(INP(STATP%) AND 1)=0 THEN 1550 ELSE OUT(DATP%),ASC(MID$(P$,L%,1)):NEXT:' loop if buffer full else transmit
- 1560 '-----------------------
- 1570 RETURN:' return gracefully when all send (the very END of this subroutine)
- 1580 '
- 1590 ' Subroutine to plot from the SEQUENTIONAL data file (from either default $PLOT.PLT or given data file)
- 1600 OPEN"I",#2,FF$:' open sequentional data file for INPUT, set plot-data-file flag
- 1610 INPUT#2,Q$:IF MID$(Q$,1,2)="SP" THEN GOSUB 1630:' change pen on HP, no need for FACIT to stop
- 1620 P$=Q$:GOSUB 1370:IF EOF(2) THEN 1640 ELSE 1610:' command string to plotter, check if end of file
- 1630 INPUT"Change pen, then press ENTER to continue!",A$:P$=CHR$(27)+".(":GOSUB 1370:RETURN:' break, then plotter ON
- 1640 CLOSE:RETURN:' close the file, reset flag and return
- 1650 '
- 1660 END