These two programs allow file transfer from the PC to the Apple. Their purpose
is to transfer the larger packet protocol communications program from the PC to
the Apple. Entering these two short programs beats entering 4K+ of machine
code!

Currently my parallel port adapter link is the only supported method to connect
the two systems. I will be working on serial support, but since my real Apple
doesn't have a serial card it will be difficult.

It's a little slow (~16cps), but how fast can you type? The main communications
program is a little faster, ~2000cps.

Enter the following Applesoft BASIC and 6502 machine code programs:

*** Listing for FTP:

10 S = 1
20 F$ = "":DA = 911:SL = 912:CS = 913:RB = 768
30 PRINT CHR$(4)"BLOAD FTP.BIN"
40 POKE SL,S * 16
50 PRINT "WAITING...";: HTAB 1
60 CALL RB:IF PEEK (DA) <  > 0 THEN F$ = F$ +  CHR$ ( PEEK (DA)):GOTO 60
70 PRINT "FILENAME="F$
80 CALL RB:A =  PEEK (DA):CALL RB:A = A +  PEEK (DA) * 256:PRINT "ADDRESS ="A
90 CALL RB:L =  PEEK (DA):CALL RB:L = L +  PEEK (DA) * 256:PRINT "LENGTH  ="L
100 POKE CS,255: POKE CS + 1,255
110 FOR I = 1 TO L:CALL RB:POKE A + I - 1,PEEK (DA):HTAB 1:PRINT I;:NEXT I
120 CALL RB: CALL RB
130 IF  PEEK (CS) <> 184 OR  PEEK (CS + 1) <> 240 THEN  PRINT "CRC ERROR":END
140 C$ = "BSAVE " + F$ + ",A" +  STR$ (A) + ",L" +  STR$ (L)
150 HTAB 1:PRINT "CRC OK":PRINT C$:PRINT  CHR$ (4)C$:END

Save with:

   SAVE FTP

How FTP works:

Line  10 sets the communications slot (i.e. the slot I use is 1).
Line  20 initialises the various constants required.
Line  30 loads the machine language part of this program.
Line  40 sets the slot for the machine language program.
Line  50 prints a status message.
Line  60 gets the filename.
Line  70 displays the filename.
Line  80 gets the starting address to store the data.
Line  90 gets the length of the data (in bytes).
Line 100 initialises the CRC-CCITT checksum.
Line 110 gets the data and shows a running count of the number of bytes
         received.
Line 120 gets the CRC-CCITT checksum.
Line 130 validates the CRC-CCITT and exits the program if it's invalid.
Line 140 sets up the save string.
Line 150 shows some status messages, saves the data and exits the program.

*** Listing for FTP.BIN:

Enter monitor with:

  CALL -151

(you should see a star (*) prompt) and enter the following code (for example,
enter the first line as

300:AE 90 03 5E 84 C0 B0 FB

and press Enter/Return). Continue until entire listing is entered.

0300- AE 90 03 5E 84 C0 B0 FB
0308- 5E 84 C0 90 FB BD 83 C0
0310- 29 E8 4A 4A 4A 4A 90 02
0318- 09 01 8D 8F 03 5E 84 C0
0320- B0 FB BD 83 C0 29 E8 AA
0328- 29 08 F0 06 8A 09 10 29
0330- F0 AA 8A 0D 8F 03 8D 8F
0338- 03 B8 4D 91 03 29 0F 0A
0340- AA A0 04 4E 92 03 6E 91
0348- 03 88 D0 F7 AD 92 03 29
0350- 0F 5D 70 03 8D 92 03 AD
0358- 91 03 5D 6F 03 8D 91 03
0360- 70 0C 2C 6E 03 AD 8F 03
0368- 4A 4A 4A 4A 70 CC 60 00
0370- 00 81 10 02 21 83 31 04
0378- 42 85 52 06 63 87 73 08
0380- 84 89 94 0A A5 8B B5 0C
0388- C6 8D D6 0E E7 8F F7

Save with:

  BSAVE FTP.BIN,A$300,L$8F

Press Ctrl-C and Enter/Return to get back to the Applesoft prompt.

How FTP.BIN works:

  See comments from listing A2ISMALL.ASM.

