Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site umd5.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!seismo!umcp-cs!cvl!umd5!zben From: zben@umd5.UUCP Newsgroups: net.micro.apple Subject: Re: Interupts on a apple ][+ Message-ID: <777@umd5.UUCP> Date: Tue, 5-Nov-85 03:36:14 EST Article-I.D.: umd5.777 Posted: Tue Nov 5 03:36:14 1985 Date-Received: Fri, 8-Nov-85 05:53:11 EST References: <76@noscvax.UUCP> <829@psivax.UUCP> Reply-To: zben@umd5.UUCP (Ben Cranston) Organization: U of Md, CSC, College Park, Md Lines: 34 Summary: There is software weirdness here too... In article <829@psivax.UUCP> tommie@psivax.UUCP (Tom Levin) writes: >In article <76@noscvax.UUCP> medin@nosc (Ted Medin) writes: >>... card and have come to the conclusion that the areg is not preserved >>for the interupt code. Specifically when I get an interupt the areg is >>always an 8 or 18 hex. This makes it very difficult to return to the >>interupted code with the regs restored. >> Can someone out there confirm this architecture failure on the ][+ ?????? >... I will give you my knowledge on >6502 interrupts. NO REGISTERS ARE SAVED FOR YOU!!! Yes, you must >save all of the registers yourself and restore them after the "rti" >(return from interrupt) command. The apple monitor saves the ACC in location $45 and then uses the ACC to decide whether the interrupt was an IO interrupt (in which case it wants to jump to the user vector) or a BRKPT interrupt (in which case it wants to jump to the monitor break routine). ******* IT NEVER RESTORES THE ACCUMULATOR FROM THIS USAGE ******* That is where the 18 or 8 is coming from - its the top of the stack, left shifted by three bits. The end of the interrupt code should look like: ... ... LDA $45 RTI or else the mainline code's accumulator gets trashed... -- Ben Cranston ...{seismo!umcp-cs,ihnp4!rlgvax}!cvl!umd5!zben zben@umd2.ARPA