1000 ; COMPRESSION ROUTINES 1010 ; ENCODE(START,LENGTH,FNUM) 1020 ; DECODE(START,LENGTH,FNUM) 1030 ; COMPRESS IN MEMORY FOR SPEED 1040 ; FORMAT... 2 BYTES FOR COMP LEN 1050 ; FOLLOWED BY COMPRESSED BITMAP 1060 *= $6D40 ;FOR SCOPE,MORPH 1065 *= $A400 ;FOR CELLS 1070 MPTR = $D6 1080 BUFFER = $8000 ;FOR SCOPE,MORPH 1085 BUFFER = $5300 ;FOR CELLS 1090 PTR = $D4 1100 FNUM = $D8 1110 V0 = $D9 1120 V1 = $DA 1130 V2 = $DB 1140 V3 = $DC 1150 CIOV = $E456 1160 JMP ENCODE 1170 JMP DECODE 1175 BEG = $60 1180 LEN = $62 1190 END = $DD 1200 CLEN = $5A 1310 GETPAR LDY #0 1320 LDA ($C6),Y 1330 STA PTR 1335 STA BEG 1340 INY 1350 LDA ($C6),Y 1360 STA PTR+1 1365 STA BEG+1 1370 INY 1380 LDA ($C6),Y 1390 STA END 1400 INY 1410 LDA ($C6),Y 1420 STA END+1 1430 CLC 1440 LDA PTR 1450 ADC END 1460 STA END 1470 LDA PTR+1 1480 ADC END+1 1490 STA END+1 1500 INY 1510 LDA ($C6),Y 1520 ASL A 1530 ASL A 1540 ASL A 1550 ASL A 1560 STA FNUM 1562 LDA #0 1565 STA V2 1570 RTS 1580 DECODE JSR GETPAR 1590 JSR CHKIN 1600 DE00A JSR GETBYTE 1610 CMP #254 1620 BNE DE01 1630 JSR GETBYTE 1640 STA V0 1650 JSR GETBYTE 1660 STA V3 1670 LDY #0 1680 DE00B LDA V0 1690 STA (PTR),Y 1700 JSR DE02 1710 DEC V3 1720 BNE DE00B 1730 JMP DE00A 1740 DE01 LDY #0 1750 STA (PTR),Y 1760 JSR DE02 1770 JMP DE00A 1780 DE02 JSR INC40 1810 DE02A LDA PTR+1 1820 CMP END+1 1830 BMI DE02C 1840 LDA PTR 1850 CMP END 1860 BMI DE02C 1862 JSR INC1 1865 BNE DE02C 1870 PLA 1880 PLA 1890 DE02C RTS 1900 ENCODE JSR GETPAR 1910 JSR CHKOUT 1920 LDY #0 1930 LDA (PTR),Y 1940 STA V0 1950 JSR INC40 1980 EN00A LDA #1 1990 STA V3 2000 EN01 LDY #0 2010 LDA V0 2020 STA V1 2030 LDA (PTR),Y 2040 STA V0 2050 JSR EN03 2060 JSR INC40 2090 EN02 LDA PTR+1 2100 CMP END+1 2110 BMI EN01 2120 LDA PTR 2130 CMP END 2140 BMI EN01 2142 JSR INC1 2145 BNE EN01 2150 JSR EN04 2160 JMP SAVEIT 2170 EN03 LDA V0 2180 CMP V1 2190 BNE EN04 2200 INC V3 2210 BNE EN03A 2220 DEC V3 2230 JMP EN06 2240 EN03A RTS 2250 EN04 LDA V3 2260 CMP #1 2270 BNE EN05 2280 JSR EN07 2290 RTS 2300 EN05 CMP #2 2310 BNE EN06 2320 JSR EN07 2330 JSR EN07 2340 LDA #1 2350 STA V3 2360 RTS 2370 EN06 LDA #254 2380 JSR PUTBYTE 2390 LDA V1 2400 JSR PUTBYTE 2410 LDA V3 2420 JSR PUTBYTE 2430 LDA #1 2440 STA V3 2450 RTS 2460 EN07 LDA V1 2470 CMP #254 2480 BNE EN08 2490 JSR PUTBYTE 2500 LDA #254 2510 JSR PUTBYTE 2520 LDA #1 2530 EN08 JSR PUTBYTE 2540 RTS 2550 CHKIN LDX FNUM 2560 LDA #$07 2570 STA $0342,X 2580 LDA #0 2590 STA $0348,X 2600 STA $0349,X 2610 JSR CIOV 2620 STA CLEN 2630 JSR CIOV 2640 STA CLEN+1 2650 LDA CLEN 2660 STA $0348,X 2670 LDA CLEN+1 2680 STA $0349,X 2690 LDA # <BUFFER 2700 STA $0344,X 2710 STA MPTR 2720 LDA # >BUFFER 2730 STA $0345,X 2740 STA MPTR+1 2750 JSR CIOV 2760 RTS 2770 GETBYTE LDY #0 2780 LDA (MPTR),Y 2790 GB0 INC MPTR 2800 BNE GB1 2810 INC MPTR+1 2820 GB1 RTS 2830 CHKOUT LDA # <BUFFER 2840 STA MPTR 2850 LDA # >BUFFER 2860 STA MPTR+1 2870 RTS 2880 PUTBYTE LDY #0 2890 STA (MPTR),Y 2900 JMP GB0 2910 SAVEIT SEC 2920 LDA MPTR 2930 SBC # <BUFFER 2940 STA CLEN 2950 LDA MPTR+1 2960 SBC # >BUFFER 2970 STA CLEN+1 2980 LDX FNUM 2990 LDA #$0B 3000 STA $0342,X 3010 LDA #0 3020 STA $0348,X 3030 STA $0349,X 3040 LDA CLEN 3050 JSR CIOV 3060 LDA CLEN+1 3070 JSR CIOV 3080 LDA CLEN 3090 STA $0348,X 3100 LDA CLEN+1 3110 STA $0349,X 3120 LDA # <BUFFER 3130 STA $0344,X 3140 LDA # >BUFFER 3150 STA $0345,X 3160 JSR CIOV 3170 RTS 3180 INC40 CLC 3190 LDA PTR 3200 ADC #40 3210 STA PTR 3220 LDA PTR+1 3230 ADC #0 3240 STA PTR+1 3250 RTS 3260 INC1 INC V2 3270 CLC 3280 LDA BEG 3290 ADC V2 3300 STA PTR 3310 LDA BEG+1 3320 ADC #0 3330 STA PTR+1 3340 LDA V2 3350 CMP #40 3360 RTS 3370 ZZZ