[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AppleSoft Basic to text-- BASIC xfer
On Mon, 12 Jun 2000 22:26:23 -0500, Rubywand <rubywand@swbell.net>
wrote:
> As Jeff points out I screwed up on my last response to this idea.
>
> In line with using a Text editor on the IIgs and your EXEC idea, this
>should work with your serial cable setup (going from the IIe to the IIgs
>Printer port):
>
>
>o- Edit the program Text on the IIgs and save the Text file as BASTXT on a
>3.5" diskette in Drive 1 (Slot 5).
>
>o- Exit the editor and get into Applesoft BASIC. Do a
>
>CAT,S5,D1
>
>o- Enter this program and save it as LISTOUTBASIC on the diskette
>
> 100 ONERR GOTO 200
> 110 PRINT CHR$ (4)"OPEN BASTXT"
> 120 REM SET OUTPUT PORT
> 130 PRINT CHR$ (4)"PR#1"
> 140 PRINT CHR$ (4)"READ BASTXT"
> 150 FOR I = 0 TO 999999: GET C$
> 160 REM MAX TT VAL SETS LINE DELAY (1333 FOR 2.8MHZ GS)
> 170 IF ASC (C$) < 32 THEN PRINT : FOR TT = 0 TO 1333: NEXT TT: GOTO 190
> 180 PRINT C$;
> 190 NEXT I
> 200 PRINT CHR$ (4)"PR#0"
> 210 PRINT : PRINT CHR$ (4)"CLOSE"
> 220 END
>
>
>
>o- Set up your serial ports. Since you will be entering BASIC lines on the
>IIe, pick a low baud rate, like 300 baud, to avoid overflow. Set the IIgs
>Printer Port for all defaults except ..
>
> Delete first LF after CR: Yes
> Add LF after CR: No
> Baud= 300
>
>
>o- Do a NEW on the IIe and do an IN#2 . Do not do a PR#1 for the IIgs. (Let
>the program do it.)
>
>o- Run the program on the IIgs.
>
>
> The LISTOUTBASIC program should read your program Text from BASTXT
>character by character and send it to the IIe. (The delay in Line 170 is a
>bit longer than needed; but, it does not hurt to allow a little extra time
>for line entry.) When it's done, the program should be entered on the IIe
>and ready to save.
I thought the reason he wanted to print to the IIe from his IIgs was
to keep him from having to switch back and forth between ProDOS 8 and
GS/OS. Your program requires him to do the switch. Besides, if you
are going to drop into ProDOS 8 to run your program, I'd think it
would be easier to set the printer control panel to the values you
want, start BASIC.SYSTEM, exec your listing, do a PR#1 and then type
LIST.
Now, about your program. First off your program should have a POKE
216,0 in it, preferably at line 200, to disable the ONERR GOTO
statement so that any subsequent errors will be handled by Applesoft's
internal error handlers. You should also have a CALL -3288 in there
to clean up the error information off the control stack.
Second, you probably shouldn't be using a FOR/NEXT loop. You are
limiting yourself to 999,999 characters of text for your program.
Mind you, this should be enough for most Applesoft programs seeing as
a tokenized program can only be about 32K but a non-tokenized version
will be quite a bit larger. You've allowed for at least a 30 times
increase by using that number. The catch comes when you consider the
fact that one of the nice things about using this method to edit your
programs is that your REM statements don't need to have line numbers.
This means that when you exec the program you end up with a tokenized
program with no REM statements wasting memory but your source code is
still nicely commented. This might end up pushing the size of the
source code to a size larger that 999,999 characters. You'd be better
off using a infinite loop for copying the file and have the ONERR GOTO
pull you out of it when you get to the end of the file.
Third, you are assuming that the only control character that will
appear in the source code is a carriage return. This may not be true
and the user might actually want control characters to be sent
through. You should only test for a carriage return if you want to
put in an end of line delay.
So, I would change your program to look like this:
100 ONERR GOTO 200
110 PRINT CHR$(4);"OPEN BASTXT"
120 REM SET OUTPUT PORT
130 PRINT CHR$(4);"PR#1"
140 PRINT CHR$(4);"READ BASTXT"
150 GET C$
160 REM MAX TT VAL SETS LINE DELAY (1333 FOR 2.8MHZ GS)
170 IF ASC(C$) = 13 THEN PRINT:FOR TT = 0 TO 1333: NEXT TT: GOTO 150
180 PRINT C$;
190 GOTO 150
200 POKE 216,0: CALL -3288
210 PRINT CHR$(4);"PR#0"
220 PRINT : PRINT CHR$(4);"CLOSE"
230 END
By the way, the first PRINT in line 220 I don't really think is
necessary but I left it in because it won't hurt and line 230 isn't
necessary either but I left it in anyways as it is good programming
style. You should also be able to change lines 170 and 180 to this:
170 PRINT C$;
180 IF ASC(C$) = 13 THEN FOR TT = 0 TO 1333: NEXT TT
but as I haven't tested it I figured it would be best to leave it like
it was.
However, even after all this, I still think his best bet is to use a
communications program on his IIgs to edit his source code and send it
to his IIe.
+------------------------------------------------------------------------+
| Jeff Blakeney - Dean of the Apple II University in A2Pro on Delphi |
| Delphi Apple II Forums Web Pages |
| A2: http://www.delphi.com/apple2 A2Pro: http://www.delphi.com/a2pro |
+------------------------------------------------------------------------+