'=========================================================================== ' Subject: FLIP UPSIDE DOWN LONG GET-ARRAY Date: 01-07-99 (12:34) ' Author: Jacob Wieles Code: QB, PDS, PB ' Origin: jacwls@worldonline.nl Packet: GRAPHICS.ABC '=========================================================================== 'program : T-B-LNG.BAS (05-01-99) ' : Set a picture upside down with movement of data in ' a long-integer GET-array. 'which basic : PowerBASIC and - with remout $huge - Q(uick)BASIC 'auteur : Jacob Wieles $huge ' a must for PowerBASIC 3.5 deflng a-z screen 12 xL=0 xR=311 yT=0 yB=419 x=xR-xL+1 y=yB-yT+1 locate 2,1 print" xL = 0 xR = 311" print" yT = 0 yB = 419" print print" x = xR-xL+1 =";x print" y = yB-yT+1 =";y locate 10,1 print" because x is a" print" multiple of eight :" print" reqsize=1+x/8*y" print print" line(xL,yT)-(xR,yB),10,b" print" line(xL+x/2,0)-(xR,yB),10" print print" dim scrnarr(reqsize-1)." print" get (xL,yT)-(xR,yB),scrnarr" reqsize=1+x/8*y dim scrnarr(reqsize-1) line(xL,yT)-(xR,yB),10,b line(xL+x/2,0)-(xR,yB),10 get (xL,yT)-(xR,yB),scrnarr locate 20,2 color 10 while inkey$<>"":wend print"Hit a key for next." hitakey$=input$(1) cls locate 2,1 print" Hit a key for the 'up side down' picture with :" print color 14 print" epxl=x/8 'array elements per x-line" print print" for i=1 to y\2 'x-lines upper half change" print" 'with x-lines lower half" print" for j=0 to epxl-1" print" swap scrnarr(1+(i-1)*epxl+j), scrnarr(reqsize-i*epxl+j)" print" next j" print" next i" print" cls print" put (96,0),scrnarr print color 10 print" Notes :" print print" x =";x,"y =";y print" array elements per x-line =";x\8 print" x-lines to change =";y\2 print '================>> making xy$ with PowerBASIC 'fill$="00000000000000000000000000000000" 'xy$=right$(fill$+bin$(scrnarr(0)),32) '================================================== '================>> making xy$ with Q(uick)BASIC xy$="" number=scrnarr(0) for i=31 to 0 step -1 if number/2^i<1 then xy$=xy$+"0" end if if number=2^i then xy$=xy$+"1" number=0 end if if number/2^i>1 then xy$=xy$+"1" number=number-2^i end if next i '============================================== print" Binary format of scrnarr(0) = ";xy$ print yfig=0 for i=1 to 16 yfig=yfig+val(mid$(xy$,i,1))*2^(16-i) next i print" Value left part (";left$(xy$,16);") =";yfig;" (is equal to y)" xfig=0 for i=1 to 16 xfig=xfig+val(mid$(xy$,16+i,1))*2^(16-i) next i print" Value right part (";right$(xy$,16);") =";xfig;" (is equal to x)" while inkey$<>"":wend hitakey$=input$(1) cls epxl=x/8 'array elements per xline for i=1 to y\2 'lines upper half change for j=0 to epxl-1 'with lines lower half swap scrnarr(1+(i-1)*epxl+j), scrnarr(reqsize-i*epxl+j) next j next i cls put (96,0),scrnarr color 12 locate 4,14 while inkey$<>"":wend print"Hit a key for the end." hitakey$=input$(1) cls screen 0 print"Hit a key for the source."