acct015@carroll1.UUCP (Bevan Wang) (04/08/89)
Does anyone know how the Reset vector works? And why the values differ in ProDos and DOS 3.3? Also what the heck is the USER Control-Y vector, the Non-maskable interrupt vector? Bevan R.S. Wang acct015@carroll1.UUCP
brianw@microsoft.UUCP (Brian Willoughby) (04/11/89)
In article <345@carroll1.UUCP>, acct015@carroll1.UUCP (Bevan Wang) writes: > Does anyone know how the Reset vector works? And why the values differ > in ProDos and DOS 3.3? Also what the heck is the USER Control-Y vector, the Non-maskable interrupt vector? > > Bevan R.S. Wang > acct015@carroll1.UUCP OK, here goes (forgive any errors due to temporary memory loss) All 65xxx vectors are stored low byte in lower address, high byte in higher address (little-endian). Reset Vector: Hardware Reset for a 65xxx processor always looks at $FFFC.D for the address of a routine to execute. This is the first code to be run at power-up. Starting with the II Plus, our brilliant Apple Computer discovered a way to determine (almost without fail) if this is the first reset (cold-boot, power switch turned on) or not (warm-boot, press Reset key). The $FFFC vector points to a routine in the AutoStart ROM which checks $03F2, $03F3 and $03F4 for special values. The first two addresses are the address of a routine to execute on warm-boot. To prevent a just powered up Apple from jumping into never-never land, an interesting trick with RAM is used. RAM powers up with random values in it, but two adjacent bytes will never have EXACTLY EVERY OTHER BIT OPPOSITE with the remaining bits the same. So by Exclusive ORing $03F3 with the value $A5 and comparing to $03F4, the Apple knows if it is warm restarted. To install a Reset vector program (must be assembly), simply place the address and the "checksum" in the proper addresses. Since I'm not at home with my trusty manual, check your Apple II Tech Ref Manual for the correct addresses. (Or disassemble the ROM and look at how they do it, the Apple II is self-documenting) User Ctrl-Y vector: The Monitor (CALL-151) has a basic set of single-letter commands available. In order to allow user installed flexibility (in the true Apple spirit), an extra "character" was set aside for expansion. If you type "ctrl-Y" from the "*" prompt, the user vector specifies an address to jump to. I have often used this for neato features like a "search memory for <byte>" command from the Monitor. If you understand assembly, look at the listing of the monitor for details of the features available. Non-Maskable Interrupt Vector: This is another 65xxx hardware input. Address $FFFA.B specifies the routine address to call for NMI. These are not used on the Apple II, because the disk drive is processor controlled (vs. floppy disk controller chip), and a non-maskable interrupt would serious damage the precise timing of disk writes. However, there was a software copying board which used the NMI along with banked memory to save a "snapshot" of the memory after a program booted. But you still couldn't fire away with the disk light on. Brian Willoughby microsoft!brianw@uunet.UU.NET or uw-beaver!microsoft!brianw or just microsoft!brianw