now there are no strings in the program at all, except for the COMMAND$ variable.
i also rearranged some lines of code and changed a few line labels to make the labels more understandable.
i also put in a line of code to check if the command line was empty or not, if empty, then not let the program load.
the program now only takes up about 34528 bytes of memory without any swapping memory to either EMS memory or disk.
MCM's code implemented
Code:
$DIM ALL REM TSRFSCRN.BAS REM TSR WILL SEND THE SCREEN TEXT TO A FILE GIVEN ON THE COMMAND LINE REM WHEN THE F12 IS PRESSED REM POWERBASIC SOURCE CODE REM VERSION 01-02-2010 REM COMPILED WITH POWERBASIC 3.5 FOR DOS $CPU 80386 'program works on only 386 CPU and above $DEBUG MAP OFF 'turn off map file generation $DEBUG PBDEBUG OFF 'don't include pbdebug support in our executable $LIB all OFF 'turn off all PowerBASIC's libraries. $ERROR BOUNDS OFF 'turn on bounds checking $ERROR NUMERIC OFF 'turn off numeric checking $ERROR OVERFLOW OFF 'turn off overflow checking $ERROR STACK OFF 'turn off stack checking $FLOAT NPX 'use floating point hardware only $COM 0 'set communications buffer to nothing $STRING 1 'set largest string size at 1k $STACK 1536 'let's use a 1536 byte stack $SOUND 0 'smallest music buffer possible $DYNAMIC 'all arrays will be dynamic by default $OPTION CNTLBREAK OFF 'don't allow Ctrl-Break to exit program $OPTION GOSUB OFF 'don't preserve GOSUB stack on error $COMPILE EXE 'this tells PB to make a standalone EXE $EVENT OFF DIM I AS INTEGER DIM X AS LONG DIM J AS INTEGER DIM VIDEOBASE AS BYTE PTR VIDEOBASE=&HB800??*65536?? IF LEN(COMMAND$)=0% THEN END REM CTRL-ALT P POPUP KEY CHR$(12,&H19,&H73) REM ALT P POPUP KEY CHR$(&H08,&H19,&H70) REM CTRL- P POPUP KEY CHR$(04,&H19,&H73) REM POPUP KEY CHR$(&H08,&H19,&H7B) POPUP KEY CHR$(0,&H58,247) ' F12 is the hot key ON ERROR RESUME NEXT X = SETMEM( -700000 ) 'release unused memory REM THE NEXT TO LINES OF CODE ARE IF YOU WANT TO CREATE THE FILE WHEN THIS REM PROGRAM FIRST LOADS UP THE TSR REM THE DEFAULT METHOD IS NOT CREATE THE FILE, THE TWO LINES ARE REMARKED OUT REM X=18& REM GOTO READANDWRITESCREENTEXT REM PUTTING TO TSR TO SLEEP PUTTSRTOSLEEP: POPUP SLEEP 'going to sleep till X=18& REM here begins the loop writing screen text to a file on tsr popup READANDWRITESCREENTEXT: REM ABORT SAVING THE SCREENTEXT TO THE FILE IF X=0 IF X=0& THEN GOTO PUTTSRTOSLEEP ERRCLEAR J=(pbvScrnRows * pbvScrnCols*2) - 1 KILL COMMAND$ OPEN COMMAND$ FOR BINARY AS #1 FOR I = 0 TO J STEP 2 PUT #1,, @VIDEOBASE[I] NEXT CLOSE #1 IF ERR THEN SLEEP .04 DECR X GOTO READANDWRITESCREENTEXT END IF GOTO PUTTSRTOSLEEP END
Leave a comment: