Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_53.ADF » U/COMPRE2

U/COMPRE2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_53.ADF
Filename: U/COMPRE2
Read OK:
File size: 0DD1 bytes
Load address: FFFF1D00
Exec address: FFFF802B
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
   10REM ** Text compression **
   20REM C.R.Dewhurst 5/4/2000
   30MODE6:VDU23;8202;0;0;0;
   40input=&70
   50output=&72
   60inptr=&74
   70outptr=&75
   80from=&76
   90mask=&78
  100oswrch=&FFEE
  110:
  120FOR pass=0 TO 2 STEP 2
  130P%=&900
  140[OPT pass
  150.compress
  160LDA #0
  170STA inptr
  180STA outptr
  190STA mask
  200:
  210.cloop LDY inptr
  220LDA (input),Y
  230CMP #13:BNE notend
  240LDA #2:JMP wrtnib
  250.notend STY inptr
  260PHA
  270JSR chktok  \token?
  280BNE nottok
  290LDA #1:JSR wrtnib
  300LDA tokno:JSR wrtnib
  310PLA:BNE cloop \always
  320.nottok PLA
  330INC inptr
  340JSR chkcomm  \common letter?
  350BMI notcomm
  360TYA:JSR wrtnib
  370JMP cloop
  380.notcomm JSR chkrare  \rare letter?
  390BPL okay
  400BRK
  410EQUB &FF
  420EQUS "Illegal chararacter"
  430BRK
  440.okay STY from
  450LDA #0:JSR wrtnib  \0=next nibble a rare letter
  460LDA from:JSR wrtnib
  470JMP cloop
  480:
  490.chktok
  500LDA input:CLC:ADC inptr:STA input
  510LDA #0:STA tokno:STA inptr
  520ADC input+1:STA input+1
  530LDA #toktab MOD 256:STA from
  540LDA #toktab DIV 256:STA from+1
  550.ctloop LDY #0
  560LDA (from),Y
  570BPL notend2  \&FF=end of table
  580RTS
  590.notend2 STA toklen:TAX
  600INC from:BNE ctloop2:INC from+1
  610.ctloop2 LDA (input),Y
  620CMP (from),Y
  630BNE notfnd
  640INY:DEX:BNE ctloop2
  650STY inptr
  660RTS  \matched
  670.notfnd INC tokno
  680LDA from:CLC:ADC toklen:STA from
  690BCC noc:INC from+1:.noc
  700JMP ctloop \always
  710.toklen BRK
  720.tokno BRK
  730:
  740.chkcomm
  750LDX #commtab MOD 256
  760LDY #commtab DIV 256
  770JMP scantab
  780:
  790.chkrare
  800LDX #raretab MOD 256
  810LDY #raretab DIV 256
  820:
  830.scantab
  840STX from
  850STY from+1
  860LDY #15
  870.stloop CMP (from),Y
  880BEQ match
  890DEY:BPL stloop
  900.match
  910\so N=1=fail N=0=found
  920RTS
  930:
  940.wrtnib
  950LDY outptr
  960LDX mask
  970BEQ left
  980INC mask  \now =0
  990ORA (output),Y
 1000STA (output),Y
 1010INC outptr
 1020RTS
 1030.left ASLA:ASLA:ASLA:ASLA
 1040STA (output),Y
 1050DEC mask  \now =&FF
 1060RTS
 1070:
 1080.commtab
 1090EQUW 0:BRK
 1100\0=next nibble a rare letter
 1110\1=token
 1120\2=end of text
 1130\3-15=common letter:
 1140EQUS "etaonrishdlf "
 1150.raretab
 1160EQUS "cmugypwbvkxjqz,."
 1170.toktab
 1180]
 1190RESTORE 2030
 1200FOR W%=0 TO 15:READ word$
 1210[OPT pass
 1220EQUB (LEN word$)
 1230EQUS word$
 1240]
 1250NEXT
 1260[OPT pass
 1270EQUB &FF
 1280:
 1290.expand
 1300LDA #0:STA mask
 1310STA inptr
 1320.eloop
 1330JSR getnib
 1340TAX:BNE notrar2
 1350JSR getnib
 1360LDX #raretab MOD 256
 1370LDY #raretab DIV 256
 1380JSR print
 1390JMP eloop
 1400.notrar2 DEX
 1410BNE nottok2
 1420JSR getnib
 1430JSR outtok
 1440JMP eloop
 1450.nottok2 DEX
 1460BNE notend3
 1470RTS
 1480.notend3 LDX #commtab MOD 256
 1490LDY #commtab DIV 256
 1500JSR print
 1510JMP eloop
 1520:
 1530.outtok
 1540TAX
 1550LDA #toktab MOD 256:STA from
 1560LDA #toktab DIV 256:STA from+1
 1570.otloop
 1580LDY #0:LDA (from),Y
 1590STA toklen
 1600DEX:BMI gottok
 1610CLC:ADC from:ADC #1:STA from
 1620LDA from+1:ADC #0:STA from+1
 1630BCC otloop \always
 1640.gottok LDY #1
 1650LDX toklen
 1660.gtloop LDA (from),Y
 1670JSR oswrch
 1680INY:DEX:BPL gtloop
 1690RTS
 1700.print
 1710STX from:STY from+1
 1720TAY:LDA (from),Y
 1730JMP oswrch
 1740:
 1750.getnib
 1760LDY inptr
 1770LDA (input),Y
 1780LDX mask
 1790BNE right
 1800LSRA:LSRA:LSRA:LSRA
 1810AND #15
 1820DEC mask  \now =&FF
 1830RTS
 1840.right AND #15
 1850INC mask  \now =0
 1860INC inptr
 1870RTS
 1880]
 1890NEXT
 1900 
 1910DIM intext% &100,outtext% &100
 1920INPUT LINE'"Type in some text",$intext%
 1930oldlen%=LEN $intext%
 1940!input=intext%
 1950!output=outtext%
 1960CALL compress
 1970newlen%=?outptr
 1980PRINT'"Original length:";oldlen%
 1990PRINT'"Compacted length:";newlen%
 2000PRINT'"Compaction factor:";100-newlen%/oldlen%*100;"%"
 2010!input=outtext%
 2020CALL expand
 2030DATA and,but,by,can,for,get,less,more,she,that,they,the,this,was,who,you

