I've been trying (off and on, mostly off) for some time to convert Wendell Sanders Apple Trek from Integer to Applesoft. He's got a little audio routine in there that when you LIST the program causes it to go nuts. I've worked around the LIST issue, but I still have to extract the audio routine. Mostly I'm still in the BASIC conversion process. It's kind of tedious, but a worthwhile distraction from time to time.
Anyway, from Apple's CONTACT magazine, MAY '78, page 4, there may be some clues. This is written for using TAPE, not disk, so there may be some differences with DOS loaded, I haven't looked into that yet. But here's the procedure (I've typed it in verbatim (minus a couple of typos, may have added a few):
LOADING MACHINE LANGUAGE AS PART OF A BASIC PROGRAM
Often we want to include machine language data inside a BASIC program. A great many Apple tapes are made up this way to simplify the loading process. Here’s a recipe for doing it yourself with programs written in Apple BASIC.
Apple BASIC loads programs into memory with the highest program line at the highest RAM location (HIMEM). Preceding lines are located lower and lower in RAM. The beginning of the program is at PP, an address which is held in memory locations CA and CB (hexadecimal), or 202 and 203, decimal. When you type SAVE, the the computer transfers to tape everything between PP and HIMEM. Thus, to tuck machine language into your program so that it can later be loaded like BASIC, it is merely necessary to move the PP pointer fown below the beginning of the extra code, put in two POKEs to reset the pointer before running the program, and type SAVE. Later, you will be able to LOAD the whole thing just as if it were all BASIC. Just follow these steps:
1. Get the BASIC program into memory, just the way you want it. If you make any changes, you must re-do steps 2 and 6.
2. In the command mode, type: PRINT PEEK (202), PEEK (203) and write down the results. Let’s call them m and n, respectively.
3. Load your machine language code into memory using the monitor load capability (xxxx.yyyyR). This will put the machine language program into memory below the beginning of the BASIC program, starting at hexadecimal address xxxx.
4. Take the starting address of the machine language program and divide it into two parts: xx/xx. Convert each pair of digits from hex to decimal values: a & b; corresponding to the left and right xx pairs, respectively. Write them down.
5. Now enter the BASIC command mode and type: POKE 202,b-1 (value b from step 4, above) Poke 203, a (value a from above step 4 above) POKE 204,00 POKE 205,8
6. You have now moved the pointers down below your machine language program, and must insert code to move them back again when the program is run. To do that, type 0 POKE 202,m: POKE 203,n: GOTO q where m and n are the values from Step 2, and q is the first line number in your BASIC program. That line number can be 0 – it will not be erased by the above entry.
7. Now you’re done! Don’t try to list your program before running it, because all you’ll see is a meaningless set of numbers and symbols. Just type SAVE (before running the program), and it will all go onto tape. Later a LOAD command will bring it all back in.
CAUTION!
Once you have RUN such a program, you cannot SAVE it, for the pointers will have been moved. You can only save or coapy a program like this before it has been RUN.
Good luck!
Dave Rogers