Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!ucbcad!ucbvax!sds-intel01!tjohnson From: tjohnson@sds-intel01.UUCP Newsgroups: comp.sys.apple Subject: Re: Applesoft in a 'B' file Message-ID: <8708111711.aa08607@SMOKE.BRL.ARPA> Date: Tue, 11-Aug-87 15:20:31 EDT Article-I.D.: SMOKE.8708111711.aa08607 Posted: Tue Aug 11 15:20:31 1987 Date-Received: Sat, 22-Aug-87 08:59:48 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 58 In message <8708061350.aa25994@SMOKE.BRL.ARPA> SEWALL@uconnvm writes: > An Applesoft file (file type of 'A') is just a special case of a > binary file (one the Applesoft interpreter understands). Unfortunately, > the Applesoft interpreter will complain if you try and RUN or LOAD > a file that has a type of 'B.' If you can change the byte in the > DOS 3.3 directory to make CATALOG TO LABELS OR FILE an 'A' (Applesoft) > file, you'll find that it IS exactly that (an Applesoft program file). Just changing the filetype byte in the DOS 3.3 catalog sector will not allow you to load a B file as an Applesoft program. If the B file is a BSAVEd memory image of an Applesoft program, then you can recreate the Applesoft program but not by the method stated. When a B file is saved, four extra bytes are saved with the file (two for the load address and two for the length). When a Applesoft program is saved, only two extra bytes are saved with the file (length of program only) since DOS 3.3 will always load an Applesoft program at $0801 (actually, DOS uses the address stored in zero page at $67,$68 but that is usually $0801). That difference will prevent you from just changing the catalog byte and loading the file. It is possible to change the B file into an A file though. Basically, the B file is BLOADed at memory location $801, the Applesoft end of program marks and end of program pointer are set, and the program is SAVEd back to disk. Use the following steps to retrieve a BSAVEd memory image of an Applesoft file from a DOS 3.3 disk. 1. Find the length of the B file. Use a program such as Copy II Plus if you do not know the value. Add the length to $0801 - this will be the program end and we will need this value in a later step. 2. Boot DOS 3.3 or type "FP" to clear program memory if already booted. 3. Get into the monitor ("CALL -151") 4. Type "BLOAD ,A$801". 5. The end of program marks for an Applesoft program are three consecutive $00 bytes. Use the address calculated in step one and check memory to make sure that there are three $00 bytes before this memory location. If not, use the monitor to put the extra $00 bytes into memory. Whether you had to add extra bytes or not, the address *after* these three $00 bytes is the important one. 6. The address found in step 5 is the true end of program. DOS looks for the end of program address for an Applesoft program in zero page at $AF,$B0. Put the low byte in $AF and the high byte in $B0. 7. The last step is to type "SAVE " and the Applesoft program will saved back to disk. 8. Do not try to run the program at this point or the system will hang since other necessary pointers have not been initialized. Just type "FP" and then either "LOAD" or "RUN" the new program. --------------------- Todd Johnson ARPA: tjohnson@amc-hq