'=========================================================================== ' Subject: POPUP TSR Date: Unknown Date (00:00) ' Author: Unknown Author(s) Code: PB ' Keys: POPUP,TSR Packet: PB.ABC '=========================================================================== '+----------------------------------------------------------------------+ '| This program demonstrates a complete popup TSR program known | '| as "ASCTSR" which prints an ASCII chart when ALT-A is pressed. | '| In order to run this program do the following: | '| 1. Load PowerBASIC by typing PB at the DOS prompt. | '| 2. Load the file ASCTSR.BAS from the Open option of the | '| File pulldown menu. | '| 3. Compile by pressing ALT-F9 | '| 4. Exit PowerBASIC by pressing ALT-X | '| 5. Type ASCTSR from the DOS prompt | '| 6. Popup the TSR by pressing ALT-A | '| 7. Popdown the TSR by pressing ESC | '| 8. If you desire, un-install the TSR by pressing | '| "q" while it is popped down | '+----------------------------------------------------------------------+ $COMPILE EXE ' this tells PB to make a standalone EXE $LIB IPRINT OFF ' allow graphic characters to print $OPTION CNTLBREAK OFF ' not wise in a tsr x& = SETMEM(-700000) ' release unused memory POPUP KEY CHR$(8,30,247) ' ALT A is the hot key POPUP MULTIPLEX &HC000, 254 ' reg AX and DX get this pattern as an ID REG 1, &HC000 : REG 4, 254 ' set pattern to check for already installed CALL INTERRUPT &H2F ' do the multiplex interrrupt IF REG(1)<>&HC000 AND REG(4)<>254 THEN END 'we were already installed SwapFile$ = LEFT$(CURDIR$,2)+"\ASCTSR.SWP" PRINT "ASCII chart available as ALT-A" REG 1, &HC001 : REG 4, 252 ' Alter AX,DX to show we were here POPUP SLEEP USING EMS, SwapFile$ ' before going to sleep WHILE 1=1 x% = POS : y% = CSRLIN DEF SEG = &hB800 SaveScreen$ = PEEK$(0,4000) ' save the entire screen IF REG(1)=&HC000 AND REG(4)=254 THEN LOCATE 12,20 PRINT "+-------------------------------------+"; LOCATE 13,20 PRINT "| ASCTSR example is already installed |"; LOCATE 14,20 PRINT "+-------------------------------------+"; ELSE GOSUB DisplayAscii END IF a$ = INPUT$(1) 'wait for key to cancel POKE$ 0, SaveScreen$ : LOCATE y%, x% 'restore screen IF UCASE$(A$)="Q" THEN IF POPUP(1) THEN END 'this uninstalls us REG 1, &HC001 : REG 4, 252 ' Alter AX,DX to show we were here POPUP SLEEP ' before going to sleep WEND DisplayAscii: 'put border around GOSUB BorderColor LOCATE 3,23 PRINT"+---------------------------------+"; LOCATE 4,23 PRINT "| PowerBASIC 3.0 can do TSR's! |"; LOCATE 5,23 PRINT "| 0 1 2 3 4 5 6 7 8 9 A B C D E F|"; FOR y=0 TO &hF GOSUB BorderColor LOCATE y+6, 23 PRINT "|";HEX$(y); LOCATE y+6, 57 PRINT "|"; FOR x=0 TO &hF GOSUB FieldColor LOCATE y+6, x*2+25 PRINT " "CHR$(y*16+x); NEXT NEXT GOSUB BorderColor LOCATE 22,23 PRINT"+---------------------------------+"; RETURN BorderColor: COLOR 4,0 RETURN FieldColor: COLOR 6,0 RETURN