This is the routine to swap two characters around in memory. 1299 REM Swap ! 1300 PRINT OVER 1;AT 11,16;" !Highlights the function name. " ! 1310 GO SUB 290: LET dog=a: PRIN!Get the first char, save the T AT 19,4;: GO SUB 1505:: GO SUB!value, and print it to screen, Coff: PRINT " AND ": GO SUB Con!print the prompt and get the : GO SUB 290 !next character. 1315 PRINT AT 19,10;: GO SUB 150!Print that character 5 ! 1320 GO SUB 1500: LET z=a: LET a!Saves the character by defining =137: GO SUB 1800 !'char 137' (A spare one). 1330 LET a=dog: GO SUB 1500: LET!Gets the first char and sends a=z: GO SUB 1800 !it to the second char. area. 1340 GO SUB Gext: PRINT AT 18,12!Gets the saved char and sends ;" ": GO SUB Gon: LET a=dog: GO !it to the first area. SUB 1800 ! 1350 PRINT AT 19,4;" " !Removes the highlighting. 1360 PRINT OVER 1;AT 11,16;" ! " ! 1370 RETURN !Returns. ================================================================ This is the 'view' routine. 1400 PRINT OVER 1;AT 10,16;" !Highlights the function name. " ! 1405 GO SUB Goff: GO SUB 300 !Set normal graphics and get a !character value. 1410 GO SUB 1500: REM PRINT CHR$!Prints the character. ! 1415 IF dflg=0 THEN GO SUB Coff:!If in define mode, then print PRINT AT 18,1;"Char = ";a;" ": !the message in normal chars. GO SUB Con ! 1420 GO SUB 160 !Draws the expanded grid without !reprinting the characters set. 1430 PRINT OVER 1;AT 10,16;" !Removes the highlighting. " ! 1440 RETURN !Returns. ================================================================ The following prints a defined character on the screen. 1499 REM PRINT a character AT 18! ,12 ! 1500 PRINT AT 18,12; !Sets the print position. 1504 REM PRINT a character AT ! last PRINT position ! 1505 IF a>30 THEN PRINT CHR$ a;:!If a normal char., then print RETURN !it and return. 1510 GO SUB Gext !Else.. Select extended graphics 1520 PRINT CHR$ (143-a); !and print the 'spare' char. 1530 GO SUB Goff !Select normal graphics. 1540 RETURN !And return. ================================================================ These routines are to set the character pointers for the various character sets. 1600 POKE 23607,60: RETURN : REM!Selects normal chars. Chars off ! 1610 POKE 23607,ch: RETURN : REM!Selects the defining chars. Chars on ! 1700 POKE 23675,88: POKE 23675,c!Selects normal graphics. h+4:RETURN:REM Graphics off ! 1710 POKE 23676,91:POKE 23675,24!Selects the grid graphic. 8:RETURN:Rem Graphics on ! 1720 POKE 23675,0: POKE 23675,ch!Selects the extended graphics. +4:RETURN:REN Graphics extended ! ================================================================ This copies the definition on the screen to the area of memory for the character. 1810 FOR q=0 TO 7 !Loop for each pixel-line. 1820 POKE FN a(a),PEEK (20556+q*!FN a(a) gives the memory 256) !address for the character and !pixel line. On the screen, each !pixel-line is 256 on from the !last. PEEK (20556+q*256) gives !the value from that memory. 1830 NEXT q !Loop back 8 times. 1840 RETURN !And return. ================================================================ These routines print out the menu for the programs. 1900 GO SUB Coff: PRINT AT 5,16;!For the 'define' routine. "R - RESET"',"Q - SPIN \"',"P - !Prints in normal characters. SPIN /"',"T - TIP"',"I - INVERSE! "',"C - COPY"',"M - MIRROR"'TAB ! 14;"Y,G,H,B - SCROLL"',"S - SUPE! RIMPOSE"'', ! 1910 PRINT "5 - RIGHT"',"6 - DOW! N"',"7 - UP"',"8 - RIGHT"'TAB 12! ;"ENTER - Enters char"''," E -! END" ! 1920 GO SUB Con: RETURN !Selects defining characters and !returns. 2000 GO SUB Coff: PRINT AT 8,16;!For the 'main' menu. "C - Change start"," of charact!Prints in normal characters. ers"',"V - VIEW"',"W - SWAP"',"D! - DEFINE"',"T - Save to/Load"',! " from tape"',"M - Save to/Loa! d"'," from microdrive"',"R - Res! et chars"',"Z - Change Drive"',"! X - CATALOG"',"Q - QUIT"', ! 2020 GO SUB Con: RETURN !Selects defining characters and !returns. ================================================================ These are the saving and loading routines. 2099 REM ******Save/Load********! 2100 PRINT PAPER 8; OVER 1;AT 15!Highlights the correct function -2*sfg,16;" "',("!name on the value of sfg. " AND SFG);(" " AND NOT! SFG);" " ! 2110 GO SUB Coff: PRINT AT 21,0;!Selects normal characters and "Load or Save? (L/S) ENTER to en!prints the prompt. d" ! 2115 GO SUB 400 !Waits for the key. 2120 IF q$="L" THEN GO TO 2200 !Goes to the corrects place for 2130 IF q$<>"S" THEN RETURN !the key-press. 2139 REM ******Save******** ! 2140 PRINT AT 21,0;" "; FLASH!Highlights the function name. 1;" SAVE "; FLASH 0;" ! " ! 2142 GO SUB 2250: REM Get file n!Gets the filename ame ! 2145 IF LEN n$=0 THEN GO TO 2140!Rejects invalid names. 2150 IF sfg THEN SAVE n$CODE sta!Save to tape is sfg=1 rt,1024: RETURN ! 2160 SAVE *"m";drv;n$CODE start,!Else save to microdrive. 1024: RETURN ! 2199 REM ******Load******** ! 2200 PRINT AT 21,0;" "; FLASH!Highlight the function name. 1;" LOAD "; FLASH 0;" ! 2205 GO SUB 2250: REM Get file n!Gets the filename. ame ! 2210 IF sfg THEN LOAD n$CODE sta!Load from tape if sfg=0 rt: RETURN ! 2220 LOAD *"m";drv;n$CODE start:!Else load from microdrive. RETURN ! 2249 REM *****Get file name*****! ** ! 2250 GO SUB Coff: INPUT "What fi!Select normal chars. and ask le name?", LINE n$ !for the name. 2260 RETURN !Return. ================================================================ These routines scroll the small grid around in various directions. For each row, the first pixel is saved and the rest are moved along. Then then the saved pixel is added onto the end. This is the same way that all the scrolling routines work. 2299 REM ******R-Scroll******** ! 2300 PRINT OVER 1;AT 12,18;" !Highlights the function name. " ! 2305 FOR q=7 TO 0 STEP -1: LET d!Loop though and save the first og=POINT (103,31-q) !pixel. 2310 FOR w=6 TO 0 STEP -1 !Loop through the other pixels. 2320 PLOT INVERSE NOT POINT (w+9! 6,31-q);w+97,31-q ! 2330 NEXT w: PLOT INVERSE NOT do!Loop, then set the last pixel. g;96,31-q ! 2340 NEXT q !Loop for each row. 2350 PRINT OVER 1;AT 12,18;" !Remove the highlighting. " ! 2360 RETURN !And return. 2399 REM ******L-Scroll******** ! 2400 PRINT OVER 1;AT 12,16;" ! " !Similarly for Left scrolling. 2405 FOR q=0 TO 7: LET dog=POINT! (96,31-q) ! 2410 FOR w=1 TO 7 ! 2420 PLOT INVERSE NOT POINT (96+! w,31-q);95+w,31-q ! 2430 NEXT w: PLOT INVERSE NOT do! g;103,31-q ! 2440 NEXT q ! 2450 PRINT OVER 1;AT 12,16;" ! " ! 2460 RETURN ! 2499 REM ******U-Scroll******** ! 2500 PRINT OVER 1;AT 12,14;" ! " !And Up scrolling. 2505 FOR q=0 TO 7: LET dog=POINT! (q+96,31) ! 2510 FOR w=1 TO 7 ! 2520 PLOT INVERSE NOT POINT (q+9! 6,31-w);q+96,32-w ! 2530 NEXT w: PLOT INVERSE NOT do! g;96+q,24 ! 2540 NEXT q ! 2550 PRINT OVER 1;AT 12,14;" ! " ! 2560 RETURN ! 2599 REM ******D-Scroll******** ! 2600 PRINT OVER 1;AT 12,20;" ! " !And down-scrolling. 2605 FOR q=0 TO 7: LET dog=POINT! (q+96,24) ! 2610 FOR w=6 TO 0 STEP -1 ! 2620 PLOT INVERSE NOT POINT (q+9! 6,31-w);q+96,30-w ! 2630 NEXT w: PLOT INVERSE NOT do! g;96+q,31 ! 2640 NEXT q ! 2650 PRINT OVER 1;AT 12,20;" ! " ! 2660 RETURN ! ================================================================ These routines spin the grid around the diagonal axes. For each row from the diagonal, the 'read' pointer goes up, while the 'write' cursor goes across. Each pixel is then swapped with the one on the other side of the diagonal. The diagonal line of pixels remains unchanged. Th same method is used for both spin routines. 2699 REM ******Spin /******** ! 2700 PRINT OVER 1;AT 7,20;" !Highlights the function name. " ! 2705 FOR q=1 TO 7: FOR w=q-1 TO !Loop through the rows, and the 7 !pixels. 2710 LET dog=POINT (95+q,25+w): !Saves the value of the first PLOT INVERSE NOT POINT (97+w,23+!pixel and sets it with the q);95+q,25+w !value of the second. 2720 PLOT INVERSE NOT dog;97+w,2!Sets the second pixel with the 3+q !value of the first. 2730 NEXT w: NEXT q !Loops back. 2750 PRINT OVER 1;AT 7,20;" !Remove the highlighting. " ! 2760 RETURN !And return. ================================================================ This routine reflects across the verticle axis. For each pixel-row, the pointers loop in from each side towards the middle. The values of th pixels are then swapped around. 2809 REM ******Mirror******** ! 2810 PRINT OVER 1;AT 11,20;" !Highlights the function name. " ! 2815 FOR q=0 TO 3: FOR w=0 TO 7 !Loops inwards and upwards. 2820 LET dog=POINT (96+q,24+w): !Saves the value of the first PLOT INVERSE NOT POINT (103-q,w+!pixel and sets that pixel to 24);96+q,24+w !the value of the second pixel. 2830 PLOT INVERSE NOT dog;103-q,!Sets the second pixel to the w+24 !value saved from the first pixel. 2840 NEXT w: NEXT q !Loop back for the rest. 2850 PRINT OVER 1;AT 11,20;" !Remove the highlighting. " ! 2860 RETURN !And return. ================================================================ This routine reflects about the horizontal axis. For each pixel row from the top and bottom, the values of the screen memory are swapped round. The routine does this by 'defining' the character to memory and manipulating with that. 2899 REM ****** Tip ****** ! 2900 PRINT OVER 1;AT 8,20;" " !Highlight the function name. 2905 LET z=a: LET a=137: GO SUB !Save the character value and 1800: REM SCREEN$ TO mem !'define' the grid to character !137. (a spare one). 2910 FOR q=0 TO 7 !Loop around for each pixel-row. 2920 POKE 20556+256*q,PEEK (FN a!Set the screen line with that (a+1)-2*q-1) !of the line in memory going the !other way. 2930 NEXT q !Loop back. 2935 LET a=z !Restore the character value. 2940 PRINT OVER 1;AT 8,20;" " !Remove the highlighting. 2950 RETURN !And return. ================================================================ This routine inverts the grid by doing '255-x' on each pixel-line on the small grid to flip the bits. 2999 REM ******Inverse****** ! 3000 PRINT OVER 1;AT 9,20;" !Highlight the function name. " ! 3005 FOR q=0 TO 7 !Loop round for each pixel-row. 3010 POKE 20556+256*q,255-PEEK (!Flip the bits. 20556+256*q) ! 3020 NEXT q !Loop back. 3030 PRINT OVER 1;AT 9,20;" !Remove the highlighting. " ! 3040 RETURN !And return. ================================================================