[ont.micro.mac] Complete MacTep Update

info-mac@utcsrgv.UUCP (info-mac) (06/29/84)

Date: 23 Jun 84 12:21:40 EDT
From: uw-beaver!jmh@BNL
Subject: Complete MacTep Update
To: INFO-MAC@SUMEX-AIM


Below are the following files: MacTep Notes 6/6/84 (text), MacTep 1.87 (Mbasic),
                               MacTep runner (Mbasic)
 
Joel M. Heller

------------------------


MacTEP Notes - 6-June-84

Dennis F. Brothers - Compuserve 70065,172 - MCI Mail DBROTHERS

     This is a new version (1.87) of MacTEP, a Macintosh Terminal Emulator
Program, written in Microsoft BASIC. Improvements over earlier versions
include much better performance at high speeds (9600 baud or better), creation
of true MacWrite and MS BASIC documents when downloading, the ability to
download to the printer, a cursor whose shape indicates the current mode, user
control over X-ON/X-OFF throttling, and prompted upload capability.

- Using MacTEP -
     MacTEP is a Microsoft Basic program, but it is sufficiently large that it
can't be executed by double-clicking its icon. Instead, a very simple program
called MacTEP Runner is provided, which does nothing but clear memory and run
MacTEP when double-clicked. If you still get an "Out of Memory" message when
running MacTEP, it probably means that you have something large in your
Clipboard -- try COPYing something small from the desktop, then
double-clicking MacTEP Runner again.
     Once MacTEP begins execution, it will ask for a baud rate. Any standard
baud rate up to 38,400 may be entered, but characters may occasionally be lost
at speeds above 9600. MacTEP will then ask whether you want X-ON/X-OFF receive
throttling. Unless you are working with a remote system which can't handle
X-ON/X-OFF, take the default of "yes" by hitting Return.
     After setting these initial parameters, you will see the small, square
"terminal mode" cursor. A horizontal bar cursor indicates that you are
downloading, and a vertical bar indicates uploading. Any time a cursor is
visible, anything typed on the keyboard will be sent to the modem, and
anything received from the modem will be displayed on the screen.
     When you wish to leave MacTEP and return to the Macintosh desktop, press
Option-X (you must be in plain terminal mode, not uploading or downloading, to
do this).

- Downloading -
     To start downloading (receiving from a remote system to a disk file, the
printer, or the Clipboard), press Option-R (to download a text file as a
MacWrite document) or Option-B (to download a BASIC program). MacTEP will ask
for a file name. You may change your mind and cancel the download by just
typing a Return at this point. Otherwise, type the name you wish to give to
the downloaded file. The single letter "P" is shorthand for the printer, and
"C" means the Clipboard. After you begin downloading, everything received from
the remote system is sent to the specified file (or printer or Clipboard), in
addition to being displayed on the screen. When you have received everything
you want to capture, press Option-R or Option-B again.

- Uploading -
     To send a file to a remote system (upload), press Option-T. You will be
asked for a file name, for which you may enter the name of any text file (or
the letter "C" to send the contents of the Clipboard). You are then asked for
a prompt character - if the remote system will prompt you for each line with
some specific character, or if you wish to manually trigger the transmission
of each line by hitting a particular character on the keyboard, enter that
character. Note that while uploading with a prompt character in effect, that
character cannot be sent from the keyboard to the remote system. If you do not
wish to use prompted mode, hit Return. After answering the prompting question,
you will be asked whether X-ON/X-OFF transmission throttling is to be used. If
the remote system does not support this, (or uses it incorrectly, as does
DJNR), default to "no" by hitting Return.
     After these questions have been answered, the contents of the file (or
the Clipboard, if you entered "C" for the file name) will be sent to the
remote system, as though it had been typed on the keyboard. If you are using
prompting from the remote system, you may have to manually type the prompt
character once to force transmission of the first line. Transmission will end,
and normal terminal mode resumed, when the end of the file is reached. You may
abort transmission at any time by striking a second Option-T.
     Be careful to send only text files (such as MacWrite documents saved
text-only or MS BASIC programs saved in ASCII format) with this version of
MacTEP - other types of files will very likely confuse your remote system.

- Tidbits and Warnings -
     If you need to send a Control-C to your remote system, use the Enter key
-- a CMD-C will interrupt MacTEP and bounce you back into BASIC command mode.
     Because MacTEP reserves a large amount of memory for itself, trying to