� ** Text compression **
� C.R.Dewhurst 5/4/2000
�6:�23;8202;0;0;0;
(
input=&70
2output=&72
<
inptr=&74
Foutptr=&75
Pfrom=&76
Zmask=&78
doswrch=&FFEE
n:
x� pass=0 � 2 � 2
�P%=&900
�
[OPT pass
�
.compress
�
LDA #0
�
STA inptr
�STA outptr
�STA mask
�:
�.cloop LDY inptr
�LDA (input),Y
�CMP #13:BNE notend
�LDA #2:JMP wrtnib
�.notend STY inptr
PHA
JSR chktok  \token?
BNE nottok
"LDA #1:JSR wrtnib
,LDA tokno:JSR wrtnib
6PLA:BNE cloop \always
@.nottok PLA
J
INC inptr
T JSR chkcomm  \common letter?
^BMI notcomm
hTYA:JSR wrtnib
r
JMP cloop
|'.notcomm JSR chkrare  \rare letter?
�BPL okay
�BRK
�EQUB &FF
�EQUS "Illegal chararacter"
�BRK
�.okay STY from
�3LDA #0:JSR wrtnib  \0=next nibble a rare letter
�LDA from:JSR wrtnib
�
JMP cloop
�:
�.chktok
�%LDA input:CLC:ADC inptr:STA input
�LDA #0:STA tokno:STA inptr
ADC input+1:STA input+1
LDA #toktab � 256:STA from
 LDA #toktab � 256:STA from+1
&.ctloop LDY #0
0LDA (from),Y
:"BPL notend2  \&FF=end of table
DRTS
N.notend2 STA toklen:TAX
X#INC from:BNE ctloop2:INC from+1
b.ctloop2 LDA (input),Y
lCMP (from),Y
vBNE notfnd
�INY:DEX:BNE ctloop2
�
STY inptr
�RTS  \matched
�.notfnd INC tokno
�$LDA from:CLC:ADC toklen:STA from
�BCC noc:INC from+1:.noc
�JMP ctloop \always
�.toklen BRK
�.tokno BRK
�:
�.chkcomm
�LDX #commtab � 256
�LDY #commtab � 256
JMP scantab
:
.chkrare
 LDX #raretab � 256
*LDY #raretab � 256
4:
>.scantab
HSTX from
RSTY from+1
\LDY #15
f.stloop CMP (from),Y
p
BEQ match
zDEY:BPL stloop
�
.match
�\so N=1=fail N=0=found
�RTS
�:
�.wrtnib
�LDY outptr
�LDX mask
�BEQ left
�INC mask  \now =0
��A (output),Y
�STA (output),Y
�INC outptr
�RTS
.left ASLA:ASLA:ASLA:ASLA
STA (output),Y
DEC mask  \now =&FF
$RTS
.:
8.commtab
BEQUW 0:BRK
L \0=next nibble a rare letter
V\1=token
`\2=end of text
j\3-15=common letter:
tEQUS "etaonrishdlf "
~.raretab
�EQUS "cmugypwbvkxjqz,."
�.toktab
�]
�
� �dnG
�� W%=0 � 15:� word$
�
[OPT pass
�EQUB (� word$)
�EQUS word$
�]
��
�
[OPT pass
�EQUB &FF
:

.expand
LDA #0:STA mask

STA inptr
(
.eloop
2JSR getnib
<TAX:BNE notrar2
FJSR getnib
PLDX #raretab � 256
ZLDY #raretab � 256
d
JSR print
n
JMP eloop
x.notrar2 DEX
�BNE nottok2
�JSR getnib
�JSR outtok
�
JMP eloop
�.nottok2 DEX
�BNE notend3
�RTS
�.notend3 LDX #commtab � 256
�LDY #commtab � 256
�
JSR print
�
JMP eloop
�:
�.outtok
TAX
LDA #toktab � 256:STA from
 LDA #toktab � 256:STA from+1
".otloop
,LDY #0:LDA (from),Y
6STA toklen
@DEX:BMI gottok
J CLC:ADC from:ADC #1:STA from
T LDA from+1:ADC #0:STA from+1
^BCC otloop \always
h.gottok LDY #1
rLDX toklen
|.gtloop LDA (from),Y
�JSR oswrch
�INY:DEX:BPL gtloop
�RTS
�
.print
�STX from:STY from+1
�TAY:LDA (from),Y
�JMP oswrch
�:
�.getnib
�
LDY inptr
�LDA (input),Y
�LDX mask
�
BNE right
LSRA:LSRA:LSRA:LSRA
	� #15
DEC mask  \now =&FF
&RTS
0.right � #15
:INC mask  \now =0
D
INC inptr
NRTS
X]
b�
l 
v � intext% &100,outtext% &100
�$� �'"Type in some text",$intext%
�oldlen%=� $intext%
�!input=intext%
�!output=outtext%
�� compress
�newlen%=?outptr
� �'"Original length:";oldlen%
�!�'"Compacted length:";newlen%
�6�'"Compaction factor:";100-newlen%/oldlen%*100;"%"
�!input=outtext%
�� expand
�I� and,but,by,can,for,get,less,more,she,that,they,the,this,was,who,you
�
00000000  0d 00 0a 1c f4 20 2a 2a  20 54 65 78 74 20 63 6f  |..... ** Text co|
00000010  6d 70 72 65 73 73 69 6f  6e 20 2a 2a 0d 00 14 1b  |mpression **....|
00000020  f4 20 43 2e 52 2e 44 65  77 68 75 72 73 74 20 35  |. C.R.Dewhurst 5|
00000030  2f 34 2f 32 30 30 30 0d  00 1e 16 eb 36 3a ef 32  |/4/2000.....6:.2|
00000040  33 3b 38 32 30 32 3b 30  3b 30 3b 30 3b 0d 00 28  |3;8202;0;0;0;..(|
00000050  0d 69 6e 70 75 74 3d 26  37 30 0d 00 32 0e 6f 75  |.input=&70..2.ou|
00000060  74 70 75 74 3d 26 37 32  0d 00 3c 0d 69 6e 70 74  |tput=&72..<.inpt|
00000070  72 3d 26 37 34 0d 00 46  0e 6f 75 74 70 74 72 3d  |r=&74..F.outptr=|
00000080  26 37 35 0d 00 50 0c 66  72 6f 6d 3d 26 37 36 0d  |&75..P.from=&76.|
00000090  00 5a 0c 6d 61 73 6b 3d  26 37 38 0d 00 64 10 6f  |.Z.mask=&78..d.o|
000000a0  73 77 72 63 68 3d 26 46  46 45 45 0d 00 6e 05 3a  |swrch=&FFEE..n.:|
000000b0  0d 00 78 14 e3 20 70 61  73 73 3d 30 20 b8 20 32  |..x.. pass=0 . 2|
000000c0  20 88 20 32 0d 00 82 0b  50 25 3d 26 39 30 30 0d  | . 2....P%=&900.|
000000d0  00 8c 0d 5b 4f 50 54 20  70 61 73 73 0d 00 96 0d  |...[OPT pass....|
000000e0  2e 63 6f 6d 70 72 65 73  73 0d 00 a0 0a 4c 44 41  |.compress....LDA|
000000f0  20 23 30 0d 00 aa 0d 53  54 41 20 69 6e 70 74 72  | #0....STA inptr|
00000100  0d 00 b4 0e 53 54 41 20  6f 75 74 70 74 72 0d 00  |....STA outptr..|
00000110  be 0c 53 54 41 20 6d 61  73 6b 0d 00 c8 05 3a 0d  |..STA mask....:.|
00000120  00 d2 14 2e 63 6c 6f 6f  70 20 4c 44 59 20 69 6e  |....cloop LDY in|
00000130  70 74 72 0d 00 dc 11 4c  44 41 20 28 69 6e 70 75  |ptr....LDA (inpu|
00000140  74 29 2c 59 0d 00 e6 16  43 4d 50 20 23 31 33 3a  |t),Y....CMP #13:|
00000150  42 4e 45 20 6e 6f 74 65  6e 64 0d 00 f0 15 4c 44  |BNE notend....LD|
00000160  41 20 23 32 3a 4a 4d 50  20 77 72 74 6e 69 62 0d  |A #2:JMP wrtnib.|
00000170  00 fa 15 2e 6e 6f 74 65  6e 64 20 53 54 59 20 69  |....notend STY i|
00000180  6e 70 74 72 0d 01 04 07  50 48 41 0d 01 0e 17 4a  |nptr....PHA....J|
00000190  53 52 20 63 68 6b 74 6f  6b 20 20 5c 74 6f 6b 65  |SR chktok  \toke|
000001a0  6e 3f 0d 01 18 0e 42 4e  45 20 6e 6f 74 74 6f 6b  |n?....BNE nottok|
000001b0  0d 01 22 15 4c 44 41 20  23 31 3a 4a 53 52 20 77  |..".LDA #1:JSR w|
000001c0  72 74 6e 69 62 0d 01 2c  18 4c 44 41 20 74 6f 6b  |rtnib..,.LDA tok|
000001d0  6e 6f 3a 4a 53 52 20 77  72 74 6e 69 62 0d 01 36  |no:JSR wrtnib..6|
000001e0  19 50 4c 41 3a 42 4e 45  20 63 6c 6f 6f 70 20 5c  |.PLA:BNE cloop \|
000001f0  61 6c 77 61 79 73 0d 01  40 0f 2e 6e 6f 74 74 6f  |always..@..notto|
00000200  6b 20 50 4c 41 0d 01 4a  0d 49 4e 43 20 69 6e 70  |k PLA..J.INC inp|
00000210  74 72 0d 01 54 20 4a 53  52 20 63 68 6b 63 6f 6d  |tr..T JSR chkcom|
00000220  6d 20 20 5c 63 6f 6d 6d  6f 6e 20 6c 65 74 74 65  |m  \common lette|
00000230  72 3f 0d 01 5e 0f 42 4d  49 20 6e 6f 74 63 6f 6d  |r?..^.BMI notcom|
00000240  6d 0d 01 68 12 54 59 41  3a 4a 53 52 20 77 72 74  |m..h.TYA:JSR wrt|
00000250  6e 69 62 0d 01 72 0d 4a  4d 50 20 63 6c 6f 6f 70  |nib..r.JMP cloop|
00000260  0d 01 7c 27 2e 6e 6f 74  63 6f 6d 6d 20 4a 53 52  |..|'.notcomm JSR|
00000270  20 63 68 6b 72 61 72 65  20 20 5c 72 61 72 65 20  | chkrare  \rare |
00000280  6c 65 74 74 65 72 3f 0d  01 86 0c 42 50 4c 20 6f  |letter?....BPL o|
00000290  6b 61 79 0d 01 90 07 42  52 4b 0d 01 9a 0c 45 51  |kay....BRK....EQ|
000002a0  55 42 20 26 46 46 0d 01  a4 1e 45 51 55 53 20 22  |UB &FF....EQUS "|
000002b0  49 6c 6c 65 67 61 6c 20  63 68 61 72 61 72 61 63  |Illegal chararac|
000002c0  74 65 72 22 0d 01 ae 07  42 52 4b 0d 01 b8 12 2e  |ter"....BRK.....|
000002d0  6f 6b 61 79 20 53 54 59  20 66 72 6f 6d 0d 01 c2  |okay STY from...|
000002e0  33 4c 44 41 20 23 30 3a  4a 53 52 20 77 72 74 6e  |3LDA #0:JSR wrtn|
000002f0  69 62 20 20 5c 30 3d 6e  65 78 74 20 6e 69 62 62  |ib  \0=next nibb|
00000300  6c 65 20 61 20 72 61 72  65 20 6c 65 74 74 65 72  |le a rare letter|
00000310  0d 01 cc 17 4c 44 41 20  66 72 6f 6d 3a 4a 53 52  |....LDA from:JSR|
00000320  20 77 72 74 6e 69 62 0d  01 d6 0d 4a 4d 50 20 63  | wrtnib....JMP c|
00000330  6c 6f 6f 70 0d 01 e0 05  3a 0d 01 ea 0b 2e 63 68  |loop....:.....ch|
00000340  6b 74 6f 6b 0d 01 f4 25  4c 44 41 20 69 6e 70 75  |ktok...%LDA inpu|
00000350  74 3a 43 4c 43 3a 41 44  43 20 69 6e 70 74 72 3a  |t:CLC:ADC inptr:|
00000360  53 54 41 20 69 6e 70 75  74 0d 01 fe 1e 4c 44 41  |STA input....LDA|
00000370  20 23 30 3a 53 54 41 20  74 6f 6b 6e 6f 3a 53 54  | #0:STA tokno:ST|
00000380  41 20 69 6e 70 74 72 0d  02 08 1b 41 44 43 20 69  |A inptr....ADC i|
00000390  6e 70 75 74 2b 31 3a 53  54 41 20 69 6e 70 75 74  |nput+1:STA input|
000003a0  2b 31 0d 02 12 1e 4c 44  41 20 23 74 6f 6b 74 61  |+1....LDA #tokta|
000003b0  62 20 83 20 32 35 36 3a  53 54 41 20 66 72 6f 6d  |b . 256:STA from|
000003c0  0d 02 1c 20 4c 44 41 20  23 74 6f 6b 74 61 62 20  |... LDA #toktab |
000003d0  81 20 32 35 36 3a 53 54  41 20 66 72 6f 6d 2b 31  |. 256:STA from+1|
000003e0  0d 02 26 12 2e 63 74 6c  6f 6f 70 20 4c 44 59 20  |..&..ctloop LDY |
000003f0  23 30 0d 02 30 10 4c 44  41 20 28 66 72 6f 6d 29  |#0..0.LDA (from)|
00000400  2c 59 0d 02 3a 22 42 50  4c 20 6e 6f 74 65 6e 64  |,Y..:"BPL notend|
00000410  32 20 20 5c 26 46 46 3d  65 6e 64 20 6f 66 20 74  |2  \&FF=end of t|
00000420  61 62 6c 65 0d 02 44 07  52 54 53 0d 02 4e 1b 2e  |able..D.RTS..N..|
00000430  6e 6f 74 65 6e 64 32 20  53 54 41 20 74 6f 6b 6c  |notend2 STA tokl|
00000440  65 6e 3a 54 41 58 0d 02  58 23 49 4e 43 20 66 72  |en:TAX..X#INC fr|
00000450  6f 6d 3a 42 4e 45 20 63  74 6c 6f 6f 70 32 3a 49  |om:BNE ctloop2:I|
00000460  4e 43 20 66 72 6f 6d 2b  31 0d 02 62 1a 2e 63 74  |NC from+1..b..ct|
00000470  6c 6f 6f 70 32 20 4c 44  41 20 28 69 6e 70 75 74  |loop2 LDA (input|
00000480  29 2c 59 0d 02 6c 10 43  4d 50 20 28 66 72 6f 6d  |),Y..l.CMP (from|
00000490  29 2c 59 0d 02 76 0e 42  4e 45 20 6e 6f 74 66 6e  |),Y..v.BNE notfn|
000004a0  64 0d 02 80 17 49 4e 59  3a 44 45 58 3a 42 4e 45  |d....INY:DEX:BNE|
000004b0  20 63 74 6c 6f 6f 70 32  0d 02 8a 0d 53 54 59 20  | ctloop2....STY |
000004c0  69 6e 70 74 72 0d 02 94  11 52 54 53 20 20 5c 6d  |inptr....RTS  \m|
000004d0  61 74 63 68 65 64 0d 02  9e 15 2e 6e 6f 74 66 6e  |atched.....notfn|
000004e0  64 20 49 4e 43 20 74 6f  6b 6e 6f 0d 02 a8 24 4c  |d INC tokno...$L|
000004f0  44 41 20 66 72 6f 6d 3a  43 4c 43 3a 41 44 43 20  |DA from:CLC:ADC |
00000500  74 6f 6b 6c 65 6e 3a 53  54 41 20 66 72 6f 6d 0d  |toklen:STA from.|
00000510  02 b2 1b 42 43 43 20 6e  6f 63 3a 49 4e 43 20 66  |...BCC noc:INC f|
00000520  72 6f 6d 2b 31 3a 2e 6e  6f 63 0d 02 bc 16 4a 4d  |rom+1:.noc....JM|
00000530  50 20 63 74 6c 6f 6f 70  20 5c 61 6c 77 61 79 73  |P ctloop \always|
00000540  0d 02 c6 0f 2e 74 6f 6b  6c 65 6e 20 42 52 4b 0d  |.....toklen BRK.|
00000550  02 d0 0e 2e 74 6f 6b 6e  6f 20 42 52 4b 0d 02 da  |....tokno BRK...|
00000560  05 3a 0d 02 e4 0c 2e 63  68 6b 63 6f 6d 6d 0d 02  |.:.....chkcomm..|
00000570  ee 16 4c 44 58 20 23 63  6f 6d 6d 74 61 62 20 83  |..LDX #commtab .|
00000580  20 32 35 36 0d 02 f8 16  4c 44 59 20 23 63 6f 6d  | 256....LDY #com|
00000590  6d 74 61 62 20 81 20 32  35 36 0d 03 02 0f 4a 4d  |mtab . 256....JM|
000005a0  50 20 73 63 61 6e 74 61  62 0d 03 0c 05 3a 0d 03  |P scantab....:..|
000005b0  16 0c 2e 63 68 6b 72 61  72 65 0d 03 20 16 4c 44  |...chkrare.. .LD|
000005c0  58 20 23 72 61 72 65 74  61 62 20 83 20 32 35 36  |X #raretab . 256|
000005d0  0d 03 2a 16 4c 44 59 20  23 72 61 72 65 74 61 62  |..*.LDY #raretab|
000005e0  20 81 20 32 35 36 0d 03  34 05 3a 0d 03 3e 0c 2e  | . 256..4.:..>..|
000005f0  73 63 61 6e 74 61 62 0d  03 48 0c 53 54 58 20 66  |scantab..H.STX f|
00000600  72 6f 6d 0d 03 52 0e 53  54 59 20 66 72 6f 6d 2b  |rom..R.STY from+|
00000610  31 0d 03 5c 0b 4c 44 59  20 23 31 35 0d 03 66 18  |1..\.LDY #15..f.|
00000620  2e 73 74 6c 6f 6f 70 20  43 4d 50 20 28 66 72 6f  |.stloop CMP (fro|
00000630  6d 29 2c 59 0d 03 70 0d  42 45 51 20 6d 61 74 63  |m),Y..p.BEQ matc|
00000640  68 0d 03 7a 12 44 45 59  3a 42 50 4c 20 73 74 6c  |h..z.DEY:BPL stl|
00000650  6f 6f 70 0d 03 84 0a 2e  6d 61 74 63 68 0d 03 8e  |oop.....match...|
00000660  1a 5c 73 6f 20 4e 3d 31  3d 66 61 69 6c 20 4e 3d  |.\so N=1=fail N=|
00000670  30 3d 66 6f 75 6e 64 0d  03 98 07 52 54 53 0d 03  |0=found....RTS..|
00000680  a2 05 3a 0d 03 ac 0b 2e  77 72 74 6e 69 62 0d 03  |..:.....wrtnib..|
00000690  b6 0e 4c 44 59 20 6f 75  74 70 74 72 0d 03 c0 0c  |..LDY outptr....|
000006a0  4c 44 58 20 6d 61 73 6b  0d 03 ca 0c 42 45 51 20  |LDX mask....BEQ |
000006b0  6c 65 66 74 0d 03 d4 15  49 4e 43 20 6d 61 73 6b  |left....INC mask|
000006c0  20 20 5c 6e 6f 77 20 3d  30 0d 03 de 11 84 41 20  |  \now =0.....A |
000006d0  28 6f 75 74 70 75 74 29  2c 59 0d 03 e8 12 53 54  |(output),Y....ST|
000006e0  41 20 28 6f 75 74 70 75  74 29 2c 59 0d 03 f2 0e  |A (output),Y....|
000006f0  49 4e 43 20 6f 75 74 70  74 72 0d 03 fc 07 52 54  |INC outptr....RT|
00000700  53 0d 04 06 1d 2e 6c 65  66 74 20 41 53 4c 41 3a  |S.....left ASLA:|
00000710  41 53 4c 41 3a 41 53 4c  41 3a 41 53 4c 41 0d 04  |ASLA:ASLA:ASLA..|
00000720  10 12 53 54 41 20 28 6f  75 74 70 75 74 29 2c 59  |..STA (output),Y|
00000730  0d 04 1a 17 44 45 43 20  6d 61 73 6b 20 20 5c 6e  |....DEC mask  \n|
00000740  6f 77 20 3d 26 46 46 0d  04 24 07 52 54 53 0d 04  |ow =&FF..$.RTS..|
00000750  2e 05 3a 0d 04 38 0c 2e  63 6f 6d 6d 74 61 62 0d  |..:..8..commtab.|
00000760  04 42 0e 45 51 55 57 20  30 3a 42 52 4b 0d 04 4c  |.B.EQUW 0:BRK..L|
00000770  20 5c 30 3d 6e 65 78 74  20 6e 69 62 62 6c 65 20  | \0=next nibble |
00000780  61 20 72 61 72 65 20 6c  65 74 74 65 72 0d 04 56  |a rare letter..V|
00000790  0c 5c 31 3d 74 6f 6b 65  6e 0d 04 60 12 5c 32 3d  |.\1=token..`.\2=|
000007a0  65 6e 64 20 6f 66 20 74  65 78 74 0d 04 6a 18 5c  |end of text..j.\|
000007b0  33 2d 31 35 3d 63 6f 6d  6d 6f 6e 20 6c 65 74 74  |3-15=common lett|
000007c0  65 72 3a 0d 04 74 18 45  51 55 53 20 22 65 74 61  |er:..t.EQUS "eta|
000007d0  6f 6e 72 69 73 68 64 6c  66 20 22 0d 04 7e 0c 2e  |onrishdlf "..~..|
000007e0  72 61 72 65 74 61 62 0d  04 88 1b 45 51 55 53 20  |raretab....EQUS |
000007f0  22 63 6d 75 67 79 70 77  62 76 6b 78 6a 71 7a 2c  |"cmugypwbvkxjqz,|
00000800  2e 22 0d 04 92 0b 2e 74  6f 6b 74 61 62 0d 04 9c  |.".....toktab...|
00000810  05 5d 0d 04 a6 0a f7 20  8d 64 6e 47 0d 04 b0 17  |.]..... .dnG....|
00000820  e3 20 57 25 3d 30 20 b8  20 31 35 3a f3 20 77 6f  |. W%=0 . 15:. wo|
00000830  72 64 24 0d 04 ba 0d 5b  4f 50 54 20 70 61 73 73  |rd$....[OPT pass|
00000840  0d 04 c4 12 45 51 55 42  20 28 a9 20 77 6f 72 64  |....EQUB (. word|
00000850  24 29 0d 04 ce 0e 45 51  55 53 20 77 6f 72 64 24  |$)....EQUS word$|
00000860  0d 04 d8 05 5d 0d 04 e2  05 ed 0d 04 ec 0d 5b 4f  |....].........[O|
00000870  50 54 20 70 61 73 73 0d  04 f6 0c 45 51 55 42 20  |PT pass....EQUB |
00000880  26 46 46 0d 05 00 05 3a  0d 05 0a 0b 2e 65 78 70  |&FF....:.....exp|
00000890  61 6e 64 0d 05 14 13 4c  44 41 20 23 30 3a 53 54  |and....LDA #0:ST|
000008a0  41 20 6d 61 73 6b 0d 05  1e 0d 53 54 41 20 69 6e  |A mask....STA in|
000008b0  70 74 72 0d 05 28 0a 2e  65 6c 6f 6f 70 0d 05 32  |ptr..(..eloop..2|
000008c0  0e 4a 53 52 20 67 65 74  6e 69 62 0d 05 3c 13 54  |.JSR getnib..<.T|
000008d0  41 58 3a 42 4e 45 20 6e  6f 74 72 61 72 32 0d 05  |AX:BNE notrar2..|
000008e0  46 0e 4a 53 52 20 67 65  74 6e 69 62 0d 05 50 16  |F.JSR getnib..P.|
000008f0  4c 44 58 20 23 72 61 72  65 74 61 62 20 83 20 32  |LDX #raretab . 2|
00000900  35 36 0d 05 5a 16 4c 44  59 20 23 72 61 72 65 74  |56..Z.LDY #raret|
00000910  61 62 20 81 20 32 35 36  0d 05 64 0d 4a 53 52 20  |ab . 256..d.JSR |
00000920  70 72 69 6e 74 0d 05 6e  0d 4a 4d 50 20 65 6c 6f  |print..n.JMP elo|
00000930  6f 70 0d 05 78 10 2e 6e  6f 74 72 61 72 32 20 44  |op..x..notrar2 D|
00000940  45 58 0d 05 82 0f 42 4e  45 20 6e 6f 74 74 6f 6b  |EX....BNE nottok|
00000950  32 0d 05 8c 0e 4a 53 52  20 67 65 74 6e 69 62 0d  |2....JSR getnib.|
00000960  05 96 0e 4a 53 52 20 6f  75 74 74 6f 6b 0d 05 a0  |...JSR outtok...|
00000970  0d 4a 4d 50 20 65 6c 6f  6f 70 0d 05 aa 10 2e 6e  |.JMP eloop.....n|
00000980  6f 74 74 6f 6b 32 20 44  45 58 0d 05 b4 0f 42 4e  |ottok2 DEX....BN|
00000990  45 20 6e 6f 74 65 6e 64  33 0d 05 be 07 52 54 53  |E notend3....RTS|
000009a0  0d 05 c8 1f 2e 6e 6f 74  65 6e 64 33 20 4c 44 58  |.....notend3 LDX|
000009b0  20 23 63 6f 6d 6d 74 61  62 20 83 20 32 35 36 0d  | #commtab . 256.|
000009c0  05 d2 16 4c 44 59 20 23  63 6f 6d 6d 74 61 62 20  |...LDY #commtab |
000009d0  81 20 32 35 36 0d 05 dc  0d 4a 53 52 20 70 72 69  |. 256....JSR pri|
000009e0  6e 74 0d 05 e6 0d 4a 4d  50 20 65 6c 6f 6f 70 0d  |nt....JMP eloop.|
000009f0  05 f0 05 3a 0d 05 fa 0b  2e 6f 75 74 74 6f 6b 0d  |...:.....outtok.|
00000a00  06 04 07 54 41 58 0d 06  0e 1e 4c 44 41 20 23 74  |...TAX....LDA #t|
00000a10  6f 6b 74 61 62 20 83 20  32 35 36 3a 53 54 41 20  |oktab . 256:STA |
00000a20  66 72 6f 6d 0d 06 18 20  4c 44 41 20 23 74 6f 6b  |from... LDA #tok|
00000a30  74 61 62 20 81 20 32 35  36 3a 53 54 41 20 66 72  |tab . 256:STA fr|
00000a40  6f 6d 2b 31 0d 06 22 0b  2e 6f 74 6c 6f 6f 70 0d  |om+1.."..otloop.|
00000a50  06 2c 17 4c 44 59 20 23  30 3a 4c 44 41 20 28 66  |.,.LDY #0:LDA (f|
00000a60  72 6f 6d 29 2c 59 0d 06  36 0e 53 54 41 20 74 6f  |rom),Y..6.STA to|
00000a70  6b 6c 65 6e 0d 06 40 12  44 45 58 3a 42 4d 49 20  |klen..@.DEX:BMI |
00000a80  67 6f 74 74 6f 6b 0d 06  4a 20 43 4c 43 3a 41 44  |gottok..J CLC:AD|
00000a90  43 20 66 72 6f 6d 3a 41  44 43 20 23 31 3a 53 54  |C from:ADC #1:ST|
00000aa0  41 20 66 72 6f 6d 0d 06  54 20 4c 44 41 20 66 72  |A from..T LDA fr|
00000ab0  6f 6d 2b 31 3a 41 44 43  20 23 30 3a 53 54 41 20  |om+1:ADC #0:STA |
00000ac0  66 72 6f 6d 2b 31 0d 06  5e 16 42 43 43 20 6f 74  |from+1..^.BCC ot|
00000ad0  6c 6f 6f 70 20 5c 61 6c  77 61 79 73 0d 06 68 12  |loop \always..h.|
00000ae0  2e 67 6f 74 74 6f 6b 20  4c 44 59 20 23 31 0d 06  |.gottok LDY #1..|
00000af0  72 0e 4c 44 58 20 74 6f  6b 6c 65 6e 0d 06 7c 18  |r.LDX toklen..|.|
00000b00  2e 67 74 6c 6f 6f 70 20  4c 44 41 20 28 66 72 6f  |.gtloop LDA (fro|
00000b10  6d 29 2c 59 0d 06 86 0e  4a 53 52 20 6f 73 77 72  |m),Y....JSR oswr|
00000b20  63 68 0d 06 90 16 49 4e  59 3a 44 45 58 3a 42 50  |ch....INY:DEX:BP|
00000b30  4c 20 67 74 6c 6f 6f 70  0d 06 9a 07 52 54 53 0d  |L gtloop....RTS.|
00000b40  06 a4 0a 2e 70 72 69 6e  74 0d 06 ae 17 53 54 58  |....print....STX|
00000b50  20 66 72 6f 6d 3a 53 54  59 20 66 72 6f 6d 2b 31  | from:STY from+1|
00000b60  0d 06 b8 14 54 41 59 3a  4c 44 41 20 28 66 72 6f  |....TAY:LDA (fro|
00000b70  6d 29 2c 59 0d 06 c2 0e  4a 4d 50 20 6f 73 77 72  |m),Y....JMP oswr|
00000b80  63 68 0d 06 cc 05 3a 0d  06 d6 0b 2e 67 65 74 6e  |ch....:.....getn|
00000b90  69 62 0d 06 e0 0d 4c 44  59 20 69 6e 70 74 72 0d  |ib....LDY inptr.|
00000ba0  06 ea 11 4c 44 41 20 28  69 6e 70 75 74 29 2c 59  |...LDA (input),Y|
00000bb0  0d 06 f4 0c 4c 44 58 20  6d 61 73 6b 0d 06 fe 0d  |....LDX mask....|
00000bc0  42 4e 45 20 72 69 67 68  74 0d 07 08 17 4c 53 52  |BNE right....LSR|
00000bd0  41 3a 4c 53 52 41 3a 4c  53 52 41 3a 4c 53 52 41  |A:LSRA:LSRA:LSRA|
00000be0  0d 07 12 09 80 20 23 31  35 0d 07 1c 17 44 45 43  |..... #15....DEC|
00000bf0  20 6d 61 73 6b 20 20 5c  6e 6f 77 20 3d 26 46 46  | mask  \now =&FF|
00000c00  0d 07 26 07 52 54 53 0d  07 30 10 2e 72 69 67 68  |..&.RTS..0..righ|
00000c10  74 20 80 20 23 31 35 0d  07 3a 15 49 4e 43 20 6d  |t . #15..:.INC m|
00000c20  61 73 6b 20 20 5c 6e 6f  77 20 3d 30 0d 07 44 0d  |ask  \now =0..D.|
00000c30  49 4e 43 20 69 6e 70 74  72 0d 07 4e 07 52 54 53  |INC inptr..N.RTS|
00000c40  0d 07 58 05 5d 0d 07 62  05 ed 0d 07 6c 05 20 0d  |..X.]..b....l. .|
00000c50  07 76 20 de 20 69 6e 74  65 78 74 25 20 26 31 30  |.v . intext% &10|
00000c60  30 2c 6f 75 74 74 65 78  74 25 20 26 31 30 30 0d  |0,outtext% &100.|
00000c70  07 80 24 e8 20 86 27 22  54 79 70 65 20 69 6e 20  |..$. .'"Type in |
00000c80  73 6f 6d 65 20 74 65 78  74 22 2c 24 69 6e 74 65  |some text",$inte|
00000c90  78 74 25 0d 07 8a 16 6f  6c 64 6c 65 6e 25 3d a9  |xt%....oldlen%=.|
00000ca0  20 24 69 6e 74 65 78 74  25 0d 07 94 12 21 69 6e  | $intext%....!in|
00000cb0  70 75 74 3d 69 6e 74 65  78 74 25 0d 07 9e 14 21  |put=intext%....!|
00000cc0  6f 75 74 70 75 74 3d 6f  75 74 74 65 78 74 25 0d  |output=outtext%.|
00000cd0  07 a8 0e d6 20 63 6f 6d  70 72 65 73 73 0d 07 b2  |.... compress...|
00000ce0  13 6e 65 77 6c 65 6e 25  3d 3f 6f 75 74 70 74 72  |.newlen%=?outptr|
00000cf0  0d 07 bc 20 f1 27 22 4f  72 69 67 69 6e 61 6c 20  |... .'"Original |
00000d00  6c 65 6e 67 74 68 3a 22  3b 6f 6c 64 6c 65 6e 25  |length:";oldlen%|
00000d10  0d 07 c6 21 f1 27 22 43  6f 6d 70 61 63 74 65 64  |...!.'"Compacted|
00000d20  20 6c 65 6e 67 74 68 3a  22 3b 6e 65 77 6c 65 6e  | length:";newlen|
00000d30  25 0d 07 d0 36 f1 27 22  43 6f 6d 70 61 63 74 69  |%...6.'"Compacti|
00000d40  6f 6e 20 66 61 63 74 6f  72 3a 22 3b 31 30 30 2d  |on factor:";100-|
00000d50  6e 65 77 6c 65 6e 25 2f  6f 6c 64 6c 65 6e 25 2a  |newlen%/oldlen%*|
00000d60  31 30 30 3b 22 25 22 0d  07 da 13 21 69 6e 70 75  |100;"%"....!inpu|
00000d70  74 3d 6f 75 74 74 65 78  74 25 0d 07 e4 0c d6 20  |t=outtext%..... |
00000d80  65 78 70 61 6e 64 0d 07  ee 49 dc 20 61 6e 64 2c  |expand...I. and,|
00000d90  62 75 74 2c 62 79 2c 63  61 6e 2c 66 6f 72 2c 67  |but,by,can,for,g|
00000da0  65 74 2c 6c 65 73 73 2c  6d 6f 72 65 2c 73 68 65  |et,less,more,she|
00000db0  2c 74 68 61 74 2c 74 68  65 79 2c 74 68 65 2c 74  |,that,they,the,t|
00000dc0  68 69 73 2c 77 61 73 2c  77 68 6f 2c 79 6f 75 0d  |his,was,who,you.|
00000dd0  ff                                                |.|
00000dd1
U/COMPRE2.m0
U/COMPRE2.m1
U/COMPRE2.m2
U/COMPRE2.m4
U/COMPRE2.m5