Download We have decided to suspend High Performance Computing
Transcript
NEWS80S Issue 10 - Page 12 90 F$= “” ! Initial value. F$ is the carry-over from one 95 ! Incoming block to another 100 ENTER 10 USING “#,1A” ; A$@ X=NUM (A$) @ DISP X @ IF X<> 10 THEN 100 105 ! Wait for an ETX (converted to LF), which the apple II serial 110 ! interface sends to inquire “are you there?” 115 OUTPUT 10 ;CHR$ (6) ! Send back the PCK, “Yes, I’m ready” 120 ENTER 10 ; A$@ A$=F$&A$ ! Get a block; it may, or may not, end with a CR 125 X=POS (A$,CHR$ (0)) @ IF X>0 THEN A$=A$[1,X-1]&A$[X+1,LEN (A$)] @ GOTO 125 130 ! Reserve any unwanted control characters which you might know to 135 ! exist in the incoming data 140 X=LEN (A$) 145 Y=POS (A$,CHR$ (12)) ! Parse the block into “lines” which are marked by 150 ! carriage return characters (ASCII 13) 155 IF Y=0 THEN 210 ! IF none (or no more of them), save this segment 160 ! of the block to be attached to the next one 165 F$=A$[1,Y-1] @ DISP F$ @ PRINT# 1 ; F$ 170 ! Echo the line to the screen and store on disk 175 IF Y+1>LEN (A$) THEN A$= “” @ GOTO 210 180 ! CR was the last character in the block 185 A$=A$ (A$)[1, LEN(A$)] @ IF NUM (A$)<> 127 THEN 140 ELSE 230 190! Drop off the line we just parsed. If the next character is 195 ! ASCII 127, that’s the signal to end this data transfer. The 200 ! sending program must PRINT CHR$ (127) ;CHR$ (3) to effect this 205 ! signal after the data transfer is complete 210 F$=A$ @ OUTPUT 10 ;CHR$ (6) @ GOTO 120 215 ! Save the remainder of the block for concatenation in line 150. 220 ! Seal the CK character to the sending computer to start the 225 ! transmission of the next block of data 230 ASSIGN# 1 TO * ! Close the file. All done. 235 END 240! 245 ! 500 ! Program to SEND the data from the Apple II 505 ! 510 ! D$CHR$ (4) :PRINT D$; “OPEN XFER FILE” :PRINT D$; “READ XFER FILE” 515 ! ONERR GOTO 600 520 ! PRINT D$; “PR#l” : PRINT CHR$(0); R)KE 2041,0 BEN !lb direct the 525 ! outputs to the interface and disable the interfaces 530 ! line feeds after carriage returns. The CHR$(0) is 535 ! needed to “initialize” the interface, 540 ! INPUT L$ : PRINT L$ GOTO 540 545 ! REM Read lines from a sequential file and print them 550 ! REM through the interface. At end-of-file the program 560 ! REM will branch to line 600. 600 ! PRINT CHR$ (127) ;CHR$ (3) : REM Send the end-of-transfer signal 605 ! PRINT D$; “PR#O” : END : REM and turn off the interface