1MODE7 10DIM XL 1, YB 1, XR 1, YT 1, Ydiff 1, offset 2, raster 3 20DIM Code &700 30byte = &80 31rast=&82 40FOR Pass = 0 TO 2 STEP 2 50P% = Code 60[OPT Pass 80.InvRaster 90 \ offset = (YT & (\7)) * 80 100 Lda YT 110 And #&F8 120 Tay 130 Lda Times80_lo,Y 140 Sta offset 150 Lda Times80_hi,Y 160 Sta offset+1 170 \ Ydiff + (YT & 7) 180 Lda YT 190 And #7 200 Sta Ydiff 210 \ offset = offset + XL*8 220 Ldy XL 230 Lda Times8_lo,Y 240 Clc: Adc offset 250 Sta offset 260 Lda Times8_hi,Y 270 Adc offset+1 280 Sta offset+1 290 \ offset = offset + &3000 {Screenbase} 300 Adc #&30 310 Sta offset+1 320 \ X = XR-XL 330Lda #19:Jsr &FFF4 340 Lda XR 350 Sec: Sbc XL 360 Pha 370 \ Y = YB - YT 380 Lda YB 390 Sec: Sbc YT 400 Tay 410 Iny 420 \ FOR Y = Y TO 0 STEP -1 430 .forY 440 \ byte = offset 450 Lda offset 460 Sta byte 470 Lda offset+1 480 Sta byte+1 490 \ FOR X = X TO 0 STEP -1 500 Pla:Tax:Pha 510 Tya:Pha 520 Ldy Ydiff 530 .forX 540 \ offset?Ydiff = \offset?Ydiff 550 Lda (byte),Y 560 Eor #&FF 570 Sta (byte),Y 580 \ byte = byte + 8 590 Lda byte 600 Clc: Adc #8 610 Sta byte 620 Bcc nc1 630 Inc byte+1 640 .nc1 650 \ NEXT X 660 Dex 670 Bpl forX 680 Pla:Tay 690 \ Ydiff = (Ydiff + 1) AND 7 700 Lda Ydiff 710 Clc: Adc #1 720 And #7 730 Sta Ydiff 740 \ IF Ydiff = 0 THEN offset = offset + 640 750 Bne not_next_block2 760 Lda offset 770 Clc: Adc #(640 MOD 256) 780 Sta offset 790 Lda offset+1 800 Adc #(640 DIV 256) 810 Sta offset+1 820 .not_next_block2 830 \ NEXT Y 840 Dey 850 Bne forY 860 \ ENDPROC 870 Pla \ X 880 Rts 910.ToRaster 920 \ offset = (YT & (\7)) * 80 930 Lda YT 940 And #&F8 950 Tay 960 Lda Times80_lo,Y 970 Sta offset 980 Lda Times80_hi,Y 990 Sta offset+1 1000 \ Ydiff + (YT & 7) 1010 Lda YT 1020 And #7 1030 Sta Ydiff 1040 \ offset = offset + XL*8 1050 Ldy XL 1060 Lda Times8_lo,Y 1070 Clc: Adc offset 1080 Sta offset 1090 Lda Times8_hi,Y 1100 Adc offset+1 1110 Sta offset+1 1120 \ offset = offset + &3000 {Screenbase} 1130 Adc #&30 1140 Sta offset+1 1150 1160 Lda raster 1170 Sta rast 1180 Lda raster+1 1190 Sta rast+1 1200 1210 \ X = XR-XL 1230 Lda XR 1240 Sec: Sbc XL 1250 Pha 1260 \ Y = YB - YT 1270 Lda YB 1280 Sec: Sbc YT 1290 Tay 1300 Iny 1310 \ FOR Y = Y TO 0 STEP -1 1320 .forY 1330 \ byte = offset 1340 Lda offset 1350 Sta byte 1360 Lda offset+1 1370 Sta byte+1 1380 \ FOR X = X TO 0 STEP -1 1390 Pla:Tax:Pha 1400 Tya:Pha 1410 Ldy Ydiff 1420 Lda rast 1430 Sec: Sbc Ydiff 1440 Sta rast 1450 Lda rast+1 1460 Sbc #0 1470 Sta rast+1 1480 .forX 1490 \ offset?Ydiff = \offset?Ydiff 1500 Lda (byte),Y 1510 Sta (rast),Y 1520 \ byte = byte + 8 1530 Lda byte 1540 Clc: Adc #8 1550 Sta byte 1560 Bcc nc3 1570 Inc byte+1 1580 .nc3 1590 \ raster = raster + 1 1600 Inc rast 1610 Bne nc2 1620 Inc rast+1 1630 .nc2 1640 \ NEXT X 1650 Dex 1660 Bpl forX 1670 Pla:Tay 1680 \ Ydiff = (Ydiff + 1) AND 7 1690 1700 Lda rast 1710 Clc: Adc Ydiff 1720 Sta rast 1730 Lda rast+1 1740 Adc #0 1750 Sta rast+1 1760 1770 Lda Ydiff 1780 Clc: Adc #1 1790 And #7 1800 Sta Ydiff 1810 \ IF Ydiff = 0 THEN offset = offset + 640 1820 Bne not_next_block3 1830 Lda offset 1840 Clc: Adc #(640 MOD 256) 1850 Sta offset 1860 Lda offset+1 1870 Adc #(640 DIV 256) 1880 Sta offset+1 1890 .not_next_block3 1900 \ NEXT Y 1910 Dey 1920 Bne forY 1930 \ ENDPROC 1940 Pla \ X 1950 Rts 1970.FromRaster 1980 \ offset = (YT & (\7)) * 80 1990 Lda YT 2000 And #&F8 2010 Tay 2020 Lda Times80_lo,Y 2030 Sta offset 2040 Lda Times80_hi,Y 2050 Sta offset+1 2060 \ Ydiff + (YT & 7) 2070 Lda YT 2080 And #7 2090 Sta Ydiff 2100 \ offset = offset + XL*8 2110 Ldy XL 2120 Lda Times8_lo,Y 2130 Clc: Adc offset 2140 Sta offset 2150 Lda Times8_hi,Y 2160 Adc offset+1 2170 Sta offset+1 2180 \ offset = offset + &3000 {Screenbase} 2190 Adc #&30 2200 Sta offset+1 2210 2220 Lda raster 2230 Sta rast 2240 Lda raster+1 2250 Sta rast+1 2260 2270 \ X = XR-XL 2280Lda #19:Jsr &FFF4 2290 Lda XR 2300 Sec: Sbc XL 2310 Pha 2320 \ Y = YB - YT 2330 Lda YB 2340 Sec: Sbc YT 2350 Tay 2360 Iny 2370 \ FOR Y = Y TO 0 STEP -1 2380 .forY 2390 \ byte = offset 2400 Lda offset 2410 Sta byte 2420 Lda offset+1 2430 Sta byte+1 2440 \ FOR X = X TO 0 STEP -1 2450 Pla:Tax:Pha 2460 Tya:Pha 2470 Ldy Ydiff 2480 Lda rast 2490 Sec: Sbc Ydiff 2500 Sta rast 2510 Lda rast+1 2520 Sbc #0 2530 Sta rast+1 2540 .forX 2550 \ offset?Ydiff = \offset?Ydiff 2560 Lda (rast),Y 2570 Sta (byte),Y 2580 \ byte = byte + 8 2590 Lda byte 2600 Clc: Adc #8 2610 Sta byte 2620 Bcc nc5 2630 Inc byte+1 2640 .nc5 2650 \ raster = raster + 1 2660 Inc raster 2670 Bne nc4 2680 Inc raster+1 2690 .nc4 2700 \ NEXT X 2710 Dex 2720 Bpl forX 2730 Pla:Tay 2740 \ Ydiff = (Ydiff + 1) AND 7 2750 2760 Lda rast 2770 Clc: Adc Ydiff 2780 Sta rast 2790 Lda rast+1 2800 Adc #0 2810 Sta rast+1 2820 Lda Ydiff 2830 Clc: Adc #1 2840 And #7 2850 Sta Ydiff 2860 \ IF Ydiff = 0 THEN offset = offset + 640 2870 Bne not_next_block 2880 Lda offset 2890 Clc: Adc #(640 MOD 256) 2900 Sta offset 2910 Lda offset+1 2920 Adc #(640 DIV 256) 2930 Sta offset+1 2940 .not_next_block 2950 \ NEXT Y 2960 Dey 2970 Bne forY 2980 \ ENDPROC 2990 Pla \ X 3000 Rts 3020] 3030[OPT Pass:.Times80_lo:] 3040FOR Times = 0 TO 255 3050 [OPT Pass 3060 EQUB (Times*80) MOD 256 3070 ] 3080NEXT Times 3090[OPT Pass:.Times80_hi:] 3100FOR Times = 0 TO 255 3110 [OPT Pass 3120 EQUB (Times*80) DIV 256 3130 ] 3140NEXT Times 3150[OPT Pass:.Times8_lo:] 3160FOR Times = 0 TO 255 3170 [OPT Pass 3180 EQUB (Times*8) MOD 256 3190 ] 3200NEXT Times 3210[OPT Pass:.Times8_hi:] 3220FOR Times = 0 TO 255 3230 [OPT Pass 3240 EQUB (Times*8) DIV 256 3250 ] 3260NEXT Times 3270NEXT Pass 3271MODE1 3280PRINT~&700-(P%-Code);" bytes free." 3290?XL=32 3300?YB=63 3310?XR=48 3320?YT=56 3321!raster = &4000 3330REPEAT 3340?XL=((?XL)+1) MOD 80 3350?XR=(?XL+8) MOD 80 3360?YT=(?YT)+8 3370?YB=(?YT)+32 3380CALL InvRaster 3390CALL InvRaster 3400UNTIL NOT INKEY(0)