Tandy/PCjr Enhancement For "Screen Machine II"
I've just typed in the "Screen Machine II" program for the IBM PC (see COMPUTE!, July, 1986). I am impressed by the program. However, I don't like the delays caused by the use of GET and PUT. To speed up the program's execution, I switched the array UNDO% to a different page in graphics memory, then replaced GET and PUT statements with PCOPY statements. For example, PCOPY 0,1 stores the current picture. PCOPY 1,0 copies the stored image back, and so on. The use of multiple video pages makes the program run significantly faster, particularly when you choose a new tool.
The following program changes work on my 256K Tandy PC-compatible computer with GW-BASIC; they might also work on a 128K Tandy, but I have no way to test that configuration. Enter and save the program lines with the "Automatic Proofreader;" then load your existing copy of "Screen Machine II" and merge the new lines with a MERGE command. For instance, if you saved the new lines with the filename LINES, the command MERGE "LINES" would merge them with the main program. Delete line 410; then save the enhanced program under a new filename.
In addition, you may want to change line 2080 so that the variable SFLAG equals —1 rather than 0. This change prevents you from UNDOing the program's NEW command (ordinarily, a NEW can be recovered with UNDO). The variable SFLAG governs when to copy the screen to the backup screen when the top and bottom command areas are drawn.
LN 140 PCJR = 0 : ON ERROR GOTO 150 : SOUND OFF : CLEAR ,,, 65536! : DEFINT A - Z : PCJR = -1 OH 310 SMODE = 1 : COLR = 1 : SFLAG = -1 : GOSUB 3000 QL 1020 IF MY > = CY THEN COLR = INT(MX/XR#) FOR II = 1 TO 0 STEP-1 : SCREEN ,, II : GOSUB 6000 : NEXT : RETURN JL 1030 PCOPY 0, 1 JD 1250 PCOPY 1, 0 KD 1380 PCOPY 1, 0 DF 1510 GOSUB 3000 : PCOPY 1, 0 GC 2060 GOSUB 19000 : PCOPY 1, 0 : RETURN II 2080 SFLAG = 0 : GOSUB 3000 : RETURN LE 2150 PCOPY 0, 1 : RETURN MH 2190 PCOPY 0, 1 : LINE (0, 0) - (XRES-1, YRES-1), 0, B : LINE(0, 0) - (XRES-1, 8), 0, BF : LINE(0, YRES-12) - (XRES-1, YRES-1), 0, BF MA 2210 ON ERROR GOTO 0 : CLOSE#1 : GOSUB 3000 : PCOPY 1, 0 MN 2250 PCOPY 0, 1 : LINE(0, 0)-(XRES-1, YRES-1), 0, B : LINE(0, 0) - (XRES-1, 8), 0, BF : LINE(0, YRES-12) - (XRES-1, YRES-1), 0, BF CH 2280 GOSUB 3000 : PCOPY 1, 0 : CURSOR = -1 : RETURN ED 3020 SFLAG = -1 : ON SMODE GOSUB 3110, 3150, 3030, 3030, 3190 KH 3080 GOSUB 6000 : GOSUB 12000 : IF SFLAG THEN PCOPY 0, 1 : SFLAG = 0 FP 3110 SCREEN 1, , 0, 0, 2 : COLOR 0, 1 : COLR = 1 : XRES = 320 : YRES = 200 : BG = 0 : MAXCOLOR = 4 BE 3150 SCREEN 2, , 0, 0, 2 : XRES = 640 : YRES = 200 : MAXCOLOR = 2 : COLOR = 1 PB 3190 SCREEN 5, , 0, 0, 2 : XRES = 320 : YRES = 200 : MAXCOLOR = 16 : COLR = 1 QM 4000 GOSUB 19000 : PCOPY 0, 1 JF 4060 PCOPY 1, 0 CN 5510 GOSUB 19000 : PCOPY 0, 1 KD 5570 PCOPY 1,0
Kevin O'Donovan
Thanks for the enhancement, which also works on the PCjr with cartridge BASIC. Since BASICA for the PC does not have a PCOPY command, this method can't be used on the PC or PC-compatible computers whose BASIC doesn't support PCOPY.