Description: Apple II, IIe and II+: Auto-Run Apple w/o DOS (2 of 2) Header: Apple II, IIe and II+: Auto-Run Apple w/o DOS (2 of 2) Article Created: 21 September 1984 Article Last Reviewed: 3 May 1988 Article Last Updated: 3 May 1988 For the next step a copy of the image of the application program needs to be programmed into the EPROMs. The program starts at the address pointed to by $67 and $68 and ends at the address pointed to by $AF and $B0. The contents of the end address pointer, $AF and $B0, will be inserted in the control ROM at locations $1F and $23. When control comes back through the input routine pointer, Applesoft has already initialized $67 and $68. So the next step is to move the image of the Applesoft program down to where it originally came from. How this is done will depend on the hardware of the ROM card and the length of the Applesoft program. If you use the Apple firmware card you will have to address the soft switch to select the firmware card and then address the switch again to re-select the Applesoft ROMs. With the ROMPLUS it could be as simple as using the monitor move routine, $FE2C, to move a program of less than 2 kilobytes long. There is a little more initialization to be done before the Applesoft program can be RUN. The end of program pointer mentioned earlier must be put into $69 and $6A and one more Applesoft routine must be called. Unfortunately this one also drops into Applesoft's command mode so we have to modify the input pointer again to point to a third part of the control ROM. Once this is done the final initialization can be done with a jump to $D4F2. And now the final part, we need to reset the input pointer so that the program can input normally from the keyboard and actually RUN the program. To make things easier there is a routine set by the Auto-Start ROM that will set the input pointers to the keyboard at location $FE89. Then all that's left to do is jump to $D566 which will run the program. For a bit of finesse, if we put a $80 into location $D6, the user will not be able to list the program. In fact any attempt to do any Applesoft command except LOAD from cassette will cause the program to RUN. Also, by changing the reset vectors in the Auto-Start ROM to point to the RUN routine, the program will become very difficult to stop or modify. (To change the reset vector, load memory starting at $3F2 with 66 D5 70. See page 36 and 37 of the Apple II Reference manual for more details) THE LISTING This listing is all done relative to the start of the ROM so all address are given as one byte. If you use an assembler, simply origin the code in RAM and when it is programmed into the control ROM it will work just fine. The routines are not arranged in order of execution so that the move routine will be at the end since the length of the move routine will vary with the hardware requirements. Just be sure that the three byte jump is inserted behind the move routine. * THE FIRST 4 INSTRUCTIONS LOOK LIKE A DISK BUT DON'T * DO ANYTHING * 00: 24 20 BIT $20 02: 24 00 BIT $00 04: 24 03 BIT $03 06: 24 3C BIT $3C * * THIS PART INITIALIZES APPLESOFT AND GETS CONTROL BACK * AT ENTRY2 * 08: A9 1A ENTRY1 LDA # ENTRY2 0A: 85 38 STA KSWL 0C: A5 F8 07 LDA $07F8 0F: 85 39 STA KSWH 11: 4C 00 E0 JMP COLDSTART * * RESET INPUT TO THE KEYBOARD AND RUN THE PROGRAM * 14: 20 8 1a ENRTY3 JSR SETKBD 17: 4C 66 D5 JMP RUN * * FINISH INITIALIZATION & MOVE THE PROGRAM TEXT DOWN * FROM THE ROMS * 1A: A9 14 ENTRY2 LDA # ENTRY3 1C: 85 38 STA KSWL 1E: A9 LL LDA # LENGTH-L 20: 85 69 STA LOMEML 22: A9 HH LDA # LENGTH-H 24: 85 6A STA LOMEMH INSERT YOUR MOVE ROUTINE HERE FOLLOWED BY : 4C F2 D4 JMP INIT PART 2 Copyright 1984, 1988 Apple Computer, Inc. Keywords: