[comp.sys.apple] writing ^D in basic

TMPLee@DOCKMASTER.ARPA (01/05/88)

Does anyone know if there is any way in basic (applesoft) under ProDos
to get the D$ (chr$(4) or chr$(132)) character written out to a file?  I
don't have a ProDos basic manual so don't know if there is any trick:
neither doubling it nor following it with a carriage return, either of
which seems a reasonable escape sequence, works.  .

dr@ski.UUCP (David Robins) (01/07/88)

In article <> TMPLee@DOCKMASTER.ARPA writes:
>Does anyone know if there is any way in basic (applesoft) under ProDos
>to get the D$ (chr$(4) or chr$(132)) character written out to a file?  I
>don't have a ProDos basic manual so don't know if there is any trick:
>neither doubling it nor following it with a carriage return, either of
>which seems a reasonable escape sequence, works.  .

I have seen CTRL-D inserted in REM statements in Applesoft listings to
keep people from LISTing the sourcecode.  RUNning ignores the REM, but
on a LIST, a CRTL-D can then be followed by an FP or similar statement
to kill the program.

They way they got the CRTL-D in the listing was to lwave space in the
REM statement using a false character, like an asterick.  After
wrinting the file to disk, they use a track-sector editor, like COPY
II-PLUS to find the false character and replace it with the CTRL-D
character.  I don't recall if they used hex $04 or hex $84.
-- 
					-dave

====================================================================
David Robins, M.D.  (ophthalmologist / electronics engineer)
Smith-Kettlewell Eye Research Foundation
(previously known as: Smith-Kettlewell Institute of Visual Sciences)
2232 Webster St; San Francisco CA 94115
415/561-1705 (voice)
			{ihnp4,qantel,dual}!ptsfa!ski!dr

The opinions expressed herein do not reflect the opinion of the Institute!

GZT.EWW@OZ.AI.MIT.EDU (Wes Williams) (01/08/88)

re: ^D statements within a file.
OK gang you all got me intrigued!   I'm catching up on a weeks mail so pardon
if I'm redundant.
Point 1. D$ is only a variable. One must create the value of D$ from 
within a program.
2. The accepted basic standard of D$ is the direct machine command that
tells the machine to DO WHAT FOLLOWS the D$ ie ? chr$(4)+"do this".
3. If one wishes to write sompthing to disk as a file the direct
command is issued and then the location of the file and then the data.
 This will result in a text file that then can be read or written to
I fail to see the requirement of writing an additional D$ to this text
file. Txt files are data. Besides, the resident pgm is still in memory
and it knows what D$ is anyway.
4. If one requires a new program to be loaded (even if the name of 
that program has been manufactured within the current pgm) then in
this case the new program will have in it's first few lines
100 D$= chr$(4)+"do this"
so the requirement of writing D$ to a file eludes me.
5. The only necessity I can visualize is when one program (current and running)
is used to physicaly write another program and then save it. This would 
appear to be done in a text editor form and done as follows:
  [remember that this is a text file]
10 D$= chr$(4)+"do this"
20 other parts of pgm

and if you must run this program from the previous resident program
the last line of the manufactured program would be 
100 run

and the last line of the manufacturing program would be 
(linenumber) exec "manufactured program name" 

lastly at this point I disremenber if a D$ is required prior to the "exec"
above.

dooos I got it right?
-------