'This is the strangest program I've ever written, but it is the most dramatic 'demonstration of interrupt handling I can put into 50-75 lines of code. This 'program intercepts the clock-tick "user" interrupt 1C, which is invoked 18 'times per second. Every time it is invoked, we paint the entire screen blue 'with white text. Then we SHELL to DOS. The neat thing about our INT1C 'routine is that it keeps executing even when we are in a DOS shell, thus 'allowing us to run any text-based program (like PB or dBASE or PDS, etc) in 'this color. Some of you will be inspired by the implications of this, others 'will not get the point. Making things turn blue is not the ends. This just 'shows you what incredibly neat things you can do with PowerBASIC. -Erik '==============================[PUT THIS NEAR BEGINNING OF PROGRAM]======== $LIB ALL OFF $ERROR ALL OFF $STRING 1'.............use these metastatements to shrink memory requirement $COM 0 SG??=CODESEG(INT1C) '.......................INT5 is a label in this program PR??=CODEPTR(INT1C) GetInterruptVector &H1C,SG1C??,PR1C?? '.........Get the OLD handler pointers '..............................Point the new INT1C vector to our asm routine SetInterruptVector &H1C,SG??,PR?? SHELL '...................Now shell to DOS, while our handler remains active SetInterruptVector &H1C,SG1C??,PR1C?? 'restore old vectors (you MUST do this SetInterruptVector &H23,SG23??,PR23?? 'before you exit the program or POOF!) PRINT "Later on, Man" END ' ************************************************************************** 'This intercepts INT1C, turns everything blue, and then IRETs INT1C: ! PUSH AX ; Save the whales ! PUSH BX ! PUSH CX ! PUSH DX ! PUSH SI ! PUSH DI ! PUSH BP ! PUSH DS ! PUSH ES ! MOV AX,&HB800 ; Color video RAM segment ! PUSH AX ; push video RAM segment ! POP ES ; Pop it into ES ! MOV AL,&H17 ; Color (1=blue, 7=white) attribute ! MOV BX,1 ; first offset attribute in vid ram ! PUSH BX ; push it ! POP DI ; and pop it out into DI ! MOV CX,2000 ; number of attributes in video RAM Loop1: ! MOV ES:[DI],AL ; Put the addribute into video RAM ! INC DI ; increment our pointer to text byte ! INC DI ; increment again to next attribute byte ! LOOP LOOP1 ; loop number of times in CX ! POP ES ; Restore my heart ! POP DS ! POP BP ! POP DI ! POP SI ! POP DX ! POP CX ! POP BX ! POP AX ! IRET ; Interrupt RETurn ' ************************************************************************** SUB SetInterruptVector(Intr%,Segment??,Offset??) REG 1,&H2500 + Intr% REG 4,Offset?? REG 8,Segment?? CALL INTERRUPT &H21 END SUB SUB GetInterruptVector(Intr%,S??,O??) REG 1,&H3500 + Intr% CALL INTERRUPT &H21 S??=REG(9) O??=REG(2) END SUB