How can I GET and PUT all the screen using 640x480x16colors?
------------------
------------------
%Scrnmax=10 %Scrnsize=12800 DIM VIRTUAL G12Scr(1:%Scrnmax,1:12) AS STRING*%Scrnsize SCREEN 12 CLS FOR Scrn?=1 TO %Scrnmax CLS SCREEN FOR Q?=1 TO 24 LINE (RND(1,639),RND(1,479))-(RND(1,639),RND(1,479)),Q?,BF NEXT Q? LOCATE 30,30 PRINT USING "Screen ##";Scrn?; G12Scrarc Scrn?,0 NEXT Scrn? FOR Scrn?=1 TO %Scrnmax IF INPUT$(1)=CHR$(27) THEN EXIT FOR MTIMER G12Scrdearc Scrn?,0 T???=MTIMER LOCATE 30,1 PRINT USING " ###### msec";T???/1000; NEXT Scrn? END SUB G12Scrarc(BYVAL Q?,BYVAL Page?) DIM G12Scr(MIN,2) AS SHARED STRING*%Scrnsize IF Page? THEN DEF SEG=&HA800 ELSE DEF SEG=&HA000 END IF OUT &H3CE, 4: OUT &H3CF,0 G12Scr(Q?,1)=PEEK$(0,%Scrnsize) 'Blue G12Scr(Q?,2)=PEEK$(%Scrnsize,%Scrnsize) 'Blue G12Scr(Q?,3)=PEEK$(2*%Scrnsize,%Scrnsize) 'Blue OUT &H3CE, 4: OUT &H3CF,1 G12Scr(Q?,4)=PEEK$(0,%Scrnsize) 'Green G12Scr(Q?,5)=PEEK$(%Scrnsize,%Scrnsize) 'Green G12Scr(Q?,6)=PEEK$(2*%Scrnsize,%Scrnsize) 'Green OUT &H3CE, 4: OUT &H3CF,2 G12Scr(Q?,7)=PEEK$(0,%Scrnsize) 'Red G12Scr(Q?,8)=PEEK$(%Scrnsize,%Scrnsize) 'Red G12Scr(Q?,9)=PEEK$(2*%Scrnsize,%Scrnsize) 'Red OUT &H3CE, 4: OUT &H3CF,3 G12Scr(Q?,10)=PEEK$(0,%Scrnsize) 'Intensity G12Scr(Q?,11)=PEEK$(%Scrnsize,%Scrnsize) 'Intensity G12Scr(Q?,12)=PEEK$(2*%Scrnsize,%Scrnsize) 'Intensity OUT &H3CE, 4: OUT &H3C5,&H0 DEF SEG END SUB SUB G12Scrdearc(BYVAL Q?,BYVAL Page?) DIM G12Scr(MIN,2) AS SHARED STRING*%Scrnsize IF Page? THEN DEF SEG=&HA800 ELSE DEF SEG=&HA000 END IF OUT &H3C4, 2: OUT &H3C5, 1 POKE$ 0,G12Scr(Q?,1) 'Blue POKE$ %Scrnsize,G12Scr(Q?,2) 'Blue POKE$ 2*%Scrnsize,G12Scr(Q?,3) 'Blue OUT &H3C4, 2: OUT &H3C5, 2 POKE$ 0,G12Scr(Q?,4) 'Green POKE$ %Scrnsize,G12Scr(Q?,5) 'Green POKE$ 2*%Scrnsize,G12Scr(Q?,6) 'Green OUT &H3C4, 2: OUT &H3C5, 4 POKE$ 0,G12Scr(Q?,7) 'Red POKE$ %Scrnsize,G12Scr(Q?,8) 'Red POKE$ 2*%Scrnsize,G12Scr(Q?,9) 'Red OUT &H3C4, 2: OUT &H3C5, 8 POKE$ 0,G12Scr(Q?,10) 'Intensity POKE$ %Scrnsize,G12Scr(Q?,11) 'Intensity POKE$ 2*%Scrnsize,G12Scr(Q?,12) 'Intensity OUT &H3C4, 2: OUT &H3C5,&HF DEF SEG END SUB
$LIB VGA ON, GRAPH ON DEFINT A-Z %vga = &HA000 'Reserve 64000 bytes for each plane DIM Plane1(0 TO 32000) AS WORD DIM Plane2(0 TO 32000) AS WORD DIM Plane3(0 TO 32000) AS WORD DIM Plane4(0 TO 32000) AS WORD DIM PlaneAddress(0 TO 3) AS SHARED WORD 'Store the segment of each reserved block PlaneAddress(0) = VARSEG( Plane1(0) ) PlaneAddress(1) = VARSEG( Plane2(0) ) PlaneAddress(2) = VARSEG( Plane3(0) ) PlaneAddress(3) = VARSEG( Plane4(0) ) SCREEN 12 'Fill the screen with colored boxes FOR i = 0 TO 100 LINE (i * 2, i * 2)-(639 - i * 2, 479 - i * 2), i MOD 16, B NEXT i LOCATE 15, 31 PRINT "Screen 12 save/restore" WHILE INKEY$ = "": WEND SaveVGA CLS PRINT "Press any key to restore" WHILE INKEY$ = "": WEND LoadVGA WHILE INKEY$ = "": WEND SCREEN 0,0,0 SUB SaveVGA FOR planenr?? = 0 TO 3 'Select plane to read from OUT &H3CE, 4 OUT &H3CF, planenr?? 'And save video memory CopySegment %vga, PlaneAddress(planenr??) NEXT planenr?? 'Reset read plane select OUT &H3CE, 4 OUT &H3CF, 0 END SUB SUB LoadVGA DIM PlaneMask AS LOCAL BYTE 'We need a bit mask to select the planes we want to write to 'This allows us to write to multiple planes at once (default) PlaneMask = &B0001 FOR planenr?? = 0 TO 3 'Select plane to write to OUT &H3C4, 2 OUT &H3C5, PlaneMask 'Load video memory CopySegment PlaneAddress(planenr??), %vga 'Move to next plane SHIFT LEFT PlaneMask, 1 NEXT planenr?? 'Reset write plane select (all) OUT &H3C4, 2 OUT &H3C5, &B1111 END SUB SUB CopySegment (BYVAL source??, BYVAL dest??) PUBLIC ! push ds ! mov es, dest?? ! mov ds, source?? ! xor si, si ! xor di, di ! cld ! mov cx, 32000 ! rep movsw ! pop ds END SUB
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment