'=========================================================================== ' Subject: PAN DEMO Date: 02-09-96 (22:41) ' Author: Douglas Lusher Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: GRAPHICS.ABC '=========================================================================== '>I rechecked the horizontal scroll program I posted the other day and '>it works fine here. But two people have told me they didn't get '>anything. So since it is fairly small I'll repost it after this '>message. Maybe the code got scrambled along the way. ' I saw your code for scrolling and noticed that you were ' having problems with unwanted lines on the bottom of the ' display. Well, here's some similar code that you and the ' others interested can play with that is apparently using ' the same principles. Note that this code allows scrolling ' up and down as well as right and left. This is based on an ' idea I got quite a while ago from someone else in this echo ' - please understand that I have no good explanation as to ' *why* it works or exactly what is going on. DECLARE SUB ColorShow (MaxX%, MaxY%, C%) DECLARE SUB PanVGA () DEFINT A-Z Mode% = 13 SELECT CASE Mode% CASE 1 Horz% = 320: Vert% = 200: Cullers% = 4 CASE 2 Horz% = 640: Vert% = 200: Cullers% = 2 CASE 7 Horz% = 320: Vert% = 200: Cullers% = 16 CASE 8 Horz% = 640: Vert% = 200: Cullers% = 16 CASE 9 Horz% = 640: Vert% = 350: Cullers% = 16 CASE 11 Horz% = 640: Vert% = 480: Cullers% = 2 CASE 12 Horz% = 640: Vert% = 480: Cullers% = 16 CASE 13 Horz% = 320: Vert% = 200: Cullers% = 256 CASE ELSE BEEP: PRINT "Bad screen mode:"; Mode%: END END SELECT PRINT "Press a key to begin puting some graphics on the screen." PRINT "When you feel like it, press any key to stop creating" PRINT "graphics. You may then use the arrow keys to scroll" PRINT "the screen right and left and up and down. Press ESC" PRINT "to end the program." DO UNTIL LEN(INKEY$): LOOP SCREEN Mode% CALL ColorShow(Horz%, Vert%, Cullers%) CALL PanVGA SCREEN 0: WIDTH 80 END SUB ColorShow (MaxX%, MaxY%, C%) 'time the system cpu Start! = TIMER FOR A = 1 TO 5000: Nul! = SQR(3): NEXT Modifier! = (TIMER - Start!) / 2.5 RANDOMIZE TIMER DO X% = RND * MaxX%: Y% = RND * MaxY% SELECT CASE RND CASE IS > .95 FOR A = 1 TO 250 / Modifier! LINE (X%, Y%)-(RND * MaxX%, RND * MaxY%), RND * C% IF LEN(INKEY$) THEN EXIT SUB NEXT CASE IS > .5 LINE (X%, Y%)-(RND * MaxX%, RND * MaxY%), RND * C%, BF CASE ELSE DO: Culler% = RND * C%: LOOP UNTIL Culler% <> POINT(X%, Y%) CIRCLE (X%, Y%), RND * (MaxY% \ 4), Culler% PAINT STEP(0, 0), Culler% END SELECT IF LEN(INKEY$) THEN EXIT SUB LOOP END SUB SUB PanVGA X% = 0: Y% = 0 DO DO WHILE LEN(INKEY$): LOOP DO: KP$ = INKEY$: LOOP UNTIL LEN(KP$) KP% = ASC(KP$): IF KP% = 0 THEN KP% = -ASC(MID$(KP$, 2, 1)) SELECT CASE KP% CASE 27 EXIT DO CASE 52, -75 'Four, LArrow IF X% > 0 THEN X% = X% - 1 CASE 54, -77 'Six, RArrow IF X% < 255 THEN X% = X% + 1 CASE 56, -72 'Eight, UpArrow IF Y% > 0 THEN Y% = Y% - 1 X% = X% + 16: IF X% >= 240 THEN X% = X% - 240 END IF CASE 50, -80 'Two, DnArrow IF Y% < 64 THEN Y% = Y% + 1 X% = X% - 16: IF X% <= 15 THEN X% = X% + 240 END IF END SELECT 'here's where the scrolling takes place: OUT &H3D4, 12: OUT &H3D5, Y% OUT &H3D4, 13: OUT &H3D5, X% LOOP END SUB