'=========================================================================== ' Subject: UPSIDE DOWN TEXT Date: 02-14-96 (17:29) ' Author: Joseph M. Brooks Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: EGAVGA.ABC '=========================================================================== ' > This is kind of an interesting thought... is there any way, in QB, ' > to shift the screen, so that instead of displaying things ' > horizontally, it'll do it vertically? Or even upside-down? That ' > could be a fun toy to play with... :) ' Bogus Monitor Benchmark Program Version 1.1 by Joseph M. Brooks. ' (C) 1995, All Rights Reserved. ' Permission to use this code within your own program is granted ' free of charge provided I am given appropriate credit within your program. ' Requires EGA or higher video card. ' Initialize Defaults, Constants, and Arrays DEFINT A-Z: OPTION BASE 1 CONST BitPlanes = 4, CharWidth = 8, CharHeight = 14 CONST LeftMostX = 23, TopmostY = 9, LongestLine = 36, MessageLines = 4 DIM NumBits AS LONG, BitHolder(2, 16) ' Calculate minimum size for GET/PUT arrays and DIMension them. X = (LeftMostX - 1) * CharWidth Y = (TopmostY - 1) * CharHeight XOffset = LongestLine * CharWidth - 1 YOffset = MessageLines * CharHeight - 1 NumBits = (XOffset + 1&) * (YOffset + 1&) * BitPlanes NumBytes = CINT(NumBits / 8) NumInts = CINT(NumBytes / 2) RecMax = NumInts + 2 DIM message(RecMax), Message2(RecMax) ' Set screen to 80x25 to make sure GET winds up getting text, not blank ' area of the screen. WIDTH 80, 25 ' Select hidden EGA screen for output, Print Message, GET Message SCREEN 9, , 0, 0 LOCATE 9, 23: PRINT "This computer screen is upside-down." LOCATE 11, 25: PRINT "Please flip over the monitor to" LOCATE 12, 29: PRINT "correct this situation." GET (X, Y)-(X + XOffset, Y + YOffset), message ' Copy first 4 bytes of Message() (size of GET block) into Message2() Message2(1) = message(1): Message2(2) = message(2) ' Select visible screen for output, display bogus set-up message CLS SCREEN 9, , 0, 0 PRINT PRINT "Monitor performance benchmark - please wait while monitor is tested." PRINT SLEEP 1 BEEP PRINT "WARNING! This software has detected an error in your monitor." PRINT "It seems one of the parts was installed upside-down at the factory." PRINT "Please wait while this error is corrected." PRINT "Checking monitor part #" ' Turn Message() image upside-down and store in Message2() (speed counts) FOR I = 3 TO RecMax ' Give user visible indicator program is working LOCATE 7, 24: PRINT I ' Initialize new array element (integer) to store in Message2() NewNum = 0 ' Separte 16-bit integer into separate bits FOR Bit = 1 TO 16 SELECT CASE Bit CASE 1 BitHolder(1, 1) = message(I) AND -32768 CASE 2 BitHolder(1, 2) = message(I) AND &H4000 CASE 3 BitHolder(1, 3) = message(I) AND &H2000 CASE 4 BitHolder(1, 4) = message(I) AND &H1000 CASE 5 BitHolder(1, 5) = message(I) AND &H800 CASE 6 BitHolder(1, 6) = message(I) AND &H400 CASE 7 BitHolder(1, 7) = message(I) AND &H200 CASE 8 BitHolder(1, 8) = message(I) AND &H100 CASE 9 BitHolder(1, 9) = message(I) AND &H80 CASE 10 BitHolder(1, 10) = message(I) AND &H40 CASE 11 BitHolder(1, 11) = message(I) AND &H20 CASE 12 BitHolder(1, 12) = message(I) AND &H10 CASE 13 BitHolder(1, 13) = message(I) AND &H8 CASE 14 BitHolder(1, 14) = message(I) AND &H4 CASE 15 BitHolder(1, 15) = message(I) AND &H2 CASE 16 BitHolder(1, 16) = message(I) AND &H1 END SELECT ' Reverse bits in integer to get new number IF BitHolder(1, Bit) THEN SELECT CASE Bit CASE 1 BitHolder(2, 16) = &H1 CASE 2 BitHolder(2, 15) = &H2 CASE 3 BitHolder(2, 14) = &H4 CASE 4 BitHolder(2, 13) = &H8 CASE 5 BitHolder(2, 12) = &H10 CASE 6 BitHolder(2, 11) = &H20 CASE 7 BitHolder(2, 10) = &H40 CASE 8 BitHolder(2, 9) = &H80 CASE 9 BitHolder(2, 8) = &H100 CASE 10 BitHolder(2, 7) = &H200 CASE 11 BitHolder(2, 6) = &H400 CASE 12 BitHolder(2, 5) = &H800 CASE 13 BitHolder(2, 4) = &H1000 CASE 14 BitHolder(2, 3) = &H2000 CASE 15 BitHolder(2, 2) = &H4000 CASE 16 BitHolder(2, 1) = -32768 END SELECT ELSE BitHolder(2, 16 - Bit + 1) = 0 END IF ' Add component values to get new integer with bits reversed NewNum = NewNum + BitHolder(2, 16 - Bit + 1) NEXT Bit ' Assign value to Message2() array element in reverse order from Message() Message2(RecMax - I + 3) = NewNum NEXT I ' Signal user done and display rest of bogus set-up message BEEP PRINT PRINT "The defective part has been found!" PRINT PRINT "Now implementing solution...." SLEEP 3 ' Deliver punch-line and display upside-down message CLS PUT (X, 350 - Y), Message2, PSET ' Wait for keypress and set screen back before exiting Continue$ = INPUT$(1) SCREEN 0, , 0, 0: SYSTEM