In the May issue of 8/16 Central, there was a message originating from America Online in which someone said that they had trouble with Aztec C crashing on the IIgs. Our User Group also had this problem (our bulletin board is written in Aztec C (with an accelerator!!!)). I am posting it on USENET since I don't have access to America Online from New Zealand. Could some kind soul please forward this to AOL. The following solution was discovered by our local guru. ------------------------------------------------------------------- Patch for Aztec C to prevent crashing on the IIgs by David Empson Wellington Apple Users Group of New Zealand The problem: Aztec C doesn't set the stack pointer. Ever. If an interrupt occurs on the IIgs and the stack pointer has to wrap around, Aztec C crashes into the monitor. The solution: since Aztec reloads its shell from disk each time a program exits (including the compiler, linker, etc.), we must patch the shell to reset the stack pointer. This patch will work on any Apple II but is only required for the IIgs (and possibly the enhanced IIe and IIc). The file to patch is SHELL.SYSTEM. For Aztec C v1.99j, it is 22049 ($69A4) bytes long. If you have a different version of the shell, you will have to adjust the code to account for any different addresses involved. As always, make sure you save a copy of the original SHELL.SYSTEM before modifying it in any way. Make sure you have backups of any shell programs or source files you work on until you are satisfied that the new copy of the shell is safe. Perform the following steps in BASIC.SYSTEM. ]BLOAD SHELL.SYSTEM,TSYS,A$2000 ]CALL-151 *2000L 2000- 4C AF 3C JMP $3CAF <- note the JMP address etc. If your copy of SHELL.SYSTEM is a different length, you will need to start the patch at a different location. Calculate the start address of the patch by taking the length of the file in hex, and add $2000. In my case the length is $69A4, so the patch starts at $89A4. *89A4:A2 FF 9A A9 AF 8D 01 20 A9 3C 8D 02 20 4C 00 20 *89A4L 89A4- A2 FF LDX #$FF 89A6- 9A TXS 89A7- A9 AF LDA #$AF <- this is the byte from $2001 89A9- 8D 01 20 STA $2001 89AC- A9 3C LDA #$3C <- this is the byte from $2002 89AE- 8D 02 20 STA $2002 89B1- 4C 00 20 JMP $2000 etc. *2001:A4 89 <- the address of the patch ($89A4) *BSAVE SHELL.SYSTEM,TSYS,A$2000,L$69B4 The new version of the shell is 16 ($10) bytes longer than the original. If your copy of SHELL.SYSTEM was a different length, you will have to adjust the saved length accordingly. DISCLAIMER: This patch worked for me, but I make no guarantee that it will for you. I will not accept any responsibility for lost data, programs, etc. as a result of this patch. Use it at your own risk! Prior to using this patch, I found Aztec was crashing after every four compiles or twelve links. Since I added this patch, Aztec hasn't crashed on me. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= DIGITAL ANALOG ahoney@actrix.gen.nz PO Box 37-208 Allan.Honey@actrix.gen.nz Stokes Valley