Arthur Alto wrote: > If a 16x84 does a gets a RETURN instruction without any CALL, what > happens? Will zeros be popped off the stack and send the program > counter back to the Reset Vector, or will the RETURN instruction be > ignored and the program counter be unaffected? Art: The RETURN will certainly not be ignored, but what DOES happen depends on whether any CALLs have previously been executed, since the return addresses that are pushed onto the stack by a CALL remain there after the corresponding RETURN is executed... They're NOT overwritten to "0000" or anything; all that happens is that the stack pointer moves away from them. Here's a visual aid: At Power-On Reset, the stack contains: xxxx <-- Next CALL puts its return address here. xxxx xxxx xxxx xxxx xxxx xxxx xxxx <-- Next RETURN pulls its return address from here. [It might actually contain all 0000's, but I don't think so... As I recall, the stack contents are undefined at power-up] After a CALL from address 0100, the stack contains: 0101 <-- Next RETURN pulls its return address from here. xxxx <-- Next CALL puts its return address here. xxxx xxxx xxxx xxxx xxxx xxxx Let's say that the subroutine we called from address 0100 calls another subroutine... And that that one calls one more, etc., until we've executed 8 nested CALLs without a single RETURN. If that happens, the stack will contain something like: 0101 <-- Next CALL puts its return address here. 0011 0021 0031 0041 0051 0061 0071 <-- Next RETURN pulls its return address from here. Now, let's say that we do 8 RETURNs. After those 8 RETURNS, the PC will be back at address 0101, but the stack will STILL contain the same addresses, and the stack pointer will have rotated through the stack until it's back to the same point: 0101 <-- Next CALL puts its return address here. 0011 0021 0031 0041 0051 0061 0071 <-- Next RETURN pulls its return address from here. Ok... So far, all of our CALLs and RETURNs have been balanced. If we now do as you suggest, and execute a RETURN without a preceding CALL, the program counter will be loaded with 0071. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499