10 LET yos=0 20 LET c$=STRING$(100,"~") 30 LET ad=LENGTH(0,c$) 40 LOAD "modes.c"CODE ad 50 REM **** PRESS SPACE to exit from MC **** 60 REM Store code in a string (c$) to prevent program or variables from overw riting it 70 80 MODE 4: CLS #: LET xrg=256 90 POKE ad+7,0: REM (ad+7) normally = 243, ie, disable interrupts, but this means that palette line changes will also be disabled. Too many palette li ne changes, or key presses, may disrupt the routine. 100 110 CSIZE 8,8 120 LET yos=0 130 LOAD "modes.$"SCREEN$ 140 PALETTE 2,14 150 PALETTE 2,14 LINE 50 : PALETTE 3, 112 LINE 50 160 FOR n=-16 TO 52: PLOT 0,n: DRAW PEN n MOD 16;255,0: NEXT n 170 PRINT #1; AT 0,10; "Press SPACE" 180 POKE ad+1,192-69: REM bottom of mode 3 section 190 POKE ad+3,192-152: REM top of mode 3 section 200 210 REM Note that 0 is at the top of the screen 220 230 FOR n=1 TO 5 240 CALL ad 250 PALETTE 3,RND(127) 260 PALETTE 2,RND(127) 270 POW 280 NEXT n 290 MODE 4: CLS # 300 LOAD "mandelA.$"SCREEN$ 310 PRINT #0; AT 0,0; PAPER 0; PEN 15;"Press SPACE" 320 PALETTE 3,127 LINE -1 330 PUT 0,-10,a$ 340 FOR n=1 TO 8 350 POKE ad+1,192-RND(175) 360 POKE ad+3,192-RND(175) 370 POW 380 CALL ad 390 NEXT n 400 MODE 3: CLS #: 410 RESTORE 440 : FOR n=0 TO 15: READ a: PALETTE n,a LINE 70: NEXT n 420 RESTORE 430: FOR n=0 TO 15: READ a: PALETTE n,a LINE 18: NEXT n 430 DATA 0,0,1,9,16,17,19,25,27,23,29,81,83,89,85,93 440 DATA 0,40,32,1,64,72,2,99,9,17,27,31,61,39,4,119 450 POKE SVAR 64,3 460 LET yos=0,xrg=256 470 FOR n=0 TO 255 STEP 32: FOR m=0 TO 15: PEN m: PLOT n+m,-16: DRAW 0,16: NEX T m: FOR m=16 TO 31: PEN 32-m: PLOT n+m,-16: DRAW 0,16: NEXT m: NEXT n 480 PUT 0,70,e1$: PUT 128,70,e2$ 490 POKE SVAR 64,2 500 PAPER 0: PEN 3 510 CSIZE 8,8: PUT 0,175,b$ 520 WINDOW 0,63,4,11 530 PRINT "This MODESWITCHER lets you switch mode anywhere in a screen - sotha t you can have areas of graphics and 80 column text on screenat once." 540 PRINT '"The code is fully relocatable, and can be placed in addresses 32 768-65535 - unlike, eg, SHRINKER. POKE (ad+1) with the bottom of the area to be in MODE 3 (0 is at the top: 191 is at the bottom), and (ad+3) wi th the top of this area. Press " 550 LET ad=LENGTH(0,c$) 560 POKE ad+1,192-82: POKE ad+3,192-165: 570 FOR n=80 TO 165 STEP 8: PALETTE 3,(n/10)+80 LINE n: NEXT n 580 CALL ad 590 PRINT AT 0,0;"Normally, (ad+7)=243, which disables interrupts, so that the edges of the mode sections are straight. However, if you want toset up palette areas, using the LINE function, you will have to POKE (ad+7) with 0. " 600 PRINT " This routine uses the HPEN and LPEN I/O ports to time th e mode switching correctly, but by using a simple program suchas that give n at the end of the listing, you can create ": PRINT "different effects . " 610 CALL ad 611 FOR n=80 TO 165 STEP 8: PALETTE 3 LINE n: NEXT n 612 CSIZE 6,8 613 WINDOW 0,84,4,11: POKE SVAR 0,"~": POKE UDG "~",255,255,255,255,255,255,25 5,255 614 CLS 1: LET m=10: SCROLL CLEAR 620 LIST m TO m+50 635 CALL ad 640 CLS 1: LET m=m+50: IF m>700 THEN GO TO 700 650 GO TO 615 700 MODE 3: CLS #: CSIZE 8,8: 705 PRINT "NOW HAVE A LOOK AT THE LISTING": POKE SVAR 0,">" 706 ZAP : REM **** PRESS SPACE! **** 710 711 REM **** PRESS SPACE **** 1000 REM IN A,(252) ;get video page 1010 1020 REM ; port 252 gives: 1030 REM ;BIT7 BIT6 BIT5 BIT4 BIT3 BIT2 BIT1 BIT0 1040 REM ;midi mode1 mode0 bank page8 page4 page2 page1 1050 REM ; We want to change BIT 5 and BIT 6 1051 1060 REM SET 5,A 1070 REM LOOP: SET 6,A 1080 REM OUT (252),A ; this gives mode4 1090 REM RES 6,A 1100 REM OUT (252),A ; this give mode3 1110 REM JR LOOP ; repeat 1111 1120 REM Obviously some kind of delay is needed is needed before each loop to slow the loop down.