ACTION! BUG SHEET #3 - part 1 This document supercedes the previous two bug sheets published for ACTION! November 6, 1984 ------------------------------------- GENERAL INFORMATION Before getting to the bad stuff (the bugs), here are some goodies about ACTION! which we would like to pass on to you: TIPS ON TEMPS A magazine article titled "Lights, Camera, Action!" (by Dave Plotkin) which appeared in the July 1984 issue of ANTIC featured a set of routines to facilitate writing ACTION!-based interrupt handlers. The article gave the listings for two routines (more properly, two DEFINEs) named "SaveTemps" and "GetTemps". These routines are adequate only if no math beyond addition and subtraction is performed in the interrupt service routine. The following versions of these two routines will work properly in the more general case: Make the following DEFINEs in your program before you declare your interrupt routine (comments may be omitted-- they exist only for clari- fication):DEFINE SaveTemps= "[ $A2 $07 ; LDX #7 $B5 $C0 ; LOOP LDA $C0,X $48 ; PHA $B5 $A0 ; LDA $A0,X $48 ; PHA $B5 $80 ; LDA $80,X $48 ; PHA $B5 $A8 ; LDA $A8,X $48 ; PHA $CA ; DEX $10 $F1 ; BPL LOOP $A5 $D3 ; LDA $D3 $48 ; PHA ]" DEFINE GetTemps= "[ $68 ; PLA $85 $D3 ; STA $D3 $A2 $00 ; LDX #0 $68 ; LOOP PLA $95 $A8 ; STA $A8,X $68 ; PLA $95 $80 ; STA $80,X $68 ; PLA $95 $A0 ; STA $A0,X $68 ; PLA $95 $C0 ; STA $C0,X $E8 ; INX $E0 $08 ; CPX #8 $D0 $EF ; BNE LOOP ]" Use these routines inside your interrupt routine as follows: ; Your interrupt routine. PROC InterruptRoutine() ; Local declarations, if any. BYTE a, b, c, etc. ; First line of code within ; procedure SaveTemps ... ; Your interrupt ; code goes here. GetTemps ; Last line of code ; within procedure. [$6C OldVBI] ; A special way to ; end for VBIs- see ; below. For example, the following program will set up the routine ChangeColor as a vertical blank interrupt routine (hit the START key to exit theprogram): DEFINE SaveTemps= "[ $A2 $07 $B5 $C0 $48 $B5 $A0 $48 $B5 $80 $48 $B5 $A8 $48 $CA $10 $F1 $A5 $D3 $48 ]" DEFINE GetTemps= "[ $68 $85 $D3 $A2 $00 $68 $95 $A8 $68 $95 $80 $68 $95 $A0 $68 $95 $C0 $E8 $E0 $08 $D0 $EF ]" CARD OldVBI ; Will hold previous ; contents of vertical ; blank interrupt ; vector. ; This procedure will change the ; background color to random values. ; The main routine will set up this ; code to operate during the ; deferred vertical blank interrupt. PROC ChangeColor() BYTE hue, lum SaveTemps hue = Rand( 16 ) lum = Rand( 16 ) SetColor(2,hue,lum) GetTemps [ $6C OldVBI ] ; Vertical blank ; interrupts must end ; like this ($6C is a ; 6502 indirect jump ; instruction). PROC Test() ; Main routine BYTE critic=$42, ; Critical I/O flag console=$D01F ; Console key ; hardware location CARD VBIvec=$224 ; Deferred vertical ; blank interrupt vector ; You must install a VBI ; routine like this: critic = 1 OldVBI = VBIvec VBIvec = ChangeColor critic = 0 ; ChangeColor is now running ; as the vertical blank interrupt ; routine-- since our mainline ; code has nothing more to do, ; we just go into a loop waiting ; for the START key to be ; pressed. WHILE console&1 DO OD ; Now turn off the VBI routine. critic = 1 VBIvec = OldVBI critic = 0 RETURN This method of saving and restoring ACTION zero page variables may also be used to write BASIC machine language subroutines in ACTION! Your main ACTION routine should then have SaveTemps as the first executable line, and GetTemps as the last executable line before the RETURN statement.