Programs written in Apple's Integer BASIC sometimes had bits of machine code embedded in them. This was more convenient than loading the code separately, especially when the program was loaded from tape.
When the program is first loaded, it looks garbled. For example, the classic APPLE-VISION demo starts like this:
0 LOMEM:1800
1 HIMEM:8192: POKE 202,165: POKE 203,27:LOMEM:6144:CLR : GOTO 0
8264, RUN LOMEM:*2664439008, ^ , RUN , ? ABS *2664439008, ^ , RUN ABS *266438288; RUN ^ , RUN 6164,=58882/42004#2112 24576*
The LIST
command would sometimes go into an infinite loop. But after the program is first run, the listing looks more normal:
0 REM *** APPLE-VISION *** WRITTEN BY R.J. BISHOP
20 DIM A$(51)
30 A$=" BOB BISHOP PRESENTS . . . APPLE-VISION! "
40 CALL -936
How does this work, in terms of both the underlying mechanism and the mechanics of developing a program that hides code this way? e.g. how does one combine the BASIC and machine code portions before saving to disk or tape?
Update 1: for the curious, a commented disassembly of APPLE-VISION can be found here.
Update 2: another program by Bob Bishop, called Bomber, was written entirely in assembly language, but used an Integer BASIC wrapper. As far as I can tell, this was done solely to make it easier to play the game from cassette tape: you could read it in with a LOAD
command from BASIC, instead of having to drop into the monitor and specify an address range. Full disassembly of Bomber is here.
CALL
it.