use the Desk Accessories may cause a system error.
     When downloading to the Clipboard, commas will be changed to tabs. The
reverse happens when uploading from the Clipboard. See my column in June '84
A+ for more information.
     After successfully running MacTEP at least once, you can speed up the
initialization process by REMing out lines 6470 through 6510 -- they are used
only to verify the accuracy of the machine-language DATA statements. Be sure
to restore those lines if you upload MacTEP to a bulletin board.

- Getting Later Versions of MacTEP -
     The latest version of MacTEP will generally be available through
Compuserve, in the ACCESS database (section XA4) of the Micronet Apple User's
Group (MAUG). After logging into Compuserve, type "GO PCS51" to get to MAUG.
     New versions of MacTEP will also propagate to other bulletin boards
around the country, as MAUG members (and others) pass it around.
     If you can't find MacTEP anywhere else, send a blank Macintosh disk, with
a stamped, self-addressed return mailer and a check for $5.00, to:
          MacTEP Offer
          Brothers Associates
          197 Old Connecticut Path
          Wayland, MA 01778
Your disk will be returned containing a copy of the latest Microsoft BASIC
version of MacTEP.



----------------------


1000 CALL TEXTSIZE(9): CALL TEXTFONT(4)  '  Use 9-point Monaco
1010 CLS: PRINT
1020 PRINT "   MacTEP - Macintosh Terminal Emulator Program"
1030 PRINT
1040 PRINT "   Version 1.87 - 6 June, 1984"
1050 PRINT "   Dennis F. Brothers - Compuserve 70065,172 - MCI Mail DBROTHERS"
1060 PRINT
1070 PRINT "   Copyright (c) 1984 - Brothers Associates, Wayland MA"
1080 PRINT "   Permission is hereby granted for personal, non-commercial"
1090 PRINT "   reproduction and use of this program, provided that this"
1100 PRINT "   notice is included in any copy."
1110 PRINT: PRINT
1120 PRINT "   Option-R starts and stops ASCII receive (download)."
1130 PRINT "   Option-B starts and stops ASCII BASIC receive"
1140 PRINT "            (lines not beginning with a digit are ignored)."
1150 PRINT "   Option-T starts and stops ASCII transmit (upload)."
1160 PRINT "   Option-X exits to the Macintosh desktop."
1170 PRINT
1180 PRINT "   Initializing - Please wait....."
1190 PRINT
1200 REM
1210 CLEAR ,25000: REM  Allocate extra memory
1220 DEFINT A-Z: REM  Default to integers for speed
1230 REM
1240 GOSUB 5000: REM  Define constants
1250 GOSUB 6000: REM  Allocate variables
1260 REM
1270 INPUT "Baud rate: ", BR!: TC=INT((115200!/BR!)+.5)-2  '  Set time constant
1280 LINE INPUT "Use X-ON/X-OFF receive handshaking? (Y/N, Return=Y): ",C$
1290 RCVXFLAG=NOT(C$="n" OR C$="N")
1300 GOSUB 7000: REM  Initialize communication port
1310 REM
1320 PRINT: PRINT
1330 CALL PENNORMAL: CALL SHOWPEN: CALL PENMODE(10)  '  Prepare for cursor
1340 REM
2000 REM   Terminal Mode
2010 REM
2020 ON ERROR GOTO 0  '  Make sure error trapping is normal
2030 CALL PENSIZE(4,1)  '  Terminal mode cursor is square
2040 XFLAG=FALSE  '  No X-OFF outstanding
2050 CALL LINE(0,-4)  '  Draw the cursor
2060 IF LOC(1)=0 THEN GOTO 2130  '  No receive characters waiting
2070    IF NOT RCVXFLAG THEN GOTO 2090
2080       IF LOC(1)>BUFLIM AND NOT XFLAG THEN PRINT #1,XOFF$;: XFLAG=TRUE
2090    L$=INPUT$(LOC(1),#1)  '  Input all waiting characters
2100    CALL TRANSLATE!(XTABLE!,LP!,TLP!)  '  Strip and translate
2110    IF TL<>0 THEN CALL LINE(0,4): PRINT LEFT$(L$,TL);: CALL LINE(0,-4)
2120    IF XFLAG THEN XFLAG=FALSE: PRINT #1,XON$;  '  turn the remote back on
2130 C$=INKEY$  '  Has user struck a key?
2140 IF C$="" THEN GOTO 2060  '  No
2150 IF C$=OPTB$ OR C$=SHOPTB$ THEN CALL LINE(0,4): BASIC=TRUE : GOTO 3000
2160 IF C$=OPTR$ OR C$=SHOPTR$ THEN CALL LINE(0,4): BASIC=FALSE: GOTO 3000
2170 IF C$=OPTT$ OR C$=SHOPTT$ THEN CALL LINE(0,4): GOTO 4000
2180 IF C$<>OPTX$ AND C$<>SHOPTX$ THEN PRINT #1,C$;: GOTO 2060  '  Send key char
2190 CALL LINE(0,4): PRINT: PRINT "Exiting...": SYSTEM
2200 REM
3000 REM Receive (download) ASCII File or BASIC program
3010 REM
3020 CALL PENSIZE(6,1)  '  Download cursor is a horizontal bar
3030 XFLAG=FALSE: CRFLAG=TRUE: FLUSH=FALSE  '  Initialize logical flags
3040 PRINT: PRINT "Receive File Name - "
3050 LINE INPUT "     (P=Printer, C=Clipboard, Return=abort): ",F$
3060 IF F$="" THEN GOTO 2000  '  No file name - go back to terminal mode
3070 IF F$="C" OR F$="c" THEN F$="CLIP:"  '  User wants the Clipboard
3080 IF F$="P" OR F$="p" THEN F$="LPT1:"  '  The Imagewriter
3090 OPEN F$ FOR OUTPUT AS #2: WIDTH #2,255  '  Open the receive file or device
3100 IF F$<>"LPT1:" AND F$<>"lpt1:" THEN GOTO 3130
3110    PRINT #2,ESC$;"D";CHR$(128);CHR$(0);  '  Set printer for auto-linefeed
3120 REM
3130 CALL LINE(0,-2)  '  Draw the cursor
3140 QUIT=FALSE  '  Initialize termination flag
3150 WHILE NOT QUIT  '  Do until receive ends
3160    IF LOC(1)=0 THEN GOTO 3300  '  No receive characters available
3170       IF NOT RCVXFLAG THEN GOTO 3190
3180          IF LOC(1)>BUFLIM AND NEN PRINT #1,XOFF$;: XFLAG=TRUE
3190       L$=INPUT$(LOC(1),#1)  '  Get all available receive characters
3200       CALL TRANSLATE!(XTABLE!,LP!,TLP!)  '  Translate and strip
3210       IF TL=0 THEN GOTO 3290  '  None left after stripping
3220          CALL LINE(0,2): PRINT LEFT$(L$,TL);: CALL LINE(0,-2)
3230          IF NOT BASIC THEN GOTO 3260  '  Straight ASCII
3240             CALL BPROC!(LP!,TLP!,CRFLAGP!,FLUSHP!)  '  Kill non-BASIC lines
3250             IF TL=0 THEN GOTO 3290  '  Nothing left after processing
3260          IF NOT RCVXFLAG THEN GOTO 3280
3270             IF LOC(1)>BUFLIM AND NOT XFLAG THEN PRINT #1,XOFF$;: XFLAG=TRUE
3280          PRINT #2,LEFT$(L$,TL);  '  Send received chars to file or device
3290       IF XFLAG THEN XFLAG=FALSE: PRINT #1,XON$;  '  X-ON if needed
3300    C$=INKEY$  '  Anything from keyboard?
3310    IF C$="" THEN GOTO 3350  '  No
3320    IF C$=OPTB$ OR C$=SHOPTB$ THEN QUIT=TRUE: GOTO 3350
3330    IF C$=OPTR$ OR C$=SHOPTR$ THEN QUIT=TRUE: GOTO 3350
3340    PRINT #1,C$;  '  Send keyed character to remote
3350    WEND  '  Keep looping until user says quit
3360 CALL LINE(0,2)  '  Erase the cursor
3370 IF F$<>"LPT1:" AND F$<>"lpt1:" THEN GOTO 3390
3380    PRINT #2,ESC$;"Z";CHR$(128);CHR$(0);  '  Restore printer to normal
3390 CLOSE #2  '  Done outputting to file or device
3400 IF RIGHT$(F$,1)=":" THEN GOTO 3430  '  Not file - skip document change
3410    IF BASIC THEN TYPEAPPL$="MSBAMSBA" ELSE TYPEAPPL$="TEXTMACA"
3420    GOSUB 8000  '  Change file to MS BASIC or MacWrite document
3430 PRINT: PRINT "Receive Ended": PRINT
3440 GOTO 2000  '  Go back to terminal mode
3450 REM
4000 REM Transmit (upload) ASCII file
4010 REM
4020 CALL PENSIZE(2,1)  '  Upload cursor is vertical bar
4030 XFLAG=FALSE  '  No outstanding X-OFF
4040 PRINT: PRINT "Transmit File Name - "
4050 LINE INPUT "     (C=Clipboard, Return=abort): ",F$
4060 IF F$="" THEN GOTO 2000  '  No filename - go back to terminal mode
4070 IF F$="C" OR F$="c" THEN F$="CLIP:"  '  User wants to transmit clipboard
4080 ON ERROR GOTO 4580  '  So we can handle "File not found"
4090 OPEN F$ FOR INPUT AS #2  '  Open the file to be transmitted
4100 ON ERROR GOTO 0  '  Error trapping back to normal
4110 PRINT "If a prompt is specified, each line is transmitted only after the"
4120 PRINT "  prompt character is received from the remote or typed on the key-"
4130 PRINT "  board (if typed on the keyboard, it is not sent to the remote)."
4140 LINE INPUT "Prompt character (Return for none): ",PROMPT$
4150 PRINT "Use X-ON/X-OFF transmit handshaking during upload?";
4160 LINE INPUT " (Y/N, Return=N): ",C$
4170 IF C$="y" OR C$="Y" THEN OUTXENAB=1: GOSUB 7220
4180 REM
4190 CALL LINE(0,-6)  '  Draw the cursor
4200 QUIT=FALSE  '  Initialize termination flag
4210 GOFLAG=PROMPT$=""  '  Initialize for prompting
4220 WHILE NOT (EOF(2) OR QUIT)  '  Repeat until end of file or user says quit
4230    IF LOC(1)<>0 THEN GOTO 4340  '  Outstanding receive chars - skip send
4240    IF NOT GOFLAG THEN GOTO 4450  '  Wait for prompt
4250    LINE INPUT #2,XL$  '  Read next line of transmit file
4260    IF XL$="" THEN GOTO 4310
4270    PCNT=0  '  Get ready to count xmitted prompt chars
4280    FOR I=1 TO LEN(XL$): C$=MID$(XL$,I,1)  '  Next char to xmit
4290    IF C$=PROMPT$ THEN PCNT=PCNT+1  '  Count prompts to ignore
4300    PRINT #1,C$;: NEXT I
4310    PRINT #1,CR$;  '  Transmit end-of-line
4320    GOFLAG=PROMPT$=""  '  Get ready for next prompt
4330    IF LOC(1)=0 THEN GOTO 4450  '  No received characters to process
4340       IF NOT RCVXFLAG THEN GOTO 4360
4350          IF LOC(1)>BUFLIM AND NOT XFLAG THEN PRINT #1,XOFF$;: XFLAG=TRUE
4360       L$=INPUT$(LOC(1),#1)  '  Input all outstanding receive characters
4370       CALL TRANSLATE!(XTABLE!,LP!,TLP!)  '  Strip and translate
4380       IF TL=0 THEN GOTO 4440  '  Nothing left after translation
4390       IF GOFLAG THEN GOTO 4430
4400          I=0
4410          I=INSTR(I+1,LEFT$(L$,TL),PROMPT$):IF I=0 THEN GOTO 4430
4420          PCNT=PCNT-1: GOFLAG=PCNT<0:IF NOT GOFLAG THEN GOTO 4410
4430       CALL LINE(0,6): PRINT LEFT$(L$,TL);: CALL LINE(0,-6)
4440       IF XFLAG THEN XFLAG=FALSE: PRINT #1,XON$;  '  X-ON if needed
4450    C$=INKEY$  '  Anything from keyboard?
4460    IF C$="" THEN GOTO 4500  '  No
4470    IF C$=PROMPT$ THEN GOFLAG=TRUE: GOTO 4500
4480    IF C$=OPTT$ OR C$=SHOPTT$ THEN QUIT=TRUE: GOTO 4510  '  User says quit
4490    PRINT #1,C$;  '  Send keyboard character to remote
4500    IF LOC(1)<>0 THEN GOTO 4340  '  If any received chars, go process
4510    WEND  '  Otherwise, go try to transmit some more
4520 CALL LINE(0,6)  '  Erase the cursor
4530 CLOSE #2  '  Done with transmit file
4540 IF OUTXENAB<>0 THEN OUTXENAB=0: GOSUB 7220
4550 PRINT: PRINT "Transmit Ended": PRINT
4560 GOTO 2000  '  Go back to terminal mode
4570 REM
4580 PRINT: PRINT "Couldn't open file - returning to terminal mode.": PRINT
4590 RESUME 2000
4600 REM
5000 REM    Define constants
5010 REM
5020 BUFFERSIZE=4096  '  Buffer is used to hold received characters
5030 BUFLIM=BUFFERSIZE\4  '  How full to let buffer get before pausing remote
5040 REM
5050 FALSE=0: TRUE=-1  '  Logical values recognized in IF statements
5060 REM
5070 LF=10: LF$=CHR$(LF)          '  Standard ASCII control characters
5080 CR=13: CR$=CHR$(CR)
5090 XON=17: XON$=CHR$(XON)
5100 XOFF=19: XOFF$=CHR$(XOFF)
5110 ESC=27: ESC$=CHR$(ESC)
5120 REM
5130 OPTB$=CHR$(186): SHOPTB$=CHR$(245) ' Option-command characters, & shifted
5140 OPTR$=CHR$(168): SHOPTR$=CHR$(229)
5150 OPTT$=CHR$(160): SHOPTT$=CHR$(230)
5160 OPTX$=CHR$(197): SHOPTX$=CHR$(244)
5170 REM
5180 AIN=-6: AOUT=-7  '  Reference numbers for serial input and output ports
5190 SB1=&H4000: SB15=&H8000: SB2=&HC000'  Stop bit parameter values
5200 PARNONE=&H0: PARODD=&H1000: PAREVEN=&H3000'  Parity parameter values
5210 DB5=&H0: DB6=&H800: DB7=&H400: DB8=&HC00'  Bits-per-character param values
5220 REM
5230 RETURN
5240 REM
6000 REM  Pre-allocate all variables so arrays don't move
6010 REM  IMPORTANT THAT ALL VARIABLES BE REFERENCED BEFORE POINTERS SET
6020 REM
6030 DIM MLCODEARRAY(199)  '  Array to hold machine-language subroutines
6040 DIM XTABLEARRAY(127)  '  Array to hold receive translate table
6050 DIM BUFFERARRAY(BUFFERSIZE/2)  '  Buffer for received characters
6060 DIM PARAMLIST(39)  '  Parameter list for serial driver Control ROM calls
6070 I=0: MLLINE=0: MLCHK=0: MLL=0: MLS=0: ML$=""  '  Used in setting up M.L.
6080 TL=0  '  Length of translated receive string
6090 BR!=0: TC=0  '  Baud rate and time constant
6100 OUTXENAB=0  '  Output X-ON/X-OFF enable/disable
6110 L$="": LP!=0: C$="": XL$=""  '  Used for transmit and receive text
6120 F$="": FL=0: FP!=0  '  File name and pointer to it
6130 TYPEAPPL$=""  '  Type and parent application of received document
6140 BASIC=FALSE: XFLAG=FALSE: RCVXFLAG=FALSE  '  Logical variables (flags)
6150 CRFLAG=FALSE: FLUSH=FALSE
6160 GOFLAG=FALSE: PCNT=0: PROMPT$=""  '  Variables for prompted upload
6170 C=0  '  Miscellaneous character value
6180 QUIT=0  '  Upload/download termination flag
6190 REM
6200 MLCODE!=0  '  Pointer to machine-language array
6210 CONTROL!=0  '  Address of Control ROM call ML subroutine
6220 TRANSLATE!=0  '  Address of translate ML subroutine
6230 BPROC!=0  '  Address of BASIC receive processing ML subroutine
6240 GETFILEINFO!=0  '  Address of GetFileInfo ROM call ML subroutine
6250 SETFILEINFO!=0  '  Address of SetFileInfo ROM call ML subroutine
6260 XTABLE!=0  '  Pointer to translate table
6270 BUFFER!=0: BUFFERT!=0: BUFFERH=0: BUFFERL=0  '  Pointer to buffer, hi & lo
6280 PARAM!=0  '  Pointer to Control ROM call parameter list
6290 TLP!=0: CRFLAGP!=0: FLUSHP!=0  '  Pointers to vars for TRANSLATE & BPROC
6300 REM
6310 REM  Set up all pointers
6320 REM     NO NEW VARIABLES MAY BE USED AFTER THIS POINT IN TIME!!!
6330 MLCODE!=VARPTR(MLCODEARRAY(0))
6340 XTABLE!=VARPTR(XTABLEARRAY(0))
6350 BUFFER!=VARPTR(BUFFERARRAY(0))
6360 BUFFERH=INT(BUFFER!/65536!): BUFFERT!=BUFFER!-(BUFFERH*65536!)
6370 IF BUFFERT!<32768! THEN BUFFERL=BUFFERT! ELSE BUFFERL=BUFFERT!-65536!
6380 PARAM!=VARPTR(PARAMLIST(0))
6390 LP!=VARPTR(L$): FP!=VARPTR(F$)
6400 TLP!=VARPTR(TL)
6410 CRFLAGP!=VARPTR(CRFLAG)
6420 FLUSHP!=VARPTR(FLUSH)
6430 REM
6440 REM  Initialize the machine language subroutines
6450 RESTORE 9020  '  Restore to machine-language HEX data statements
6460 MLLINE=9020  '  First DATA statement line number
6470 READ ML$  '  Read next line of HEX data
6480 MLCHK=0  '  Initialize checksum
6490 FOR I=1 TO LEN(ML$)-1 STEP 2  '  Scan by bytes (pairs of hex digits)
6500 MLCHK=(MLCHK+VAL("&H"+MID$(ML$,I,2))) MOD &H100'  Compute checksum
6510 NEXT I
6520 IF MLCHK<>0 THEN CLS: PRINT CHR$(7);"Error in ML line ";MLLINE: STOP
6530 MLL=VAL("&H"+MID$(ML$,3,2)+MID$(ML$,1,2))  '  Get byte count of ML string
6540 MLS=VAL("&H"+MID$(ML$,7,2)+MID$(ML$,5,2))  '  Get start addr of ML string
6550 IF MLL=0 THEN GOTO 6620  '  Zero byte count ends ML data
6560 FOR I=0 TO MLL-1
6570 POKE MLCODE!+MLS+I,VAL("&H"+MID$(ML$,9+I*2,2))  '  Put ML data in array
6580 NEXT I
6590 MLLINE=MLLINE+10  '  Keep track of DATA line number, in case of error
6600 GOTO 6470
6610 REM  Set up CALL address pointers - offsets are at beginning of array
6620 CONTROL!=MLCODE!+MLCODEARRAY(0)
6630 TRANSLATE!=MLCODE!+MLCODEARRAY(1)
6640 BPROC!=MLCODE!+MLCODEARRAY(2)
6650 GETFILEINFO!=MLCODE!+MLCODEARRAY(3)
6660 SETFILEINFO!=MLCODE!+MLCODEARRAY(4)
6670 REM
6680 REM  Initialize the received character translation table
6690 REM    256-byte table contains translated value for
6700 REM        each possible received character value
6710 REM        - characters which translate to zero are ignored (stripped)
6720 REM
6730 FOR I=0 TO 255:POKE XTABLE!+I,0:NEXT I  '  Initialize to all zeroes
6740 FOR I=7 TO 13
6750 POKE XTABLE!+I,I: POKE XTABLE!+128+I,I  '  Put standard control chars in
6760 NEXT I
6770 POKE XTABLE!+10,0: POKE XTABLE!+128+10,0  '  Take linefeed out
6780 FOR I=32 TO 126
6790 POKE XTABLE!+I,I: POKE XTABLE!+128+I,I  '  Put printing characters in
6800 NEXT I
6810 REM
6820 RETURN
6830 REM
7000 REM  OPEN and set up the COM1 port
7010 REM
7020 OPEN "COM1:" AS #1 LEN=BUFFERSIZE
7030 WIDTH #1,255  '  We don't want BASIC inserting extraneous carriage returns
7040 REM
7050 TC=INT((115200!/BR!)+.5)-2  '  Set time constant
7060 IF BR!<1200 THEN WIDTH 81 ELSE WIDTH 255  '  At low speed, let BASIC wrap
7070 REM
7080 FOR I=0 TO 49\2: PARAMLIST(I)=0: NEXT I
7090 PARAMLIST(24\2)=AIN
7100 PARAMLIST(26\2)=8
7110 PARAMLIST(28\2)=SB1+PARNONE+DB8+TC  '  Stop bits, parity, char length
7120 CALL CONTROL!(PARAM!)  '  Set comm port parameters
7130 REM
7140 FOR I=0 TO 49\2: PARAMLIST(I)=0: NEXT I
7150 PARAMLIST(24\2)=AIN
7160 PARAMLIST(26\2)=9
7170 PARAMLIST(28\2)=BUFFERH
7180 PARAMLIST(30\2)=BUFFERL
7190 PARAMLIST(32\2)=BUFFERSIZE
7200 CALL CONTROL!(PARAM!)  '  Tell Mac to use our (huge) input buffer
7210 REM
7220 REM  Set comm handshake parameters
7230 REM
7240 FOR I=0 TO 49\2: PARAMLIST(I)=0: NEXT I
7250 PARAMLIST(24\2)=AIN
7260 PARAMLIST(26\2)=10
7270 POKE PARAM!+28,OUTXENAB  '  disable or enable XON/XOFF output handshake
7280 POKE PARAM!+29,0  '  disable CTS output handshake
7290 POKE PARAM!+30,XON  '  X-ON handshake character
7300 POKE PARAM!+31,XOFF  '  X-OFF handshake character
7310 POKE PARAM!+32,0  '  no aborts
7320 POKE PARAM!+33,0  '  no events
7330 POKE PARAM!+34,0  '  disable XON/XOFF input flow control (does not work)
7340 CALL CONTROL!(PARAM!)
7350 REM
7360 RETURN
7370 REM
8000 REM  Subroutine to set type and application of a file
8010 REM
8020 FL=LEN(F$)
8030 F$=CHR$(FL)+F$  '  Convert filename to Mac string format
8040 FOR I=0 TO 79: POKE PARAM!+I,0: NEXT I
8050 POKE PARAM!+19,PEEK(FP!+2)
8060 POKE PARAM!+20,PEEK(FP!+3)
8070 POKE PARAM!+21,PEEK(FP!+4)
8080 CALL GETFILEINFO!(PARAM!)  '  Get the file information
8090 FOR I=1 TO 8
8100 POKE PARAM!+31+I,ASC(MID$(TYPEAPPL$,I,1))  '  New type and application
8110 NEXT I
8120 CALL SETFILEINFO!(PARAM!)  '  And set the file information
8130 RETURN
8140 REM
9000 REM  HEX (Intel format) code for machine language subroutines
9010 REM
9020 DATA "1C000000000A0024007600FC01164E56FFF848EE0101FFF8206E0008A0044CEEEF"
9030 DATA "1C001C000101FFF84E5E4E754E56FFE848EE0707FFE8226E000C42811219E181BE"
9040 DATA "1C003800121942821419E1821419E182141920422248246E001042824A4167123A"
9050 DATA "1C0054004280101812B20000670452895282534166F0206E000830824CEE07074E"
9060 DATA "1C007000FFE84E5E4E754E56FFE048EE1F07FFE0206E0014548842801018E18097"
9070 DATA "1C008C001018E180101820402248246E0010266E000C286E0008321242824A416A"
9080 DATA "1C00A800674610180C00000D661A4A546708425436BC0001602E4A53662A36BC8B"
9090 DATA "1C00C400000112C0524260204A54661C4A5367120C0000306D060C0000396F069A"
9100 DATA "1C00E00038BC00016006425312C05242534166BA34824CEE1F07FFE04E5E4E7596"
9110 DATA "1C00FC004E56FFF848EE0101FFF8206E0008A00C4CEE0101FFF84E5E4E754E5696"
9120 DATA "18001801FFF848EE0101FFF8206E0008A00D4CEE0101FFF84E5E4E75C4"
9130 DATA "000000000000"
9140 REM
9500 REM   Modem connections:
9510 REM     Mac   Modem
9520 REM      1      1     (Frame Ground)
9530 REM      3,8    7     (Signal Ground)
9540 REM      5      2     (Transmit Data)
9550 REM      6      20    (+12V -> DTR)  [Optional]
9560 REM      7      8     (CTS <- DCD)   [Optional]
9570 REM      9      3     (Receive Data)
9580 END



-----------------------
 

10 REM MacTEP Runner - program whose sole purpose is to clear
20 REM                 enough memory for MacTEP, then run it.
30 REM
40 CLEAR ,25000: RUN "MacTEP"
50 END


-----------------------