home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
c
/
coco.jar
< prev
next >
Wrap
Text File
|
2020-01-01
|
76KB
|
2,741 lines
This is a text archive of the files for Tandy Color Computer (CoCo) Kermit.
Each file is preceded by a line <<< name >>>, where "name" is the name of
the file. The files begin on the next line.
<<< ccexbin.bas >>>
110 ' EXBIN - CONVERT S-RECORD FORMAT TO BINARY
120 '
130 PCLEAR 1
140 CLEAR 200,&H1FFF
150 DIM V(50)
160 AL=64*1024 ' LOWEST ADDRESS
170 AU=0 ' HIGHEST ADDRESS
180 AX=0 ' EXEC ADDRESS
190 AM=&H2000 ' MIN ALLOWED
200 SF=1
210 CLS
220 PRINT"EXBIN"
230 PRINT"CONVERT S-RECORD FILE TO BINARY"
240 '
250 INPUT"S-FILE";NM$
260 OPEN"I",SF,NM$
270 '
280 NREC=0
290 '
300 ' MAIN LOOP - READ RECORD AND CONVERT IT
310 INPUT#SF,DL$: NREC=NREC+1
320 IF LEFT$(DL$,1)="S" THEN 380
330 PRINT "FILE IS NOT IN S-RECORD FORMAT."
340 PRINT "LINE";NREC
350 PRINT DL$
360 STOP
370 ' RECORD TYPE (0,1 OR 9)
380 TYPE=VAL(MID$(DL$,2,1))
390 ' RECORD LENGTH
400 LN=VAL("&H"+MID$(DL$,3,2))
410 ' ADDRESS FIELD
420 ADR=VAL("&H"+MID$(DL$,5,4))
430 ' COMPUTE CHECKSUM
440 CK=LN+INT(ADR/256)+ADR-256*INT(ADR/256)
450 ' DATA BYTES
460 IF LN<=3 THEN 510
470 FOR I=1 TO LN-3
480 V(I)=VAL("&H"+MID$(DL$,7+2*I,2))
490 CK=CK+V(I)
500 NEXT I
510 CK=255-(CK-256*INT(CK/256))
520 CS=VAL("&H"+RIGHT$(DL$,2))
530 IF CK=CS THEN 580
540 PRINT"CHECKSUM ERROR AT LINE";NREC
550 PRINT DL$
560 PRINT "COMPUTED ";HEX$(CK);" FOUND ";HEX$(CS)
570 STOP
580 IF TYPE=9 THEN TYPE=2
590 IF TYPE<0 OR TYPE>2 THEN PRINT"UNKNOWN RECORD TYPE ";TYPE:PRINT DL$:STOP
600 ON TYPE+1 GOSUB 640,720,840
610 IF TYPE<2 THEN GOTO 310
620 END
630 '
640 ' FILE NAME RECORD
650 BN$=""
660 FOR I=1 TO LN-3
670 BN$=BN$+CHR$(V(I))
680 NEXT I
690 PRINT"OUTPUT FILE = ";BN$
700 RETURN
710 '
720 ' DATA RECORD
730 IF ADR>=AM THEN 770
740 PRINT"ADDRESS ";HEX$(ADR);" LESS THAN ";HEX$(AM)
750 PRINT"AT LINE ";NREC
760 STOP
770 FOR I=0 TO LN-4
780 POKE ADR+I,V(I+1)
790 NEXT I
800 IF ADR<AL THEN AL=ADR
810 IF ADR+LN-4>AU THEN AU=ADR+LN-4
820 RETURN
830 '
840 ' EXECUTION ENTRY RECORD
850 AX=ADR
860 PRINT"BINARY FILE = ";BN$
870 PRINT"LOW ADDRESS = &H";HEX$(AL)
880 PRINT"HIGH ADDRESS = &H";HEX$(AU)
890 PRINT"EXEC ADDRESS = &H";HEX$(AX)
900 SAVEM BN$,AL,AU,AX
910 RETURN
<<< cckermit.bwr >>>
26-Jul-86 20:09:12-EDT,1243;000000000001
Return-Path: <blarson@usc-oberon>
Received: from usc-oberon.ARPA by CU20B.COLUMBIA.EDU with TCP; Sat 26 Jul 86 20:09:07-EDT
Received: by usc-oberon.ARPA (4.12/5.5) id AA15164;
Sat, 26 Jul 86 17:10:10 pdt
Date: Sat, 26 Jul 86 17:10:10 pdt
From: Bob Larson <blarson@usc-oberon>
Message-Id: <8607270010.AA15164@usc-oberon.ARPA>
To: info-kermit@cu20b.columbia.edu
Subject: Re: CoCo Kermit
Newsgroups: net.micro.6809
In-Reply-To: <273@vaxb.calgary.UUCP>
Organization: U of Southern CA, Computer Services, Los Angeles
This should probablby go the the beware file for coco kermit:
In article <273@vaxb.calgary.UUCP> ingoldsby@calgary.UUCP writes:
>I previously reported having some problems with getting V1.1 of CoCo
>Kermit by Wes Hubert to work with our VAX UNIX Kermit. I found that
>for some reason, someone had set the default number of pad chars on
>the Coco Kermit to 1. The Vax didn't seem to care for this value and
>when the Coco Kermit # of pad chars was set to 0, everything worked
>fine.
>
>Terry Ingoldsby
>...ihnp4!alberta!calgary!ingoldsby
--
I'm having a brainstorm and I forgot my umbrella. (xg)
Bob Larson
Arpa: Blarson@Usc-Ecl.Arpa
Uucp: ihnp4!sdcrdcf!usc-oberon!blarson
<<< cckermit.doc >>>
1.0. TRS-80* Color Computer Kermit
Version 1.1, March 1985
Kermit-CoCo is a program that implements the KERMIT file transfer
protocol for the TRS-80 Color Computer. The minimum system re-
quirements are a Color Computer with 16K memory, one disk drive,
and a 300 baud (Bell 103/113 compatible) modem. Kermit-CoCo runs
under the Radio Shack disk operating system and uses the built-in
RS-232 port. It therefore does not require OS-9, the "deluxe"
RS-232 pack, or any other hardware or software add-ons. It uses
the disk ROM for file I/O and is compatible with both versions
1.0 and 1.1 of the Radio Shack ROM.
Kermit-CoCo lets your Color Computer communicate with other
systems in three ways. First, it is a terminal program. Your
computer can function as a terminal connected to a remote com-
puter. Second, it permits uploading (sending) and downloading
(receiving) text files to and from a remote computer. Third, it
provides KERMIT protocol file transfers of both text and binary
files to and from a remote computer running KERMIT.
KERMIT is a protocol designed for reliable file transfer. It was
developed at the Columbia University Center for Computing Ac-
tivities in 1981-82 where Bill Catchings and Frank da Cruz
designed the protocol and implemented it for DEC-20 and CP/M com-
puters. The two computers exchange information in small packets.
The sending computer transmits a packet, then waits for an
acknowledgement before sending another. Each packet includes in-
formation used to validate the packet contents. If a packet is
received incorrectly, the receiving system requests retransmis-
sion of the packet.
In addition to reliability, an advantage of Kermit over raw data
transfer is that it permits transfer of binary files. This means
Kermit can transfer Color Computer machine language programs,
even over 7-bit connections.
Kermit-CoCo implements only basic functions of the Kermit
protocol. It does not provide time out, multiple file transfers,
or server mode communication and the user interface is not as
sophisticated as in many versions. It is, however, sufficient
for simple, reliable file transfers.
____________
TRS-80 is a trademark of Tandy Corp., Fort Worth, Texas
Kermit-CoCo - 1 - 03/85
1.1. Running Kermit-CoCo
Kermit-CoCo consists of two files. CCKERMIT.BAS contains a short
BASIC program to configure memory, load, and execute the machine
code file. CCKERMIT.BIN contains the actual Kermit machine code.
If you have obtained Kermit-CoCo in some way other than on a
diskette, see section 1.6, Bootstrapping Kermit-CoCo.
Make sure your modem is connected, place the Kermit-CoCo disk in
your machine, and type:
RUN"CCKERMIT"
This runs the BASIC driver program, which loads and executes the
machine language code.
You can exit from Kermit-CoCo, execute other commands, then
return to Kermit-CoCo with an EXEC command.
Kermit-CoCo initially displays the following summary of command
codes and parameter settings.
KERMIT-COCO 1.1
(PREFIX CONTROL OR COMMANDS
WITH DOWN-ARROW)
0 EXIT, ? PRINT MENU
1 LOCAL ECHO (N)
2 PARITY (E)
3 AUTO LF (N)
4 JOURNALIZE (N)
5 WRITE BUFFER TO FILE
6 READ FILE INTO BUFFER
7 UPLOAD BUFFER
8 ERASE BUFFER
9 DEF CHAR/LINE DELETE (08,18)
KERMIT: = SET, < RECEIVE, > SEND
()!-# BRACES BAR TILDE DEL
The current settings are shown in parentheses, where Y=yes, N=no,
and E=even. The character and line delete codes are shown as
hexadecimal values. If the default settings are correct for the
system you are calling, continue with your normal sign-on
procedure. First, however, the are a few things you need to
know.
1.2. Multi-key Sequences
The Color Computer keyboard has only 53 keys. It lacks some of
the keys found on terminals; the most important of these is the
CONTROL key. Since CONTROL is normally located to the left of
the letter A, Kermit-CoCo uses the key in this position, the
DOWN-ARROW, to indicate control codes.
03/85 - 2 - Kermit-CoCo
Several other keys not shown on the keyboard are documented in
the BASIC manual that came with your computer. These include
using SHIFT-0 as a caps lock, SHIFT-DOWN-ARROW for [, SHIFT-
RIGHT-ARROW for ], SHIFT-CLEAR for \, and SHIFT-UP-ARROW for un-
derscore (underscore prints as a LEFT-ARROW).
1.2.1. ASCII Control Characters
Unlike terminals, on which you press some other key while holding
down the control key, in Kermit-CoCo you press the DOWN-ARROW
first, release it, then press the key you want it to modify. For
example, DOWN-ARROW followed by A generates the hexadecimal value
01 which is the ASCII code for control-A. Throughout the
remainder of this document, control sequences are printed as
"CTL-character"; for example, CTL-A for DOWN-ARROW followed by A.
ASCII control codes (hexadecimal 00 through 1F) are generated by
the standard combinations: CTL-@ for 00, CTL-A for 01, CTL-B for
02, ... CTL-Z for 1A, CTL-[ for 1B, CTL-\ for 1C, CTL-] for 1D,
CTL-^ for 1E, and CTL-_ (SHIFT-UP-ARROW) for 1F.
1.2.2. Other Special Characters
A second use of the DOWN-ARROW prefix is to generate other ASCII
characters not on the keyboard. These are:
` CTL ' (Prints as inverse @)
{ CTL ( (Prints as inverse [)
| CTL ! (Prints as inverse \)
} CTL ) (Prints as inverse ])
Tilde CTL - (Prints as inverse ^)
Rubout CTL # (Prints as
inverse LEFT-ARROW)
To help you remember these, they are shown at the bottom of the
menu display.
Some terminals have a special key for the ASCII escape code. It
simply generates CTL-[ with a single key.
Another key on many terminals is LINE-FEED. Use either CTL-DOWN-
ARROW or CTL-J to generate the ASCII line feed character. On the
Kermit-CoCo screen, LINE-FEED moves the cursor to the beginning
of the next line.
The BREAK key generates a break by sending a long (about 1/4
second) series of 0 bits.
When CTL-G (bell) is received or typed on the keyboard it
generates a tone through the speaker on your monitor.
The LEFT-ARROW key backspaces the cursor and transmits a user
selectable character deletion code. SHIFT-LEFT-ARROW transmits a
user selectable line deletion code.
Kermit-CoCo - 3 - 03/85
The CLEAR key clears the screen and moves the cursor to the upper
left corner. It does not transmit any character.
1.2.3. Kermit-CoCo Commands
A final use of the DOWN-ARROW key is for Kermit-CoCo commands.
These include modifying parameter settings and beginning special
actions such as KERMIT file transfers.
CTL-? displays the main menu with current parameter settings
shown in parentheses.
CTL-0 terminates Kermit-CoCo and returns control to BASIC. You
can restart Kermit-CoCo by entering EXEC.
Modify control parameters by pressing the DOWN-ARROW key, then
the number of the option you want to change. For example, if
local echo is on (Yes), pressing CTL-1 changes it to off (No).
Pressing CTL-1 again turns local echo back on.
CTL-2 toggles the parity setting between even and none. Kermit-
CoCo cannot communicate with systems that require other parity
settings. Although Kermit-CoCo can generate even parity output
it always ignores the parity bit of incoming data. The bit is
not used for either parity checking or 8-bit data values.
CTL-3 toggles local line-feed generation. When it is set to Yes,
Kermit-CoCo adds a line-feed to the display after each carriage
return. It does not transmit the added line-feed.
After modifying parameters, you can verify the new settings by
pressing CTL-? to display the menu with the new values.
Setting character and line delete codes is similar, but requires
a series of keystrokes. These codes, displayed as hexadecimal
values on the menu, are transmitted by the LEFT-ARROW and SHIFT-
LEFT-ARROW keys. To change the settings, press CTL-9, then the
keys for the values to transmit. For example,
CTL-9 @ CTL-X
sets the character delete symbol to "@" (hexadecimal 40), and the
line delete symbol to control-X (hexadecimal 18).
You are now ready to use Kermit-CoCo as a terminal. The fol-
lowing sections describe file transfer.
1.3. KERMIT File Transfers
Kermit file transfers require a copy of Kermit on the remote com-
puter as well as Kermit-CoCo on your system. The remote can
range from another Color Computer to a large mainframe.
03/85 - 4 - Kermit-CoCo
Before beginning a transfer, configure any necessary parameters
using the CTL-= command described below. The default settings of
EOL, SOH, etc. are appropriate for Kermit-CoCo and many other
systems, but check documentation for the remote Kermit in case it
requires other values. These must be correct or no communication
can take place.
1.3.1. KERMIT Parameter Settings
Typing DOWN-ARROW followed by an equal sign displays the current
KERMIT parameter settings and leaves the cursor under the first.
Pressing ENTER leaves all settings unchanged and returns to ter-
minal mode. Any other key indicates a new value for the
parameter above the cursor. To leave a parameter unchanged,
press the space bar. Pressing any other key changes the
parameter to the ASCII value of that key. The cursor then moves
to the next parameter until you have responded for each one.
Kermit-CoCo then returns to normal terminal mode. Note that for
any parameter except the first, ENTER is taken as a parameter
setting.
Parameters that can be set are:
TYPE COCO File Type: 0=BASIC, 1=TEXT, 2=Machine Code
MODE COCO File Mode: 0=Binary, FF=ASCII
EOL End-of-line required by the remote system when
receiving Kermit packets.
NTRY Maximum number for transmission attempts for
each packet.
SOH Start of packet character required by the remote
Kermit.
DBUG Debug flag: 0=Off, anything else=On
When the debug flag is on, each packet sent is
displayed on lines 9-11 of the screen and each
packet received is displayed on lines 13-15.
For example, to change the number of retransmission attempts,
press CTL-=. Kermit-CoCo displays:
TYPE MODE EOL NTRY SOH DBUG
00 FF 0D 05 01 00
Press the space bar three times to leave TYPE, MODE, and EOL un-
changed, then type DOWN-ARROW and J to change the retry setting
to 10 (10 is the decimal value of control-J). Press the space
bar two more times to leave SOH and DBUG unchanged. The display
now shows:
TYPE MODE EOL NTRY SOH DBUG
00 FF 0D 05 01 00
00 FF 0D 0A 01 00
The second line of settings appeared as options were changed.
Kermit-CoCo is now back in terminal mode.
Kermit-CoCo - 5 - 03/85
To prepare to receive a machine code file, set TYPE to 2 (CTL-B)
and MODE to 0 (CTL-@). Type and mode are automatically set when
sending a file. They must be manually set for receiving. One
reason that the distinction between binary and ASCII files is im-
portant is that the Color Computer indicates end-of-line with a
carriage return. When transmitting ASCII files, Kermit-CoCo adds
a line-feed after each one. When receiving ASCII files, Kermit-
CoCo replaces each carriage return followed by a line-feed with a
single return. It does not insert or delete line feeds when
processing binary files. Also, the operating system requires
certain file types for certain types of processing. LOADM, for
example, requires that a file be declared as machine code binary.
Setting the type and mode parameters permits Kermit-CoCo to
create the proper type of file.
In addition to the space bar for leaving values unchanged, and
ASCII codes for setting other values, the BREAK key can be used
to set a parameter to hexadecimal FF.
Several Kermit parameter settings are defined internally, with no
provision for change. These include # for control quoting, & for
8th-bit (binary) quoting, and hexadecimal 0D (carriage return)
for end of incoming packet.
1.3.2. Sending A File With KERMIT
Before transmitting a file, the remote KERMIT must be ready to
receive it. This is done through a RECEIVE command to the remote
KERMIT. Press CTL-> on your keyboard. Kermit-CoCo requests the
name of the file to transmit. Enter the name, and Kermit-CoCo
begins sending. As each packet is sent, the packet number is
shown as a hexadecimal value. If debug mode is active, the
packets are also displayed on the screen. When the transfer is
complete, the message TRANSFER COMPLETE appears on the screen and
the ""bell" beeps. If the transmission fails, the message
TRANSFER FAILED appears. In either case, Kermit-CoCo returns to
terminal mode.
If a "deadlock" occurs-- both KERMITs waiting for a message from
the other, the packet number will stop changing. To break the
deadlock and resume transmission, press the ENTER key. Before
doing this, wait long enough to make sure that a deadlock really
does exist.
1.3.3. Receiving A File With KERMIT
Before attempting to receive a file, make sure that the file mode
and type parameters are set correctly. Issue a SEND command for
the remote Kermit, then press CTL-<. Kermit-CoCo will request a
name for the incoming file. Unlike most KERMITs, Kermit-CoCo ig-
nores the name in the incoming transmission, and writes the data
to the file you specify.
03/85 - 6 - Kermit-CoCo
The display while receiving is similar to that during transmis-
sion. A hexadecimal packet number display keeps you posted on
the status of the transmission. If a deadlock occurs, you can
break it by pressing ENTER. Kermit-CoCo will signal either
TRANSFER COMPLETE or TRANSFER FAILED at the end of the transfer,
and return to terminal mode.
Some remote Kermits can transmit multiple files. Do not use this
capability with Kermit-CoCo. It can receive only one file at a
time.
1.4. Journalizing A Session
Kermit-CoCo can use all memory above the high end of the program
(&H2FFF) as a buffer to keep a copy of all characters sent or
received. This facility is used primarily for raw ASCII file
transfers, but can also be used to journalize (keep a copy of)
your terminal session.
CTL-4 turns on session logging when it is off, turns it off when
it is on.
CTL-5 prompts for a file name and saves the buffer onto the file.
CTL-8 erases the buffer by resetting the buffer pointer to the
beginning of the buffer.
Note that the buffer cannot be used for both raw file transfer
and session logging at the same time.
1.5. Raw ASCII File Transfer
Kermit transfers are more reliable than raw data transfers. They
also permit transfer of binary (8-bit) data. However, since such
transfers require Kermit on both the sending and receiving
systems, Kermit-CoCo also provides raw ASCII file transfer.
1.5.1. Downloading Files
CTL-R (Hex 12) places the system in download mode. Actually, it
turns on the session logging buffer regardless of its current
state. It can be entered at the keyboard or transmitted from the
host system. Characters received following it are placed into
the buffer. This mode ends when CTL-T is received or entered at
the keyboard or when the buffer is filled.
On a 16K system the buffer holds 4K bytes. On larger systems it
hold 20K bytes.
The pointer to the current buffer position can be reset by en-
tering CTL-8 from the keyboard. This is a local signal only. It
is not transmitted. If multiple downloads are done without
reseting the buffer pointer, they will be stored one after
another in the buffer.
Kermit-CoCo - 7 - 03/85
1.5.2. Uploading Files
Entering CTL-7 from the keyboard begins transmission of the
buffer. As the upload takes place, the text is displayed on the
screen. To prevent overprinting, you should turn on local line
feed (CTL-3), then turn it off after the transfer is complete.
While uploading, all keys except BREAK are ignored. The BREAK
key can be used to stop the upload process. The upload ends
automatically when the portion of the buffer currently in use has
been transmitted.
Before the buffer is transmitted, the remote computer must be
prepared to receive its contents. To do this, enter the neces-
sary commands (these depend on the remote system) using terminal
mode before starting the upload.
1.5.3. Reading and Writing the Buffer
CTL-5 writes the contents of the buffer to a disk file. CTL-6
reads a file into the buffer. For either function Kermit-CoCo
will prompt for a file name.
1.6. Bootstrapping Kermit-CoCo
The easiest way to get Kermit-CoCo is on a diskette. However,
Kermit is also distributed in other ways which permit ASCII-only
transfer. To support such transfer mechanisms, Kermit-CoCo is
available in Motorola S-record format, along with a program to
convert S-records to a binary file. It is also available in
ASCII source format for input to the EDTASM+ assembler.
1.6.1. Using the S-record File
To convert the S-record code to binary, you need to transfer
files "CCEXBIN.BAS" and "CCKERMIT.S" to your diskette. Running
"CCEXBIN" generates file "CCKERMIT.BIN", the executable version
of Kermit-CoCo. Each S-record contains checksum information. If
you did not receive the S-record file properly, CCEXBIN will
stop with an error message. Transfer a new copy of CCKERM.S
and try again.
After you have CCKERMIT.BIN, create CCKERMIT.BAS with the fol-
lowing program:
10 PCLEAR 1: CLEAR 200,&H1FFF
20 LOADM"CCKERMIT": EXEC
You are now ready to run Kermit-CoCo.
03/85 - 8 - Kermit-CoCo
1.6.2. Assembling the Kermit-CoCo Source
The source for Kermit-CoCo is in two parts. The first,
COCOTERM.ASM, contains all of the terminal functions and raw
ASCII file upload and download. The second, COCOPROT.ASM, con-
tains the Kermit protocol source.
The source files were prepared and assembled using the Radio
Shack EDTASM+ ROM pack assembler, modified for disk I/O. It
should be usable as is with the standard disk-based version of
EDTASM+. For other assemblers minor changes may be necessary.
Comments at the beginning of each file describe assembly and
loading.
No linker program is necessary to combine the two modules. As-
semble the files to COCOTERM.BIN and COCOPROT.BIN, respectively.
Load COCOTERM.BIN then load COCOPROT.BIN and SAVEM the code from
address &H2000 through the end of COCOPROT.BIN. This is &H2EFE
as distributed, but may vary with different versions of the as-
sembler and with user modifications.
Create CCKERMIT.BAS as described above.
ORG pseudo-ops enable the separately assembled modules to com-
municate; however, these require some care when modifying the
code. Note that COCOPROT code begins loading at &H2800.
Modifications to COCOTERM must not make the address of ZZTOP go
beyond &H27FF. Such modifications would require changing the ORG
statement ahead of KERMR in COCOTERM and the ORG statement at the
beginning of COCOPROT. Increasing the size of COCOPROT so that
address ZZZTOP is greater than &H2FFF would required changing the
EQU statement for TOP in COCOTERM to place the origin of the raw
data buffer beyond the end of the Kermit packet buffers.
Kermit-CoCo - 9 - 03/85
<<< cckermit.s >>>
S00F000043434B45524D49542E42494E97
S1232000204220D7210E214224562634266C271320B725CC4B45524D49542D434F434F202C
S123202000434F50595249474854202843292031393835180800FF0030007FFF300000013A
S1232040A312146010EF8D0749328D07AB1704FB170206308D0FA9AF8CDE9E74AF8CDB8D8E
S12320603F17007327051703ED8D351700D427F181FF26048D3120E781FE260F6D8CB627A2
S12320800586081703D0A68CAB201181FD2605A68CA120086D8C9E27031703BA8D7020BF9C
S12320A0B6FF224424FA397FFF208E6100301F26FC8602B7FF20393406EC8C838300012636
S12320C0FB358634108E00075F4624015C301F26F8465646351039B6FF224424024F39ECC5
S12320E08DFF5C44568300012EFBC6073406EC8DFF4D83000126FB12F6FF225466606A612E
S123210026EC66603506847F817F26014F396D8DFF2427028DADC60834067FFF20EC8DFF58
S12321201E83000126FB64605959F7FF206A6126EC326217FF81C602F7FF2017FF7917FFC1
S123214076393404E69F00882B04E78DFEF5C6FFE79F00883504AD9FA000260139810326EF
S12321600386FF398108260386FE398115260386FD39810C260934341703D035344F398130
S12321800A270139AD9FA00027FA81402505841FC60139813F26041700BF398130250481E1
S12321A03E2F283414308D0015E680A18527065A2AF9351439308D000CA685351439052712
S12321C02821292D23607B7C7D7E7F81302608351010EE8D05BC3981312606638DFE564F4E
S12321E03981322606638DFE4D4F3981332606638DFE444F3981342606638DFE414F39814D
S12322003526051704D44F39813626051704954F39813726051703004F398138260AEC8DE2
S1232220FE16ED8DFE164F398139261417FF1327FBA78DFDFF17FF0A27FBA78DFDF54F3911
S1232240813C2604BD280039813E2604BD280239813D2604BD2804393934361702ED308DFC
S12322600062A68DFDCF4CA686A78D00CB3002A68DFDC34CA686A78D00D13002A68DFDB7C7
S12322804CA686A78D00D73002A68DFDB14CA686A78D00DDA68DFD9C1704D6ED8D0145A6F8
S12322A08DFD901704CBED8D013D308D001EEC81C30400DD88A68027F52B051702A420F5AA
S12322C035364F39594E454E594E594E00084B45524D49542D434F434F20312E3100002288
S12322E02850524546495820434F4E54524F4C204F5220434F4D4D414E44530000422057B7
S123230049544820444F574E2D4152524F57290000623020455849542C20203F20505249F9
S12323204E54204D454E5500008231204C4F43414C204543484F20283F290000A232205031
S123234041524954592020202020283F290000C233204155544F204C4620202020283F29B0
S12323600000E234204A4F55524E414C495A4520283F2900010235205752495445204255D6
S12323804646455220544F2046494C450001223620524541442046494C4520494E544F20C4
S12323A0425546464552000142372055504C4F414420425546464552000162382045524193
S12323C0534520425546464552000182392044454620434841522F4C494E452044454C450D
S12323E05445202858582C5858290001A04B45524D49543A203D205345542C203C205245F4
S123240043454956452C203E2053454E440001C22829212D2320425241434553204241522E
S12324202054494C44452044454C0DFFB6FF0184F7B7FF01B6FF0384F7B7FF03B6FF238ACF
S123244008B7FF23CC06F2F7FF208300081083000226F4860739A18DFBE7260A86FFA78DC4
S1232460FBDC17FC5239A18DFBD826066F8DFBCE20F0810726048DB4205C810C26071700A1
S1232480CA860C205181082606C660E79F0088810D261F6D8DFBA0263AE68DFBA6E79F0020
S12324A088C660E78DFB9CD689C4E0D78917FC072024810A261DE68DFB89E79F0088C660A5
S12324C0E78DFB7F860DD689CA1FD789170093860A200317008C6D8DFB64260139AE8DFBE0
S12324E05BAC8DFB552B076F8DFB538D0839A780AF8DFB48393402308D000FA68027051760
S1232500FF5420F717FBA0350239076275666665722066756C6C0A0010AE8DFB1B10AC8D23
S1232520FB1A2720A6A417FBE517FC16270481FF2712A6A017FF1F810D26E28E8000301F7F
S123254026FC20D9C6FFE79F008839CC0400DD888E0480108E0580CC6000A785A7A55C26C0
S1232560F93934165F9E888108260B8C040027538660A7822027810D260E9E888660A78047
S12325801F10C51F26F62015812025374D2B0C814025068160250484DF8840A7809F885F84
S12325A08C05FF231E8E0400EC8820EE8822ED81EF818C05E025F19F88CC6060ED818C0670
S12325C00025F9C160270317FAED359634709EA6F6018EFE018F3454C67E338D0028F7011E
S12325E08EFF018F10EF8D002F308D00219FA6A6841CFEBDADC686013554F7018EFF018F43
S12326009FA635704D3910EE8D000D4F20EA58B331AEFF8C2831290000003402B6C0058429
S1232620014833C635026ED4C8A4C952C468C48DCA3BCAE91700E97D2014272F8E094C86AF
S123264020A7808C095725F9C6FF308DF9C65CA68526FB338D000A34406FE2CE26287E26ED
S12326601A8649C601CE262CBD261A391700B17D2014272F8E094C8620A7808C095725F9C7
S1232680C6FF308DF98E5CA68526FB338D000A34406FE2CE26287E261A864FC601CE262C60
S12326A0BD261A3917FF8D7D2014272D8601976F17FF19261CBDA176AE8DF980AC8DF97A06
S12326C02A08A780AF8DF97420E617FE286F8DF96DCE263017FF430F6F39CC00FFFD0957F3
S12326E017FF897D094C272A8601976F10AE8DF94710AC8DF9462708A6A0AD9FA00220F100
S1232700810D2706860DAD9FA002CE263017FF0A0F6F398601976FCE263017FEFD0F6F3904
S1232720308D003EA680270517FE3720F7308DF8E35F17FA0D27FB810D272181FE26115DC5
S123274027F08660A79F0088860817FE155A20E2C10C27DEA78517FE095C20D617FE036FA1
S1232760853946494C454E414D452E4558543F200034025F48594859485948593502840FF5
S1232780C3303081392F028B07C1392F02CB071E8939FF00FF02FD00FF00FF00FF00FF00BF
S12327A0FF02FF00FF00FD00FF00FF00FF00FF00FF02FF02FF00FF00FF02FF00FD02FF001F
S12327C0FF00FF00FF00FF00FF00FF00FF00FF02FF00FF00FF00FF00FF00FF00FF00FF0003
S12327E0FF00FF00FF00FF00FF00FF00FD00FF00FF00FF00FF00FF000000FF00FF00FF00E6
S12328002004200520061605BE1604741603F94B45524D49542D434F434F20312E31002CD3
S123282020537E2F21402D23263120410D5E0000232600FF0D050100002146FF00FF00FFE1
S123284000FF00FF00FF00FF00FF00FF00FF008601976FAD9F20122607BDA1760F6F5F3959
S12328600F6FC601393414C601D76FAD9FA00235140F6F393402AD9F2010B6FF224424FAA8
S1232880350239A6802706AD9F200820F6393406C6203D6FE4E3E1C30400DD883934025F40
S12328A048594859485948593502840FC3303081392F028B07C1392F02CB071E89398DDDDF
S12328C03404AD9F20083502AD9F200839CC0400DD888E0480108E0580CC6000A785A7A556
S12328E05C26F939DC883416CC030817FFA0A68DFF568DCAA68DFF518DC43516DD88391039
S12329009E88342017FF87A6808020847F3402A680AD9F20086AE426F68620AD9F2008D6A9
S1232920895CC47F26F535023506DD8839A68DFF04A78DFF15EC8DFF0FC30001ED8DFF08F6
S1232940395FA68480202712EB804A26FB1F98595959C4033404ABE0843F8B2039308D054D
S1232960FF6F8DFECCE684C023273CA6038020A78DFEBA5A27315A272EA6058020A78DFECB
S1232980AD5A2723A6068840A78DFEA35A27185A2715A608A78DFE985A270CA609815926B6
S12329A0028626A78DFE8A393410E684C0203AE68DFE7EE18DFE712704847F200D4D2A0A00
S12329C0E68DFE64E780847F201C810D26186D8DFE612712E68DFE4FE7808840A780E7809D
S12329E0860A8840202AA18DFE3D260488402018A18DFE34260AA18DFE3726048840200891
S1232A0081202B04817F2608E68DFE1BE7808840A7801F10A3E43510CB20E784C01CE18D37
S1232A20FE0B2B03C601395F39341017FF13A7846D8DFE032708CC0800AEE417FEC1E68D52
S1232A40FDEC34046AE42B0AA68DFDE3AD9F200420F2350417FE8DA68DFDDBAD9F2004AE35
S1232A60E4E684C0203404A680AD9F20046AE42AF63504A68DFDBDAD9F2004351039308D17
S1232A80047CA7028623A784E68DFDBDC43FCB20E70117FEACA7848E8000301F26FC308D0A
S1232AA0045C8D8539308D04B73410AD9F20062704810D2748AD9F200227F017FDB6A18D94
S1232AC0FD7426E7AEE4AD9F20062704810D272DAD9F200227F017FD9BA18DFD5927E5A7F8
S1232AE080A18DFD4726DF6D8DFD4C2708AEE4CC0C0017FE0A351017FE47A1843935108616
S1232B000139A68DFD2FA78DFD406D8DFD402714865917FF69EC8DFD2FC30001ED8DFD28CF
S1232B206F8DFD2A6A8DFD222B5D308D043217FF742707864E17FF4620EA308D0422EC8D8F
S1232B40FD06262117FE16308DFCD48659A70217FDEFA784308DFCC717FECECC0001ED8D0F
S1232B60FCE6865339C43FCB20E1012707864E17FF0C20B06A8DFCD6308D03E4E684C023DF
S1232B803003A61F8144398651395D260517FF7226045AA680395F396F8DFCB06F8DFCAD53
S1232BA05F17FFE62761A18DFC8726096C8DFC9D17FFD72752A18DFC77262F17FFCC274710
S1232BC0A18DFC6D2724A18DFC66271E88406D8DFC7B26166D8DFC5B27106D8DFC6E270AA8
S1232BE0810A26066F8DFC6420176D8DFC5F27028B806F8DFC56810D26046C8DFC4E17FCA2
S1232C00646F8DFC48209A3917FCC2308DFC0017FC71308D021617FC6A308DFC1586063427
S1232C20028620AD9F2008AD9F2008AD9F2008A68017FC8A6AE426E93502860AAD9F200831
S1232C40C6063404308DFBEA8620AD9F2008AD9F2008AD9F2008AD9F200627FAE6E4C106A4
S1232C602604810D271181202704A7802002A68017FC4B6AE426D13504860AAD9F2008390C
S1232C8017FC4A308DFB8817FBF9308D021517FBF2AD9F200A7D2014260139FC0957ED8D53
S1232CA0FB90CC0000ED8DFB9FCC030017FBDF308D020B17FBCD8653308DFB63A702A68D6C
S1232CC0FB73A78DFB846A8DFB80102B00E8308DFB4D17FD5417FDCD26ECA68D0284815947
S1232CE026E417FC78108E2014308DFB4E5FA6A52705A7855C20F7CB23308DFB3BE784178B
S1232D00FC2B6A8DFB44102B00AC308DFB2A17FD1817FD9126ECA68D0248815926E4AD9FF9
S1232D202012265C17FC06308D01D3C43FE78DFB1ACB20E701C644E7028623A784AD9F209F
S1232D4012260C17FB09308D01B417FC5B27EE6A8DFAF7102B005F308D01A317FCCB17FD46
S1232D604426EC308D01F9EC018020C1592709C14E102600414A843FA18DFACF26D1209E2C
S1232D80AD9F200E17FBA66A8DFABF102B0027865A17FCEA17FD0E26EE17FB916A8DFAAA9A
S1232DA0102B0012864217FCD517FCF926EE308D012017FACE39AD9F200E864217FCBF30B8
S1232DC08D012617FABD3917FB03308DFA4117FAB2308D00DA17FAABCC0000ED8DFA69EC7C
S1232DE08DFA4FFD0957AD9F200C7D2014260139CC030017FA98308D00C417FA866F8DFA8D
S1232E004D17FCFE8153262117FCF78146261A17FD86815A261317FCE98142260C8659178F
S1232E20FC5CAD9F200E16FF8516FF8A0A0A414C4C20504152414D45544552532053484F78
S1232E40574E20494E204845580A454E544552204E45572056414C554553204259204B4520
S1232E605920434F44450A424C414E4B3D4E4F204348414E47452C20425245414B3D46462E
S1232E800A0A202054595045204D4F44452020454F4C204E5452592020534F4820444255A1
S1232EA0470A000A53454E442046494C450A000A524543454956452046494C450A00504157
S1232EC0434B45542023303030302028484558290A000A075452414E5346455220434F4DEF
S1222EE0504C45544507070A000A075452414E53464552204641494C454407070A00FFEB
S9032000DC
<<< ccprot.asm >>>
00010 * COLOR COMPUTER KERMIT VERSION 1.1 03/85
00020 * COPYRIGHT (C) 1985 BY WES HUBERT
00030 * 3020 STEVEN DRIVE, LAWRENCE, KS 66044
00040 *
00050 * THIS IS AN IMPLEMENTATION OF THE KERMIT
00060 * PROTOCOL DEVELOPED BY FRANK DA CRUZ AND
00070 * BILL CATCHINGS AT THE COLUMBIA UNIVERSITY
00080 * CENTER FOR COMPUTING ACTIVITIES.
00090 *
00100 * THE USUAL KERMIT PERMISSIONS APPLY:
00110 * THE PROGRAM MAY BE COPIED FOR PRIVATE USE
00120 * OR NON-PROFIT DISTRIBUTION, BUT CANNOT BE
00130 * SOLD OR INCORPORATED INTO OTHER SOFTWARE
00140 * SOLD FOR PROFIT.
00150 *
00160 * THIS VERSION OF KERMIT RUNS ON THE TRS-80
00170 * COLOR COMPUTER. IT SHOULD WORK WITH BOTH
00180 * VERSION 1.0 AND 1.1 DISK ROM.
00190 * MINIMUM SYSTEM IS 16K WITH ONE DISK.
00200 *
00210 * THIS PORTION OF THE CODE PERFORMS KERMIT
00220 * PROTOCOL TRANSFERS. IT REQUIRES PRIOR
00230 * LOADING OF A SEPARATE PROGRAM FOR
00240 * KERMIT-COCO GENERAL TERMINAL FUNCTIONS.
00250 *
00260 * THIS CODE IS SUITABLE FOR THE RADIO SHACK
00270 * EDTASM ASSEMBLER. IT WAS PREPARED FROM THE
00280 * ROM-PACK VERSION WITH THE DISK I/O MODS
00290 * FROM RAINBOW MAGAZINE.
00300 *
00310 * SINCE THIS IS AN IN-MEMORY ASSMBLER
00320 * (ASSEMBLER, CODE AND SYMBOL TABLES
00330 * ALL RESIDE IN MEMORY) COMMENTS ARE
00340 * SKETCHY. THESE COMMENTS DOWN TO
00350 * THE ORG MUST BE DELETED TO GET
00360 * ENOUGH MEMORY TO ASSEMBLE.
00370 *
00380 * 1. ASSEMBLE BOTH TERMINAL & PROTOCOL CODE.
00390 * 2. PCLEAR 1: CLEAR 10,&H1FFF
00400 * 3. LOADM"COCOTERM"
00410 * 4. LOADM"COCOPROT"
00420 * 5. SAVEM"CCKERMIT",&H2000,&H2FFF,&H2000
00430 *
00440 * THIS VERSION OF KERMIT SENDS OR RECEIVES
00450 * ONLY ONE FILE AT A TIME. THE NAME MUST
00460 * BE EXPLICITLY GIVEN BY THE USER. THIS
00470 * IS TO PLACE RESPONSIBILITY TO AVOID
00480 * OVERWRITING EXISTING FILES ON THE USER.
00490 *
00500 *************************
00510 * KERMIT-COCO ENTRIES *
00520 *************************
00530 *
00540 ORG $2800 (ADDRESS KNOWN TO TERMINAL CODE)
00550 BRA LRCV (RECEIVE)
00560 BRA LSEND (SEND)
00570 BRA LSET (SET-UP)
00580 LRCV LBRA KRCV
00590 LSEND LBRA KSEND
00600 LSET LBRA KSET
00610 *
00620 *************************
00630 * TERMINAL ENTRY POINTS *
00640 *************************
00650 *
00660 RS232I EQU $2002 (RS232 INPUT)
00670 RS232O EQU $2004 (RS232 OUTPUT)
00680 KEYIN EQU $2006 (KEYBOARD INPUT)
00690 CHROUT EQU $2008 (DISPLAY OUTPUT)
00700 INNAME EQU $200A (OPEN INPUT FILE)
00710 OTNAME EQU $200C (OPEN OUTPUT FILE)
00720 FCLOSE EQU $200E (CLOSE FILE)
00730 WAIT EQU $2010 (PAUSE 1 BIT TIME)
00740 QEOF EQU $2012 (TEST FILE EOF)
00750 FNAME EQU $2014 (FILENAME BUFFER)
00760 *
00770 *************************
00780 * COCO DEFINITIONS *
00790 *************************
00800 *
00810 UNIT EQU $6F (I/O UNIT#)
00820 SCRPTR EQU $88 (SCREEN POINTER)
00830 SCREEN EQU $400 (SCREEN MEMORY)
00840 RTYPE EQU $957 (TYPE/MODE)
00850 PUTCHR EQU $A002 (PUT CHAR, INDIRECT)
00860 GETCHR EQU $A176 (READ SINGLE CHAR)
00870 INPIA EQU $FF22 (INPUT PIA)
00880 *
00890 HEADER FCC 'KERMIT-COCO 1.1'
00900 FCB 0
00910 *
00920 *************************
00930 * KERMIT INIT PACKET *
00940 *************************
00950 *
00960 INPAK RMB 0
00970 INLNG FCB 44 (LENGTH+32)
00980 FCB 32 (PACKNO+32)
00990 INTYPE FCC 'S' (SEND INIT)
01000 MYMAXL FCB 126 (MAX PACKET SIZE+32)
01010 MYTIME FCB 47 (15 SECOND TIMEOUT)
01020 MYPADN FCB 33 (1 PAD CHAR)
01030 MYPADC FCB $40 (NULL)
01040 MYEOLI FCB 45 (EOL=CARRIAGE RETURN)
01050 MYQCTL FCC '#' (CONTROL QUOTE)
01060 MYQBIN FCC '&' (BINARY QUOTE)
01070 MYCHKT FCC '1' (1-BYTE CHECKSUM)
01080 MYREPT FCB 32 (NO REPEATS)
01090 RMB 1 (PLACE FOR CHECKSUM)
01100 MYEOL FCB 13 (MYEOLI-32)
01110 *
01120 *************************
01130 * REMOTE CHARACTERISTICS*
01140 *************************
01150 *
01160 MAXL FCB 94 (MAY BE
01170 PADN FCB 0 REVISED
01180 PADC FCB 0 BY THE
01190 QCTL FCC '#' REMOTE INIT
01200 QBIN FCC '&' PACKET)
01210 *
01220 *************************
01230 * SETABLE PARAMETERS *
01240 *************************
01250 *
01260 FTYPE FCB 0 (FILE TYPE=BASIC)
01270 FMODE FCB $FF (FILE MODE=ASCII)
01280 EOL FCB 13 (C.R.)
01290 MAXTRY FCB 5 (# OF RETRIES)
01300 SOH FCB 1 (PACKET HEADER)
01310 QDEBUG FCB 0 (0=NODEBUG)
01320 *
01330 *************************
01340 * FILE NAME PACKET *
01350 *************************
01360 *
01370 FBUFF FCB 0 (LENGTH)
01380 FCB 33 (PACKET #)
01390 FCC 'F' (TYPE)
01400 FBN RMB 12 (NAME)
01410 RMB 1 (CHECKSUM)
01420 *
01430 *************************
01440 * SCRATCH VARIABLES *
01450 *************************
01460 *
01470 NPACK RMB 2 (CURRENT PACKET)
01480 NTRY RMB 1 (REMAINING RETRIES)
01490 SNUM RMB 1 (PACKET MOD 64)
01500 QCR RMB 1 (CR PENDING)
01510 FBIN RMB 1 (HIGH BIT FLAG)
01520 NEEDAK RMB 1 (ACK PENDING)
01530 *
01540 *************************
01550 * READ CHAR FROM FILE 1 *
01560 * RETURN CHAR IN A *
01570 * CLEAR Z FLAG ON EOF *
01580 *************************
01590 *
01600 FGET LDA #1 (UNIT #1)
01610 STA UNIT
01620 JSR [QEOF]
01630 BNE FGETE
01640 JSR GETCHR (BASIC ROM)
01650 CLR UNIT
01660 CLRB
01670 RTS
01680 FGETE CLR UNIT
01690 LDB #1 (FLAG EOF)
01700 RTS
01710 *
01720 *************************
01730 * PUT CHAR INTO FILE 1 *
01740 * RECEIVE CHAR IN A *
01750 *************************
01760 *
01770 FPUT PSHS X,B
01780 LDB #1 (UNIT #1)
01790 STB UNIT
01800 JSR [PUTCHR]
01810 PULS X,B
01820 CLR UNIT (BACK TO SCREEN)
01830 RTS
01840 *
01850 *************************
01860 * SYNC AFTER RS232 INPUT*
01870 *************************
01880 *
01890 SYNC PSHS A (SAVE INCHAR)
01900 JSR [WAIT] (ONE BIT-TIME)
01910 SYNC1 LDA INPIA
01920 LSRA
01930 BCC SYNC1 (WAIT FOR STOP BIT)
01940 PULS A
01950 RTS
01960 *
01970 *************************
01980 * PRINT STRING [X] *
01990 * STRING ENDS WITH NULL *
02000 *************************
02010 *
02020 PRINT LDA ,X+ (CHAR FROM STRING)
02030 BEQ PRINTX (NULL MARKS END)
02040 JSR [CHROUT]
02050 BRA PRINT
02060 PRINTX RTS
02070 *
02080 *************************
02090 * CURSOR TO LINE=A,COL=B*
02100 *************************
02110 *
02120 AT PSHS D
02130 LDB #32 (LINE 0-15)
02140 MUL
02150 CLR ,S
02160 ADDD ,S++ (ADD COL 0-31)
02170 ADDD #SCREEN (SCREEN ORIGIN)
02180 STD SCRPTR
02190 RTS
02200 *
02210 *************************
02220 * BINARY VALUE TO HEX *
02230 *************************
02240 *
02250 TOHEX PSHS A (BINARY VALUE)
02260 CLRB
02270 LSLA (HIGH 4 BITS TO B)
02280 ROLB
02290 LSLA
02300 ROLB
02310 LSLA
02320 ROLB
02330 LSLA
02340 ROLB
02350 PULS A
02360 ANDA #$F (ORIGINAL LOW 4)
02370 ADDD #$3030 (ASCII EXCESS)
02380 CMPA #$39
02390 BLE THX2
02400 ADDA #7
02410 THX2 CMPB #$39
02420 BLE THX4
02430 ADDB #7
02440 THX4 EXG A,B
02450 RTS
02460 *
02470 *************************
02480 * OUTPUT VAL(A) IN HEX *
02490 *************************
02500 *
02510 HEXOUT BSR TOHEX (VAL(A) TO HEX(D))
02520 PSHS B
02530 JSR [CHROUT]
02540 PULS A
02550 JSR [CHROUT]
02560 RTS
02570 *
02580 *************************
02590 * CLEAR SCREEN *
02600 *************************
02610 *
02620 CLEAR LDD #SCREEN
02630 STD SCRPTR (HOME CURSOR)
02640 LDX #SCREEN+$80
02650 LDY #SCREEN+$180
02660 LDD #$6000 (60=SCREEN BLANK)
02670 CLR2 STA B,X
02680 STA B,Y
02690 INCB
02700 BNE CLR2 (256 TIMES)
02710 RTS
02720 *
02730 *************************
02740 * SHOW CURRENT PACKET # *
02750 *************************
02760 *
02770 SNDSTS LDD SCRPTR (SAVE SCREEN LOC)
02780 PSHS X,D
02790 LDD #$0308 (LINE 4, COL 9)
02800 LBSR AT (MOVE CURSOR)
02810 LDA NPACK,PCR
02820 BSR HEXOUT
02830 LDA 1+NPACK,PCR
02840 BSR HEXOUT
02850 PULS X,D
02860 STD SCRPTR
02870 RTS
02880 *
02890 *************************
02900 * ECHO PACKET TO SCREEN *
02910 * RECEIVE A=LINE, B=CHR *
02920 * FOR START OF DISPLAY *
02930 *************************
02940 *
02950 ECHO LDY SCRPTR (SAVE SCREEN LOC)
02960 PSHS Y
02970 LBSR AT
02980 LDA ,X+ (LENGTH)
02990 SUBA #32
03000 ANDA #$7F (128 CHAR MAX)
03010 PSHS A
03020 ECHO2 LDA ,X+
03030 JSR [CHROUT]
03040 DEC ,S
03050 BNE ECHO2
03060 LDA #' (ADD BLANKS)
03070 ECHO4 JSR [CHROUT]
03080 LDB 1+SCRPTR
03090 INCB
03100 ANDB #$7F (TO EVEN 128 BYTES)
03110 BNE ECHO4
03120 PULS A
03130 PULS D (SCREEN LOC)
03140 STD SCRPTR
03150 RTS
03160 *
03170 *************************
03180 * PREPARE TO SEND PACKET*
03190 *************************
03200 *
03210 NEWPAK LDA MAXTRY,PCR
03220 STA NTRY,PCR (SET # RETRIES)
03230 LDD NPACK,PCR
03240 ADDD #1 (BUMP PACKET #)
03250 STD NPACK,PCR
03260 RTS
03270 *
03280 *************************
03290 * COMPUTE CHECKSUM *
03300 * PACKET ADDRESS IN X *
03310 * RETURN CHECKSUM IN A *
03320 * CHECKSUM ADDRESS IN X *
03330 *************************
03340 *
03350 CHKSUM CLRB
03360 LDA ,X (LENGTH)
03370 SUBA #32
03380 BEQ CHKX
03390 CHK2 ADDB ,X+
03400 DECA
03410 BNE CHK2 (SUM ALL BYTES)
03420 TFR B,A
03430 ROLB (MOVE HIGH 2 BITS
03440 ROLB TO LOW BITS
03450 ROLB THROUGH CARRY)
03460 ANDB #3 (2 BITS ONLY)
03470 PSHS B
03480 ADDA ,S+ (ADD INTO LOW 6)
03490 ANDA #$3F (KEEP 6 BITS)
03500 CHKX ADDA #32 (PRINTING ASCII)
03510 RTS
03520 *
03530 *************************
03540 * GET PARAMS FROM S PAK *
03550 *************************
03560 *
03570 REMINI LEAX RBUFF,PCR
03580 CLR QBIN,PCR (CLEAR 8TH-BIT QUOTE)
03590 LDB ,X (LENGTH)
03600 SUBB #35 (LESS SEQ,TYPE,CHKSUM,32)
03610 BEQ REMX
03620 LDA 3,X
03630 SUBA #32
03640 STA MAXL,PCR
03650 DECB
03660 BEQ REMX
03670 DECB (CAN'T TIME OUT)
03680 BEQ REMX
03690 LDA 5,X
03700 SUBA #32
03710 STA PADN,PCR
03720 DECB
03730 BEQ REMX
03740 LDA 6,X
03750 EORA #$40
03760 STA PADC,PCR
03770 DECB
03780 BEQ REMX
03790 DECB
03800 BEQ REMX
03810 LDA 8,X
03820 STA QCTL,PCR
03830 DECB
03840 BEQ REMX
03850 LDA 9,X
03860 CMPA #'Y (Y=& IF REQUESTED)
03870 BNE REM4
03880 LDA #'&
03890 REM4 STA QBIN,PCR
03900 REMX RTS
03910 *
03920 *************************
03930 * PUT CHAR INTO PACKET *
03940 * RECEIVE CHAR IN A *
03950 * PACKET ADDRESS IN X *
03960 * CLEAR Z IF PACKET FULL*
03970 *************************
03980 *
03990 KRMPUT PSHS X (PACKET ADDRESS)
04000 LDB ,X (CURRENT LENGTH)
04010 SUBB #32 (TOCHAR OFFSET)
04020 ABX (CURRENT CHAR)
04030 LDB QBIN,PCR (CHECK 8-BIT QUOTE)
04040 CMPB MYQBIN,PCR
04050 BEQ KRMP0
04060 ANDA #$7F (IGNORE HIGH BIT)
04070 BRA KRMP1
04080 KRMP0 TSTA (CHECK HIGH BIT)
04090 BPL KRMP1
04100 LDB MYQBIN,PCR
04110 STB ,X+
04120 ANDA #$7F
04130 BRA KRMP2
04140 KRMP1 CMPA #$0D (CR INTO CR,LF)
04150 BNE KRMP2
04160 TST FMODE,PCR
04170 BEQ KRMP2 (UNLESS BINARY)
04180 LDB MYQCTL,PCR
04190 STB ,X+
04200 EORA #$40
04210 STA ,X+
04220 STB ,X+
04230 LDA #$0A
04240 EORA #$40
04250 BRA KRMP6
04260 KRMP2 CMPA MYQCTL,PCR (SEE IF CTL FLAG)
04270 BNE KRMP3
04280 EORA #$40 (TEMPORARY SHIFT)
04290 BRA KRMP5
04300 KRMP3 CMPA MYQBIN,PCR (SEE IF BIN FLAG)
04310 BNE KRMP4
04320 CMPA QBIN,PCR (CHECK 8TH-BIT QUOTE)
04330 BNE KRMP4
04340 EORA #$40 (TEMPORARY SHIFT)
04350 BRA KRMP5
04360 KRMP4 CMPA #32 (SEE IF CONTROL)
04370 BMI KRMP5
04380 CMPA #$7F (RUBOUT)
04390 BNE KRMP6
04400 KRMP5 LDB MYQCTL,PCR
04410 STB ,X+
04420 EORA #$40
04430 KRMP6 STA ,X+
04440 *
04450 TFR X,D (NEW NEXT POSITION)
04460 SUBD ,S (LESS PACKET ORIGIN)
04470 PULS X
04480 ADDB #32
04490 STB ,X (LENGTH)
04500 SUBB #28 (NEED UP TO 4 MORE)
04510 CMPB MAXL,PCR
04520 BMI KRMP9
04530 LDB #1 (FLAG END OF PACKET)
04540 RTS
04550 KRMP9 CLRB
04560 RTS
04570 *
04580 *************************
04590 * SEND PACKET *
04600 * PACKET ADDRESS IN X *
04610 *************************
04620 *
04630 SNDPAK PSHS X (HOLD ADDRESS)
04640 LBSR CHKSUM
04650 STA ,X
04660 TST QDEBUG,PCR
04670 BEQ SND2
04680 LDD #$0800 (LINE 9)
04690 LDX ,S
04700 LBSR ECHO
04710 SND2 LDB PADN,PCR
04720 PSHS B
04730 SND3 DEC ,S
04740 BMI SND4
04750 LDA PADC,PCR
04760 JSR [RS232O] (SEND PAD)
04770 BRA SND3
04780 SND4 PULS B
04790 LBSR SNDSTS (SHOW PACKET #)
04800 LDA SOH,PCR
04810 JSR [RS232O] (SEND SOH)
04820 LDX ,S (ADDRESS)
04830 LDB ,X (LENGTH)
04840 SUBB #32
04850 PSHS B
04860 SND6 LDA ,X+
04870 JSR [RS232O]
04880 DEC ,S
04890 BPL SND6
04900 PULS B
04910 LDA EOL,PCR
04920 JSR [RS232O]
04930 PULS X
04940 RTS
04950 *
04960 *************************
04970 * SEND EMPTY PACKET *
04980 * PACKET TYPE IN A *
04990 *************************
05000 *
05010 SEND1 LEAX SBUFF,PCR
05020 STA 2,X (TYPE)
05030 LDA #35
05040 STA ,X
05050 LDB 1+NPACK,PCR
05060 ANDB #$3F
05070 ADDB #32
05080 STB 1,X
05090 LBSR CHKSUM
05100 STA ,X
05110 LDX #$8000 (PAUSE)
05120 SEND1P LEAX -1,X
05130 BNE SEND1P
05140 LEAX SBUFF,PCR
05150 BSR SNDPAK
05160 RTS
05170 *
05180 *************************
05190 * GET PACKET FROM REMOTE*
05200 * CLEAR Z IF FAIL *
05210 *************************
05220 *
05230 GETPAK LEAX RBUFF,PCR
05240 PSHS X
05250 GETP1 JSR [KEYIN] (ALLOW INTERRUPTION)
05260 BEQ GETP2
05270 CMPA #$0D (BY C.R.)
05280 BEQ GETPB
05290 GETP2 JSR [RS232I]
05300 BEQ GETP1
05310 LBSR SYNC (WAIT FOR STOP BIT)
05320 CMPA SOH,PCR
05330 BNE GETP1 (IGNORE UNTIL SOH)
05340 GETP3 LDX ,S (BUFFER LOC)
05350 GETP4 JSR [KEYIN]
05360 BEQ GETP5
05370 CMPA #$0D
05380 BEQ GETPB
05390 GETP5 JSR [RS232I]
05400 BEQ GETP4
05410 LBSR SYNC (WAIT FOR STOP BIT)
05420 CMPA SOH,PCR
05430 BEQ GETP3
05440 STA ,X+
05450 CMPA MYEOL,PCR
05460 BNE GETP4
05470 GETP6 TST QDEBUG,PCR
05480 BEQ GETP7
05490 LDX ,S (SHOW PACKET)
05500 LDD #$0C00 (LINE 13)
05510 LBSR ECHO
05520 GETP7 PULS X
05530 LBSR CHKSUM
05540 CMPA ,X
05550 RTS
05560 GETPB PULS X
05570 LDA #1
05580 RTS
05590 *
05600 *************************
05610 * RECEIVE A PACKET. *
05620 * FIRST ACK PREVIOUS IF *
05630 * NOT YET ACKNOWLEDGED. *
05640 * LEAVE DATA LENGTH IN B*
05650 * DATA ADDRESS IN X *
05660 * Z SET IF TYPE IS DATA *
05670 *************************
05680 *
05690 RGET LDA MAXTRY,PCR
05700 STA NTRY,PCR
05710 TST NEEDAK,PCR
05720 BEQ RGET2
05730 LDA #'Y
05740 LBSR SEND1 (ACK LAST PACKET)
05750 LDD NPACK,PCR
05760 ADDD #1
05770 STD NPACK,PCR
05780 CLR NEEDAK,PCR
05790 RGET2 DEC NTRY,PCR
05800 BMI RFAIL
05810 LEAX RBUFF,PCR
05820 LBSR GETPAK
05830 BEQ RGET4
05840 LDA #'N (NAK)
05850 LBSR SEND1
05860 BRA RGET2
05870 RGET4 LEAX RBUFF,PCR
05880 LDD NPACK,PCR
05890 BNE RGET5
05900 LBSR REMINI
05910 LEAX INPAK,PCR (SPECIAL ACK FOR INIT)
05920 LDA #'Y
05930 STA 2,X
05940 LBSR CHKSUM
05950 STA ,X
05960 LEAX INPAK,PCR
05970 LBSR SNDPAK
05980 LDD #1
05990 STD NPACK,PCR
06000 LDA #'S
06010 RTS
06020 RGET5 ANDB #$3F
06030 ADDB #32
06040 CMPB 1,X
06050 BEQ RGET8
06060 LDA #'N (NAK)
06070 LBSR SEND1
06080 BRA RGET2
06090 RGET8 DEC NEEDAK,PCR
06100 LEAX RBUFF,PCR
06110 LDB ,X
06120 SUBB #35
06130 LEAX 3,X
06140 LDA -1,X (TYPE)
06150 CMPA #'D
06160 RTS
06170 RFAIL LDA #'Q
06180 RTS
06190 *
06200 *************************
06210 * GET NEXT DATA CHAR *
06220 * VIEWS DATA AS STREAM *
06230 * B=CHARS LEFT IN PACKET*
06240 * X=CURRENT DATA ADDRESS*
06250 * RETURN CHAR IN A *
06260 * ON END OF DATA, SET Z *
06270 * LEAVE PACKET TYPE IN A*
06280 *************************
06290 *
06300 GETCHP TSTB
06310 BNE GETC2
06320 LBSR RGET
06330 BNE GETC4
06340 GETC2 DECB
06350 LDA ,X+
06360 RTS
06370 GETC4 CLRB
06380 RTS
06390 *
06400 *************************
06410 * RECEIVE DATA *
06420 * COPY DATA TO FILE 'TIL*
06430 * NON-DATA PACKET. *
06440 *************************
06450 *
06460 KGET CLR QCR,PCR (NO CR PENDING)
06470 CLR FBIN,PCR (NO HIGH BIT)
06480 CLRB
06490 KGET1 LBSR GETCHP
06500 BEQ KGETX
06510 CMPA QBIN,PCR
06520 BNE KGET4
06530 INC FBIN,PCR (FLAG HIGH BIT)
06540 LBSR GETCHP
06550 BEQ KGETX
06560 KGET4 CMPA QCTL,PCR
06570 BNE KGET8
06580 LBSR GETCHP
06590 BEQ KGETX
06600 CMPA QBIN,PCR
06610 BEQ KGET8
06620 CMPA QCTL,PCR
06630 BEQ KGET8
06640 EORA #$40
06650 TST FBIN,PCR
06660 BNE KGET8
06670 TST FMODE,PCR (0=BINARY)
06680 BEQ KGET8
06690 TST QCR,PCR (0=NO CR PENDING)
06700 BEQ KGET8
06710 CMPA #$0A
06720 BNE KGET8
06730 CLR QCR,PCR
06740 BRA KGET9 (SKIP LF AFTER CR)
06750 KGET8 TST FBIN,PCR
06760 BEQ KGET8A
06770 ADDA #$80
06780 KGET8A CLR QCR,PCR
06790 CMPA #$0D
06800 BNE KGET8C
06810 INC QCR,PCR
06820 KGET8C LBSR FPUT (INTO FILE)
06830 KGET9 CLR FBIN,PCR
06840 BRA KGET1
06850 KGETX RTS
06860 *
06870 *************************
06880 * SHOW/SET PARAMETERS *
06890 * ENTERED FROM ATEP *
06900 *************************
06910 *
06920 KSET LBSR CLEAR
06930 LEAX HEADER,PCR
06940 LBSR PRINT
06950 LEAX HDRSET,PCR
06960 LBSR PRINT
06970 LEAX FTYPE,PCR
06980 LDA #6 (# PARAMS)
06990 PSHS A
07000 KREP1 LDA #'
07010 JSR [CHROUT]
07020 JSR [CHROUT]
07030 JSR [CHROUT]
07040 LDA ,X+
07050 LBSR HEXOUT
07060 DEC ,S
07070 BNE KREP1
07080 PULS A
07090 LDA #$0A
07100 JSR [CHROUT]
07110 * NEW PARAMETERS
07120 LDB #6 (# PARAMS)
07130 PSHS B
07140 LEAX FTYPE,PCR
07150 KNEW1 LDA #'
07160 JSR [CHROUT]
07170 JSR [CHROUT]
07180 JSR [CHROUT]
07190 KNEW2 JSR [KEYIN]
07200 BEQ KNEW2
07210 LDB ,S
07220 CMPB #6 (SEE IF FIRST)
07230 BNE KNEW2A
07240 CMPA #$0D (EXIT ON CR IF SO)
07250 BEQ KNEW5
07260 KNEW2A CMPA #' (LEAVE ASIS)
07270 BEQ KNEW3
07280 STA ,X+
07290 BRA KNEW4
07300 KNEW3 LDA ,X+ (GET OLD)
07310 KNEW4 LBSR HEXOUT
07320 DEC ,S
07330 BNE KNEW1
07340 KNEW5 PULS B
07350 LDA #$0A
07360 JSR [CHROUT]
07370 RTS
07380 *
07390 *************************
07400 * SEND FILE - MAIN ENTRY*
07410 *************************
07420 *
07430 KSEND LBSR CLEAR (CLEAR SCREEN)
07440 LEAX HEADER,PCR
07450 LBSR PRINT
07460 LEAX HDRSND,PCR
07470 LBSR PRINT
07480 JSR [INNAME]
07490 TST FNAME (NOTE NOT PCR)
07500 BNE KSEND2
07510 RTS
07520 KSEND2 LDD RTYPE (TYPE/MODE)
07530 STD FTYPE,PCR
07540 LDD #0
07550 STD NPACK,PCR
07560 LDD #$0300
07570 LBSR AT
07580 LEAX HDRPAK,PCR
07590 LBSR PRINT
07600 *** SEND INIT PACKET ***
07610 LDA #'S
07620 LEAX INPAK,PCR
07630 STA 2,X
07640 LDA MAXTRY,PCR
07650 STA NTRY,PCR
07660 SISND DEC NTRY,PCR
07670 LBMI SFAIL
07680 LEAX INPAK,PCR
07690 LBSR SNDPAK
07700 LBSR GETPAK
07710 BNE SISND
07720 LDA 2+RBUFF,PCR
07730 CMPA #'Y
07740 BNE SISND
07750 LBSR REMINI
07760 *** SEND FILE HEADER PACKET ***
07770 LDY #FNAME
07780 LEAX FBN,PCR
07790 CLRB
07800 FNCOPY LDA B,Y
07810 BEQ FNGOT
07820 STA B,X
07830 INCB
07840 BRA FNCOPY
07850 FNGOT ADDB #35 (TOCHAR)
07860 LEAX FBUFF,PCR
07870 STB ,X
07880 LBSR NEWPAK
07890 FNSND DEC NTRY,PCR
07900 LBMI SFAIL
07910 LEAX FBUFF,PCR
07920 LBSR SNDPAK
07930 LBSR GETPAK
07940 BNE FNSND
07950 LDA 2+RBUFF,PCR
07960 CMPA #'Y
07970 BNE FNSND
07980 *** SEND DATA PACKETS ***
07990 SHDR JSR [QEOF]
08000 BNE SCLOSE
08010 LBSR NEWPAK
08020 LEAX SBUFF,PCR
08030 ANDB #$3F (MOD 64)
08040 STB SNUM,PCR (FOR ACK)
08050 ADDB #32 (TOCHAR)
08060 STB 1,X
08070 LDB #'D (DATA)
08080 STB 2,X
08090 LDA #35 (SIZE)
08100 STA ,X
08110 SBUILD JSR [QEOF] (SEE IF EOF)
08120 BNE SSEND
08130 LBSR FGET
08140 LEAX SBUFF,PCR
08150 LBSR KRMPUT (INTO PACKET)
08160 BEQ SBUILD (FILL PACKET)
08170 SSEND DEC NTRY,PCR
08180 LBMI SFAIL
08190 LEAX SBUFF,PCR
08200 LBSR SNDPAK
08210 LBSR GETPAK
08220 BNE SSEND
08230 LEAX RBUFF,PCR (CHECK ACK)
08240 LDD 1,X
08250 SUBA #32 (PACK#)
08260 CMPB #'Y
08270 BEQ SACK
08280 CMPB #'N
08290 LBNE SFAIL
08300 DECA (NAK NEXT?)
08310 ANDA #$3F
08320 SACK CMPA SNUM,PCR
08330 BNE SSEND (FAILURE)
08340 BRA SHDR
08350 SCLOSE JSR [FCLOSE]
08360 *** SEND END OF FILE PACKET ***
08370 LBSR NEWPAK
08380 SNDEOF DEC NTRY,PCR
08390 LBMI SFAIL
08400 LDA #'Z (EOF)
08410 LBSR SEND1
08420 LBSR GETPAK
08430 BNE SNDEOF
08440 *** SEND END OF TRANSMISSION PACKET ***
08450 LBSR NEWPAK
08460 SNDEOT DEC NTRY,PCR
08470 LBMI SFAIL
08480 LDA #'B (EOT)
08490 LBSR SEND1
08500 LBSR GETPAK
08510 BNE SNDEOT
08520 SOK LEAX SFINI,PCR
08530 LBSR PRINT
08540 RTS
08550 SFAIL JSR [FCLOSE]
08560 LDA #'B
08570 LBSR SEND1
08580 LEAX SERR,PCR
08590 LBSR PRINT
08600 RTS
08610 *
08620 *************************
08630 * MAIN RECEIVE ROUTINE *
08640 *************************
08650 *
08660 KRCV LBSR CLEAR
08670 LEAX HEADER,PCR
08680 LBSR PRINT
08690 LEAX HDRREC,PCR
08700 LBSR PRINT
08710 LDD #0
08720 STD NPACK,PCR
08730 LDD FTYPE,PCR
08740 STD RTYPE
08750 JSR [OTNAME]
08760 TST FNAME (NOTE NOT PCR)
08770 BNE KRCV2
08780 RTS (NO NAME, EXIT)
08790 KRCV2 LDD #$0300
08800 LBSR AT
08810 LEAX HDRPAK,PCR
08820 LBSR PRINT
08830 CLR NEEDAK,PCR
08840 LBSR RGET (INIT)
08850 CMPA #'S
08860 BNE KRFAIL
08870 LBSR RGET
08880 CMPA #'F
08890 BNE KRFAIL
08900 LBSR KGET (RECEIVE DATA)
08910 CMPA #'Z (EOF?)
08920 BNE KRFAIL
08930 LBSR RGET
08940 CMPA #'B (EOT)
08950 BNE KRFAIL
08960 LDA #'Y
08970 LBSR SEND1
08980 JSR [FCLOSE]
08990 LBRA SOK
09000 KRFAIL LBRA SFAIL
09010 *
09020 HDRSET FDB $0A0A
09030 FCC 'ALL PARAMETERS SHOWN IN HEX'
09040 FCB $0A
09050 FCC 'ENTER NEW VALUES BY KEY CODE'
09060 FCB $0A
09070 FCC 'BLANK=NO CHANGE, BREAK=FF'
09080 FDB $0A0A
09090 FCC ' TYPE MODE EOL NTRY SOH DBUG'
09100 FDB $0A00
09110 HDRSND FCB $0A
09120 FCC 'SEND FILE'
09130 FDB $0A00
09140 HDRREC FCB $0A
09150 FCC 'RECEIVE FILE'
09160 FDB $0A00
09170 HDRPAK FCC 'PACKET #0000 (HEX)'
09180 FDB $0A00
09190 SFINI FDB $0A07
09200 FCC 'TRANSFER COMPLETE'
09210 FDB $0707
09220 FDB $0A00
09230 SERR FDB $0A07
09240 FCC 'TRANSFER FAILED'
09250 FDB $0707
09260 FDB $0A00
09270 *
09280 ZZZBUF RMB 0 (TOP EXCEPT BUFFER)
09290 SBUFF RMB 98 (SEND BUFFER)
09300 RBUFF RMB 98 (RECEIVE BUFFER)
09310 ZZZTOP RMB 0
09320 END $2000 (ATEP ENTRY)
<<< ccterm.asm >>>
00010 * KERMIT-COCO: COLOR COMPUTER KERMIT
00020 * VERSION 1.1 : 03/85
00030 * COPYRIGHT (C) 1985 BY WES HUBERT
00040 * 3020 STEVEN DRIVE, LAWRENCE KS 66044
00050 *
00060 * THIS PROGRAM IS BOTH A STAND-ALONE
00070 * TERMINAL PROGRAM AND THE BASE FOR
00080 * A COLOR COMPUTER IMPLEMENTATION OF
00090 * THE KERMIT FILE TRANSFER PROTOCOL.
00100 *
00110 * PERMISSION IS GRANTED FOR NON-PROFIT USE AND
00120 * DISTRIBUTION AS PART OF THE COLOR COMPUTER
00130 * KERMIT SYSTEM PROVIDED THAT THIS NOTICE IS
00140 * NOT REMOVED.
00150 *
00160 * KERMIT IS A FILE TRANSFER PROTOCOL DEVELOPED
00170 * BY FRANK DA CRUZ AND BILL CATCHINGS
00180 * AT THE COLUMBIA UNIVERSITY CENTER FOR
00190 * COMPUTING ACTIVITIES.
00200 *
00210 * THIS PORTION OF KERMIT-C0C0 PROVIDES
00220 * TERMINAL FACILITIES INCLUDING EVEN/NO
00230 * PARITY, LOCAL/REMOTE ECHO, AND SIMPLE
00240 * NO PROTOCOL FILE UPLOAD/DOWNLOAD.
00250 * PARITY IS ALWAYS IGNORED ON INPUT.
00260 * THE PARITY BIT TIME IS USED FOR SCREEN
00270 * SCROLLING WHEN NECESSARY.
00280 *
00290 * CHROUT CODE ADAPTED FROM CC TERM
00300 * BY RICHARD CAMPBELL.
00310 * (COLOR COMPUTER MAGAZINE, MARCH 1984)
00320 *
00330 * DISK OPEN/CLOSE CODE ADAPTED FROM TAPE TO
00340 * DISK FILE TRANSFER BY ROGER SCHRAG.
00350 * (RAINBOW MAGAZINE, JANUARY 1984)
00360 *
00370 * THE CODE FOR KERMIT PROTOCOL TRANSFERS
00380 * IS ASSEMBLED AND LOADED SEPARATELY
00390 * AFTER ASSEMBLY AND LOADING OF THIS
00400 * ROUTINE. SEE THE PROTOCOL CODE FOR
00410 * MORE INFORMATION.
00420 *
00430 * THIS PORTION OF THE CODE RESIDES IN
00440 * (HEX) 2000-27FF, THE PROTOCOL CODE
00450 * FROM 2800-2FFF. MEMORY BELOW 2000
00460 * IS AVAILABLE FOR BASIC PROGRAMS, AND
00470 * MEMORY ABOVE 2FFF IS USED FOR THE
00480 * JOURNALIZATION / RAW ASCII TRANSFER
00490 * BUFFER.
00500 *
00510 * NOTE THAT ALTHOUGH EACH PART IS
00520 * WRITTEN IN POSITION INDEPENDENT FORM
00530 * THE COMBINATION IS NOT POSITION INDEPENDENT
00540 * BECAUSE OF FIXED ADDRESSES USED FOR
00550 * COMMUNICATION BETWEEN THE PROGRAMS. TO
00560 * RELOCATE THE PROGRAM, THESE ADDRESSES
00570 * MUST BE MODIFIED.
00580 *
00590 ORG $2000
00600 TERM BRA START
00610 *
00620 *************************
00630 * ENTRIES FOR PROTOCOL *
00640 *************************
00650 *
00660 FDB RS232I
00670 FDB RS232O
00680 FDB KEYIN
00690 FDB OTCHAR
00700 FDB INNAME
00710 FDB OTNAME
00720 FDB FCLOSE
00730 FDB WAIT
00740 FDB QEOF
00750 FILNAM FCC 'KERMIT-COCO '
00760 FCB 0 (END OF STRING)
00770 FCC 'COPYRIGHT (C) 1985'
00780 *
00790 *******************************************
00800 *
00810 *************************
00820 * STANDARD COCO DEFS *
00830 *************************
00840 *
00850 SYSMEM EQU $74 HIGH MEMORY ADDRESS
00860 SCRPTR EQU $88 SCREEN CURSOR PTR
00870 SCREEN EQU $400 SCREEN MEMORY
00880 FNAME EQU $94C FILE NAME
00890 FTYPE EQU $957 FILE TYPE
00900 TOP EQU $3000 END OF KERMIT
00910 POLCAT EQU $A000 KEYBOARD POLL ROUTNE
00920 PUTCHR EQU $A002 CHARACTER OUTPUT
00930 OUTPIA EQU $FF20 MODEM PIA LOC
00940 INPIA EQU $FF22 IN MODEM PIA
00950 *
00960 *************************
00970 * DEFAULT CONFIGURATION *
00980 *************************
00990 *
01000 CAN FCB $18 (XMIT SHFT<- AS CAN)
01010 DEL FCB $08 (XMIT <- AS BKSP)
01020 LECHO FCB 0 (-1=HALF/0=FULL)
01030 PARITY FCB -1 (-1=EVEN/0=NONE)
01040 AUTOLF FCB 0 (-1=YES/0=NO)
01050 CPYMIN FDB TOP (BUFFER ORIGIN)
01060 CPYMAX FDB $7FFF (32K SYSTEM)
01070 CPYPTR FDB TOP (BUFFER POINTER)
01080 COPY FCB 0 (-1=BUFFER/0=DON'T)
01090 SPEED FDB 419 (419=300 BAUD)
01100 DC2 FCB $12 (TURN ON BUFFER)
01110 DC4 FCB $14 (TURN OFF BUFFER)
01120 CURCHR FCB $60 (PLACE FOR CHAR
01130 * UNDER CURSOR)
01140 *
01150 *************************
01160 * EXECUTION ENTRY *
01170 *************************
01180 *
01190 START STS ISTACK,PCR
01200 LEAS TOPSTK,PCR
01210 LBSR CLEAR (CLEAR SCREEN)
01220 LBSR MENU (PRINT MENU)
01230 LEAX TOP,PCR (LOCATE BUFFER)
01240 STX CPYMIN,PCR
01250 LDX SYSMEM (SIZE)
01260 STX CPYMAX,PCR (TOP OF BUFFER)
01270 *
01280 ******************************************
01290 * TOP OF MAIN LOOP *
01300 * ALTERNATELY POLL RS232 INPUT AND *
01310 * KEYBOARD. *
01320 ******************************************
01330 *
01340 CHKMN BSR RSSYNC (WAIT FOR CARRIER)
01350 CHKRSI LBSR RS232I (POLL RS232 PORT)
01360 BEQ CHKKBI
01370 LBSR OTCHAR
01380 BSR RSSYNC
01390 CHKKBI LBSR KEYIN (POLL KEYBOARD)
01400 BEQ CHKRSI
01410 *
01420 CHKBRK CMPA #$FF (BREAK)
01430 BNE CHKDEL
01440 BSR BREAK
01450 BRA CHKMN
01460 *
01470 CHKDEL CMPA #$FE (LEFT ARROW)
01480 BNE CHKCAN
01490 TST LECHO,PCR
01500 BEQ CHKD2
01510 LDA #08 (PRINT BACKSPACE)
01520 LBSR OTCHAR
01530 CHKD2 LDA DEL,PCR (SEND DELETE CHAR)
01540 BRA CHKOUT
01550 *
01560 CHKCAN CMPA #$FD (SHIFT LEFT ARROW)
01570 BNE CHKDUP
01580 LDA CAN,PCR (SEND LINE DELETE)
01590 BRA CHKOUT
01600 *
01610 CHKDUP TST LECHO,PCR
01620 BEQ CHKOUT
01630 LBSR OTCHAR (ECHO PRINT CHAR)
01640 *
01650 CHKOUT BSR RS232O (TRANSMIT CHAR)
01660 BRA CHKMN
01670 *
01680 *************************
01690 * WAIT FOR STOP BIT *
01700 *************************
01710 *
01720 RSSYNC LDA INPIA (READ MODEM)
01730 LSRA
01740 BCC RSSYNC (LOOP UNTIL SET)
01750 RTS
01760 *
01770 ************************
01780 * SEND LINE BREAK *
01790 ************************
01800 *
01810 BREAK CLR OUTPIA (SEND ZERO BITS)
01820 LDX #$6100 (ABOUT .25 SECONDS)
01830 BRK2 LEAX -1,X
01840 BNE BRK2
01850 LDA #2
01860 STA OUTPIA (SEND STOP BIT)
01870 RTS
01880 *
01890 ************************
01900 * PAUSE ABOUT 1 BIT *
01910 ************************
01920 *
01930 WAIT PSHS D (WAIT BIT TIME)
01940 LDD SPEED,PCR
01950 WT2 SUBD #1
01960 BNE WT2
01970 PULS D,PC
01980 *
01990 ************************
02000 * SET EVEN PARITY *
02010 ************************
02020 *
02030 EVEN PSHS X (PRESERVE X)
02040 LDX #7 (SEVEN DATA BITS)
02050 CLRB
02060 EVEN2 RORA
02070 BCC EVEN4
02080 INCB (COUNT 1 BITS)
02090 EVEN4 LEAX -1,X
02100 BNE EVEN2
02110 RORA
02120 RORB (PARITY BIT)
02130 RORA
02140 PULS X (RESTORE X)
02150 RTS
02160 *
02170 ************************
02180 * READ FROM MODEM *
02190 ************************
02200 *
02210 RS232I LDA INPIA (READ MODEM)
02220 LSRA
02230 BCC RSI2 (LOOK FOR START BIT)
02240 CLRA
02250 RTS
02260 RSI2 LDD SPEED,PCR
02270 LSRA (HALF BIT)
02280 RORB
02290 RSI4 SUBD #1 (PPAUSE)
02300 BGT RSI4
02310 LDB #7 (7 DATA BITS)
02320 PSHS A,B
02330 RSI5 LDD SPEED,PCR (WAIT FOR NEXT)
02340 RSI6 SUBD #1
02350 BNE RSI6
02360 NOP
02370 LDB INPIA (GET DATA BIT)
02380 LSRB
02390 ROR 0,S
02400 DEC 1,S
02410 BNE RSI5
02420 ROR 0,S
02430 PULS A,B
02440 ANDA #$7F (DROP PARITY)
02450 CMPA #$7F (IGNORE RUBOUT)
02460 BNE RSI7
02470 CLRA
02480 RSI7 RTS
02490 *
02500 ************************
02510 * WRITE TO MODEM *
02520 ************************
02530 *
02540 RS232O TST PARITY,PCR
02550 BEQ RSO1
02560 BSR EVEN (SET PARITY BIT)
02570 RSO1 LDB #8 (BIT COUNT)
02580 PSHS A,B (BYTE TO SEND,COUNT)
02590 CLR OUTPIA (START BIT)
02600 RSO2 LDD SPEED,PCR
02610 RSO4 SUBD #1
02620 BNE RSO4
02630 LSR 0,S (GET DATA BIT)
02640 ROLB (SHIFT FOR PIA)
02650 ROLB (BIT TWO)
02660 STB OUTPIA (SEND IT)
02670 DEC 1,S (COUNT THE BIT)
02680 BNE RSO2
02690 LEAS 2,S (DROP WORK/COUNT)
02700 LBSR WAIT
02710 LDB #2
02720 STB OUTPIA (STOP BIT)
02730 LBSR WAIT
02740 LBSR WAIT
02750 RTS
02760 *
02770 ************************
02780 * READ FROM KEYBOARD *
02790 ************************
02800 *
02810 KEYIN PSHS B (CHAR FROM SCREEN)
02820 LDB [SCRPTR]
02830 BMI KI0 (SKIP IF CURSOR)
02840 STB CURCHR,PCR (ELSE REMEMBER)
02850 KI0 LDB #$FF (CURSOR CHAR)
02860 STB [SCRPTR] (ONTO SCREEN)
02870 PULS B
02880 JSR [POLCAT] (POLL KEYBOARD)
02890 BNE KI1
02900 RTS (NO INPUT)
02910 *
02920 KI1 CMPA #$03 (BREAK)
02930 BNE KI1A
02940 LDA #$FF (CODE BREAK)
02950 RTS
02960 KI1A CMPA #$08 (BACKSPACE)
02970 BNE KI1B
02980 LDA #$FE
02990 RTS
03000 KI1B CMPA #$15 (SHIFT LEFT ARROW)
03010 BNE KI2
03020 LDA #$FD
03030 RTS
03040 KI2 CMPA #$0C (CLEAR)
03050 BNE KI2A
03060 PSHS X,Y,B
03070 LBSR CLEAR
03080 PULS X,Y,B
03090 CLRA
03100 RTS
03110 KI2A CMPA #$0A (DOWN-ARROW)
03120 BEQ KI3
03130 RTS (NORMAL CHARACTER)
03140 KI3 JSR [POLCAT] (GET CONTROL CHAR)
03150 BEQ KI3
03160 CMPA #$40 (@)
03170 BLO KI4
03180 ANDA #$1F (MAKE CONTROL)
03190 LDB #1
03200 RTS
03210 KI4 CMPA #'? (MENU?)
03220 BNE KI5
03230 LBSR MENU
03240 RTS
03250 KI5 CMPA #'0 (0-9 LOCAL CONTROL
03260 BLO KI6
03270 CMPA #'>
03280 BLE OP0
03290 KI6 PSHS X,B (TRANSLATE
03300 LEAX SPCTAB,PCR
03310 LDB ,X+
03320 SPC2 CMPA B,X
03330 BEQ SPC4
03340 DECB
03350 BPL SPC2
03360 PULS X,B (LEAVE ASIS)
03370 RTS
03380 SPC4 LEAX OUTTAB,PCR
03390 LDA B,X (CHANGE)
03400 PULS X,B
03410 RTS
03420 SPCTAB FCB 5 (# SPECIAL-1)
03430 FCC /'(!)-#/
03440 OUTTAB FDB $607B
03450 FDB $7C7D
03460 FDB $7E7F
03470 *
03480 ***********************
03490 * PROCESS OPTIONS *
03500 ***********************
03510 *
03520 OP0 CMPA #$30 0=EXIT
03530 BNE OP1
03540 PULS X (DROP RETURN
03550 LDS ISTACK,PCR
03560 RTS
03570 OP1 CMPA #$31 1=LOCAL ECHO
03580 BNE OP2
03590 COM LECHO,PCR
03600 CLRA
03610 RTS
03620 OP2 CMPA #$32 2=PARITY
03630 BNE OP3
03640 COM PARITY,PCR
03650 CLRA
03660 RTS
03670 OP3 CMPA #$33 3=AUTO L.F.
03680 BNE OP4
03690 COM AUTOLF,PCR
03700 CLRA
03710 RTS
03720 OP4 CMPA #$34 4=BUFFER ON/OFF
03730 BNE OP5
03740 COM COPY,PCR
03750 CLRA
03760 RTS
03770 OP5 CMPA #$35 5=WRITE FILE
03780 BNE OP6
03790 LBSR WRITEF
03800 CLRA
03810 RTS
03820 OP6 CMPA #$36 6=READ FILE
03830 BNE OP7
03840 LBSR READF
03850 CLRA
03860 RTS
03870 OP7 CMPA #$37 7=UPLOAD
03880 BNE OP8
03890 LBSR UPLOAD
03900 CLRA
03910 RTS
03920 OP8 CMPA #$38 8=RESET POINTER
03930 BNE OP9
03940 LDD CPYMIN,PCR
03950 STD CPYPTR,PCR
03960 CLRA
03970 RTS
03980 OP9 CMPA #$39 9=SET DELETE CHARS
03990 BNE OPR
04000 OP91 LBSR KEYIN
04010 BEQ OP91
04020 STA DEL,PCR
04030 OP9A LBSR KEYIN
04040 BEQ OP9A
04050 STA CAN,PCR
04060 CLRA
04070 RTS
04080 OPR CMPA #'< <=KERMIT RECEIVE
04090 BNE OPS
04100 JSR KERMR
04110 RTS
04120 OPS CMPA #'> >=KERMIT SEND
04130 BNE OPT
04140 JSR KERMS
04150 RTS
04160 OPT CMPA #'= ==KERMIT SETUP
04170 BNE OPX
04180 JSR KERMT
04190 RTS
04200 OPX RTS ** NOT SPECIAL
04210 *
04220 *************************
04230 * PRINT MENU *
04240 *************************
04250 *
04260 MENU PSHS X,Y,D
04270 LBSR CLEAR
04280 LEAX MCHARS,PCR (SHOW CURRENT STATUS)
04290 LDA LECHO,PCR
04300 INCA
04310 LDA A,X
04320 STA MDUP,PCR
04330 LEAX 2,X
04340 LDA PARITY,PCR
04350 INCA
04360 LDA A,X
04370 STA MPAR,PCR
04380 LEAX 2,X
04390 LDA AUTOLF,PCR
04400 INCA
04410 LDA A,X
04420 STA MLF,PCR
04430 LEAX 2,X
04440 LDA COPY,PCR
04450 INCA
04460 LDA A,X
04470 STA MJRNL,PCR
04480 LDA DEL,PCR
04490 LBSR TOHEX
04500 STD MDEL,PCR
04510 LDA CAN,PCR
04520 LBSR TOHEX
04530 STD MCAN,PCR
04540 LEAX MTEXT,PCR
04550 MEN2 LDD ,X++
04560 ADDD #SCREEN
04570 STD <SCRPTR
04580 MEN4 LDA ,X+
04590 BEQ MEN2
04600 BMI MENX
04610 LBSR CHROUT
04620 BRA MEN4
04630 MENX PULS X,Y,D
04640 CLRA
04650 RTS
04660 MCHARS FCC 'YNENYNYN'
04670 MTEXT FDB 8
04680 FCC 'KERMIT-COCO 1.1'
04690 FCB 0
04700 FDB 34
04710 FCC '(PREFIX CONTROL OR COMMANDS'
04720 FCB 0
04730 FDB 66
04740 FCC ' WITH DOWN-ARROW)'
04750 FCB 0
04760 FDB 98
04770 FCC '0 EXIT, ? PRINT MENU'
04780 FCB 0
04790 FDB 130
04800 FCC '1 LOCAL ECHO ('
04810 MDUP FCC '?)'
04820 FCB 0
04830 FDB 162
04840 FCC '2 PARITY ('
04850 MPAR FCC '?)'
04860 FCB 0
04870 FDB 194
04880 FCC '3 AUTO LF ('
04890 MLF FCC '?)'
04900 FCB 0
04910 FDB 226
04920 FCC '4 JOURNALIZE ('
04930 MJRNL FCC '?)'
04940 FCB 0
04950 FDB 258
04960 FCC '5 WRITE BUFFER TO FILE'
04970 FCB 0
04980 FDB 290
04990 FCC '6 READ FILE INTO BUFFER'
05000 FCB 0
05010 FDB 322
05020 FCC '7 UPLOAD BUFFER'
05030 FCB 0
05040 FDB 354
05050 FCC '8 ERASE BUFFER'
05060 FCB 0
05070 FDB 386
05080 FCC '9 DEF CHAR/LINE DELETE ('
05090 MDEL FCC 'XX,'
05100 MCAN FCC 'XX)'
05110 FCB 0
05120 FDB 416
05130 FCC 'KERMIT: = SET, < RECEIVE, > SEND'
05140 FCB 0
05150 FDB 450
05160 FCC '()!-# BRACES BAR TILDE DEL'
05170 FDB $0DFF
05180 *
05190 *************************
05200 * SOUND BELL *
05210 *************************
05220 *
05230 BELL LDA $FF01 (CONFIGURE FOR
05240 ANDA #$F7
05250 STA $FF01
05260 LDA $FF03 SIX BIT
05270 ANDA #$F7
05280 STA $FF03
05290 LDA $FF23
05300 ORA #$08
05310 STA $FF23 SOUND)
05320 LDD #$06F2 (INITIAL TONE)
05330 BELL4 STB OUTPIA (OUTPUT SOUND)
05340 SUBD #$08 (CHANGE TONE)
05350 CMPD #$0002
05360 BNE BELL4
05370 LDA #$07 (RESTORE "BELL")
05380 RTS
05390 *
05400 *************************
05410 * WRITE TO SCREEN *
05420 *************************
05430 *
05440 OTCHAR CMPA DC2,PCR (DOWNLOAD FLAG)
05450 BNE OT1
05460 LDA #$FF (SET FLAG)
05470 STA COPY,PCR
05480 OTCX LBSR WAIT
05490 RTS
05500 OT1 CMPA DC4,PCR (END DOWNLOAD)
05510 BNE OT2
05520 CLR COPY,PCR
05530 BRA OTCX
05540 OT2 CMPA #$07 (BELL)
05550 BNE OT2A
05560 BSR BELL
05570 BRA OTX
05580 OT2A CMPA #$0C (CLEAR)
05590 BNE OT3
05600 LBSR CLEAR
05610 LDA #$0C
05620 BRA OTX
05630 OT3 CMPA #$08 (BACKSPACE)
05640 BNE OT4
05650 LDB #$60
05660 STB [SCRPTR]
05670 OT4 CMPA #$0D (RETURN/ENTER)
05680 BNE OT5
05690 TST AUTOLF,PCR
05700 BNE OT6
05710 LDB CURCHR,PCR
05720 STB [SCRPTR]
05730 LDB #$60
05740 STB CURCHR,PCR
05750 LDB SCRPTR+1
05760 ANDB #$E0
05770 STB SCRPTR+1
05780 LBSR WAIT
05790 BRA OTX
05800 OT5 CMPA #$0A (LINE FEED)
05810 BNE OT6
05820 LDB CURCHR,PCR
05830 STB [SCRPTR]
05840 LDB #$60
05850 STB CURCHR,PCR
05860 LDA #$0D (PRINT C.R)
05870 LDB SCRPTR+1
05880 ORB #$1F (AT END OF LINE)
05890 STB SCRPTR+1
05900 LBSR CHROUT
05910 LDA #$0A (RESTORE L.F.)
05920 BRA OTX
05930 OT6 LBSR CHROUT (NORMAL CHAR)
05940 OTX TST COPY,PCR
05950 BNE OTCOPY
05960 RTS
05970 *
05980 ************************
05990 * "WRITE" TO BUFFER *
06000 ************************
06010 *
06020 OTCOPY LDX CPYPTR,PCR (BUFFER PTR)
06030 CMPX CPYMAX,PCR
06040 BMI CPY2
06050 CLR COPY,PCR (TURN OFF)
06060 BSR CPYERR
06070 RTS
06080 CPY2 STA ,X+ (STORE CHARACTER)
06090 STX CPYPTR,PCR
06100 RTS
06110 CPYERR PSHS A
06120 LEAX CEM,PCR
06130 CE2 LDA ,X+
06140 BEQ CEX
06150 LBSR OTCHAR
06160 BRA CE2
06170 CEX LBSR BREAK
06180 PULS A
06190 RTS
06200 CEM FCB $07
06210 FCC 'buffer full'
06220 FDB $0A00
06230 *
06240 ************************
06250 * UPLOAD FROM BUFFER *
06260 ************************
06270 *
06280 UPLOAD LDY CPYMIN,PCR
06290 UP2 CMPY CPYPTR,PCR
06300 BEQ UP8
06310 LDA ,Y
06320 LBSR RS232O
06330 LBSR KEYIN (ALLOW BREAK)
06340 BEQ UP4
06350 CMPA #$FF
06360 BEQ UP8
06370 UP4 LDA ,Y+
06380 LBSR OTCHAR
06390 CMPA #$0D
06400 BNE UP2
06410 LDX #$8000 (PAUSE AFTER LINE)
06420 UP6 LEAX -1,X
06430 BNE UP6
06440 BRA UP2
06450 UP8 LDB #$FF (RESTORE CURSOR)
06460 STB [SCRPTR]
06470 RTS
06480 *
06490 ***********************
06500 * CLEAR SCREEN *
06510 ***********************
06520 *
06530 CLEAR LDD #SCREEN
06540 STD SCRPTR
06550 LDX #SCREEN+$80
06560 LDY #SCREEN+$180
06570 LDD #$6000
06580 CLR2 STA B,X
06590 STA B,Y
06600 INCB
06610 BNE CLR2
06620 RTS
06630 *
06640 ************************
06650 * DISPLAY CHAR *
06660 ************************
06670 *
06680 CHROUT PSHS A,B,X
06690 CLRB
06700 LDX <SCRPTR
06710 CMPA #8 (BACKSPACE)
06720 BNE CO1
06730 CMPX #SCREEN
06740 BEQ CO9 (DONE IF TOP)
06750 *
06760 LDA #$60 (SPACE)
06770 STA ,-X
06780 BRA CO6
06790 CO1 CMPA #$0D (ENTER)
06800 BNE CO3
06810 LDX <SCRPTR
06820 *
06830 CO2 LDA #$60 (BLANK)
06840 STA ,X+
06850 TFR X,D
06860 BITB #$1F (END OF LINE?)
06870 BNE CO2
06880 BRA CO6
06890 CO3 CMPA #$20 (CONTROL?)
06900 BLO CO9
06910 TSTA
06920 BMI CO5 (GRAPHICS?)
06930 CMPA #$40
06940 BLO CO4
06950 CMPA #$60 (UPPER?)
06960 BLO CO5
06970 ANDA #$DF
06980 CO4 EORA #$40
06990 *
07000 CO5 STA ,X+
07010 CO6 STX <SCRPTR
07020 CLRB
07030 CMPX #$5FF (END?)
07040 BLS CO9
07050 *
07060 LDX #SCREEN (SCROLL)
07070 CO7 LDD $20,X
07080 LDU $22,X
07090 STD ,X++
07100 STU ,X++
07110 CMPX #$5E0
07120 BLO CO7
07130 STX <SCRPTR
07140 *
07150 LDD #$6060
07160 CO8 STD ,X++ (CLEAR LAST LINE)
07170 CMPX #SCREEN+512
07180 BLO CO8
07190 *
07200 CO9 CMPB #$60
07210 BEQ CRS
07220 LBSR WAIT (WAIT IF NO SCROLL)
07230 CRS PULS A,B,X,PC
07240 *
07250 ************************
07260 * DETECT DISK EOF *
07270 ************************
07280 *
07290 QEOF PSHS X,Y,U
07300 LDX <$A6 BASIC POINTER
07310 LDB $18E
07320 LDU $18F ERROR VECTOR
07330 PSHS U,X,B
07340 LDB #$7E (A REAL KLUDGE)
07350 LEAU QEOF3,PCR
07360 STB $18E (BUT--
07370 STU $18F THAT'S LIFE)
07380 STS QEOF5,PCR
07390 LEAX QEOF4,PCR
07400 STX <$A6 (AND IT WORKS)
07410 LDA ,X
07420 ANDCC #$FE (GET SOMETHING
07430 JSR $ADC6 BETTER LATER)
07440 QEOF1 LDA #1
07450 QEOF2 PULS U,X,B
07460 STB $18E
07470 STU $18F
07480 STX <$A6
07490 PULS U,X,Y
07500 TSTA
07510 RTS
07520 QEOF3 LDS QEOF5,PCR
07530 CLRA
07540 BRA QEOF2
07550 QEOF4 FDB $58B3 (TOKENIZED
07560 FDB $31AE X=1/EOF(1)
07570 FDB $FF8C
07580 FDB $2831
07590 FDB $2900
07600 QEOF5 FDB 0
07610 *
07620 ************************
07630 * DISK OPEN/CLOSE *
07640 ************************
07650 *
07660 USEROM PSHS A
07670 LDA $C005 (ROM VERSION)
07680 ANDA #1 (1.0=0, 1.1=1)
07690 LSLA
07700 LEAU A,U
07710 PULS A
07720 JMP [,U]
07730 DFNAME FDB $C8A4 (1.0 LOC)
07740 FDB $C952 (1.1 LOC)
07750 DOPEN FDB $C468 (ETC.)
07760 FDB $C48D
07770 DCLOSE FDB $CA3B
07780 FDB $CAE9
07790 *
07800 INNAME LBSR GETNAM (OPEN INPUT)
07810 TST FILNAM (NOT PCR)
07820 BEQ NAME7
07830 LDX #FNAME
07840 LDA #$20
07850 NAME1 STA ,X+
07860 CMPX #FTYPE
07870 BLO NAME1
07880 LDB #$FF
07890 LEAX FILNAM,PCR
07900 NAME3 INCB
07910 LDA B,X
07920 BNE NAME3
07930 LEAU NAME5,PCR
07940 PSHS U
07950 CLR ,-S
07960 LDU #DFNAME
07970 JMP USEROM
07980 NAME5 LDA #'I
07990 LDB #1
08000 LDU #DOPEN
08010 JSR USEROM
08020 NAME7 RTS
08030 *
08040 OTNAME LBSR GETNAM (OPEN OUTPUT)
08050 TST FILNAM (NOT PCR)
08060 BEQ OTN7
08070 LDX #FNAME
08080 LDA #$20
08090 OTN1 STA ,X+
08100 CMPX #FTYPE
08110 BLO OTN1
08120 LDB #$FF
08130 LEAX FILNAM,PCR
08140 OTN3 INCB
08150 LDA B,X
08160 BNE OTN3
08170 LEAU OTN5,PCR
08180 PSHS U
08190 CLR ,-S
08200 LDU #DFNAME
08210 JMP USEROM
08220 OTN5 LDA #'O
08230 LDB #1
08240 LDU #DOPEN
08250 JSR USEROM
08260 OTN7 RTS
08270 *
08280 ************************
08290 * LOAD FROM FILE *
08300 ************************
08310 *
08320 READF LBSR INNAME
08330 TST FILNAM (NOT PCR)
08340 BEQ READX2
08350 LDA #1
08360 STA $6F (BUFFER #1)
08370 READ2 LBSR QEOF
08380 BNE READX
08390 JSR $A176 (GET 1 CHAR.)
08400 LDX CPYPTR,PCR
08410 CMPX CPYMAX,PCR
08420 BPL RERR
08430 STA ,X+ (PLACE IN BUFFER)
08440 STX CPYPTR,PCR
08450 BRA READ2
08460 RERR LBSR CPYERR (BUFFER FULL)
08470 CLR COPY,PCR
08480 READX LDU #DCLOSE (CLOSE)
08490 LBSR USEROM
08500 CLR $6F (BACK TO SCREEN)
08510 READX2 RTS
08520 *
08530 ************************
08540 * WRITE BUFFER TO FILE *
08550 ************************
08560 *
08570 WRITEF LDD #$00FF (BASIC, ASCII)
08580 STD FTYPE
08590 LBSR OTNAME
08600 TST FNAME
08610 BEQ WRITX4
08620 LDA #1
08630 STA $6F (BUFFER #1)
08640 LDY CPYMIN,PCR
08650 WRITE2 CMPY CPYPTR,PCR
08660 BEQ WRITEX
08670 LDA ,Y+ (CHAR FROM BUFFER)
08680 JSR [PUTCHR] (WRITE IT)
08690 BRA WRITE2
08700 WRITEX CMPA #$0D (END WITH C.R.)
08710 BEQ WRITX2
08720 LDA #$0D
08730 JSR [PUTCHR]
08740 WRITX2 LDU #DCLOSE
08750 LBSR USEROM
08760 CLR $6F
08770 WRITX4 RTS
08780 *
08790 *************************
08800 * CLOSE FILE #01 *
08810 *************************
08820 *
08830 FCLOSE LDA #1
08840 STA $6F
08850 LDU #DCLOSE
08860 LBSR USEROM
08870 CLR $6F
08880 RTS
08890 *
08900 *************************
08910 * READ NAME OF FILE *
08920 *************************
08930 *
08940 GETNAM LEAX GETPMP,PCR
08950 GET0 LDA ,X+
08960 BEQ GET1
08970 LBSR CHROUT
08980 BRA GET0
08990 GET1 LEAX FILNAM,PCR
09000 CLRB
09010 GET2 LBSR KEYIN
09020 BEQ GET2
09030 CMPA #$0D
09040 BEQ GETX
09050 CMPA #$FE (BACKSPACE)
09060 BNE GET4
09070 TSTB
09080 BEQ GET2
09090 LDA #$60
09100 STA [SCRPTR]
09110 LDA #$08
09120 LBSR CHROUT
09130 DECB
09140 BRA GET2
09150 GET4 CMPB #12
09160 BEQ GET2
09170 STA B,X
09180 LBSR CHROUT
09190 INCB
09200 BRA GET2
09210 GETX LBSR CHROUT
09220 CLR B,X
09230 RTS
09240 GETPMP FCC 'FILENAME.EXT? '
09250 FCB 0
09260 *
09270 *************************
09280 * CONVERT A TO HEX IN D *
09290 *************************
09300 *
09310 TOHEX PSHS A
09320 CLRB
09330 LSLA
09340 ROLB
09350 LSLA
09360 ROLB
09370 LSLA
09380 ROLB
09390 LSLA
09400 ROLB
09410 PULS A
09420 ANDA #$F
09430 ADDD #$3030
09440 CMPA #$39
09450 BLE THX2
09460 ADDA #7
09470 THX2 CMPB #$39
09480 BLE THX4
09490 ADDB #7
09500 THX4 EXG A,B
09510 RTS
09520 *
09530 ISTACK RMB 2
09540 STACK RMB 100
09550 TOPSTK FDB 0
09560 ZZTOP RMB 0
09570 *
09580 ORG $2800 (KERMIT ORIGIN)
09590 KERMR BRA KERMX (RECEIVE STUB)
09600 KERMS BRA KERMX (SEND STUB)
09610 KERMT BRA KERMX (SETUP STUB)
09620 KERMX LEAX KRMSTB,PCR
09630 KERMX0 LDA ,X+
09640 BEQ KERMX1
09650 LBSR CHROUT
09660 BRA KERMX0
09670 KERMX1 RTS
09680 KRMSTB FCB 13
09690 FCC 'KERMIT PROTOCOL NOT LOADED.'
09700 FDB $0D00
09710 ZZZTOP RMB 0
09720 END TERM