

			WelCome to StoneCracker v3.10


 It's again time to update the series of StoneCracker crunchers. Nowadays it's
 more hobby for me to program this cruncher than serious work. A though of
 new version came into my mind at the end of November -91 when I made some
 research and by accident found a new fast way to crunch data.

 First I thought not to make a new cruncher but after a while I had to make a
 test and that was it. A developement for new StoneCracker started. This time
 I wanted also make a good and easy to use userinterface. So I had to make
 some tests with req.library too.

 And now the new StoneCracker is out and ready for use. In my opinion it looks
 really nice and what's more important it works even better.

 As always Stc has been pure democruncher and I haven't changed it. So all
 demomakers who write legal programs forget this cruncher. Expect legal
 version of Stc in near future (which means atleast six months). I managed to
 keep the length of this program rather small. Somewhat 11 kilobytes. To make
 your life easier Stc is killing easy to use. B'cos Stc is opened as a process
 it multitasks with other programs.

 The use of fabulous req.library makes file handling easy for you. Output
 window tells all the time what's happening. Separated functions e.g loading,
 saving etc are in pulldown menus.

 The need of user defined values for crunching and decruncher has been put as
 little as possible. And rather intelligent string gadget routine tries to
 accept only suitable values. Note! Never give odd values!

 There's only one pulldown menu (Project). It includes: load file, save file,
 relocate file, delete file, about, set task priority and quit. Everything can
 be selected whether with mouse or through keyboard.

 ·Load File·
 A requester will appear and you can select a file to crunch. Loading routine
 checks automatically whether the file is a datafile or executable
 (relocatible) file. You will be informed about the file's type.

 The file will be loaded into file buffer. After loading a 'Crunching details'
 window appears and you have to give few values for decruncher. Everything
 should be clear. Note that 'High address $' should be a bit higher than the
 default address that program calculates. Few kilobytes should be enough.

 If the loaded file was relocatible you can relocate it into absolute address.
 But if you leave 'Relocate $' empty the file will be crunched as a datafile.

 Start crunching clicking 'Start it' gadget. You don't have to define any
 efficiency for the cruncher b'cos it's always forced to 4096 bytes. Crunching
 won't take long b'cos Stc's new alrorithm is extremely fast. Data is scanned
 through with a speed of 15 to 20 kilobytes per second. 

 After the crunching the file will stay in buffer until you want to load a
 new file to crunch.

 ·Relocate·
 If you want you can relocate executable programs into absolute addresses.
 The relocation routine should deal perfectly with Hunk_data, Hunk_code and
 Hunk_bss. Hunk_symbol and Hunk_debug will be removed. All bss hunks are
 expanded into their correct size and filled with zeroes. Also data hunks
 which include bss hunks (some programs have such data hunks <- mostly
 crunchers but also some utils) are handled correctly. This is the part of
 Stc that I'm not too sure whether it works in all cases. Note that those
 programs which use program's segmentlists can't be relocated correctly.

 ·Save File·
 Saves the contents of file buffer into given device. The file remains in file
 buffer until you load something new into it. So you can save your relocated or
 crunched file multiple times.

 ·Delete File·
 This should be clear. Nice thing to get more empty disk space if your
 crunched program didn't fit into disk.

 ·Set Task Priority·
 You can change the priority of this task. Default is set to zero but you can
 also give higher or lower priority.

 ·About·
 Some credits and information about this cruncher.

 ·Quit·
 Exit this fine program.

 Now some more detailed information about the decruncher. Before decrunching
 process the decruncher will be moved away from the data and in order to
 quarantee a better result. Default is set to $100 but it can be freely changed.
 Just don't locate it inside the area of your program. All floppy drives, 
 interrupts and dma's are turned off at the beginning of decrunching process.

 This time decruncher code is rather long $190 (=400) bytes. The reason is
 faster decrunching speed. The decruncher doesn't use stacks while
 decrunching.

 There are also two different types of decrunchers available. 'Normal' and
 'System killer'. 'System killer' will be selected only when you relocate
 stacks. If you leave stack gadgets empty the decruncher type is 'Normal'.

 The difference between 'Normal' and 'System killer' decrunchers are that it's
 not possible to exit in a normal way those programs that use 'System killer'
 decruncher. 'System killer' decruncher relocates both user and supervisor
 stackpointers and clears status register (flags changes while decrunching).

 'Normal' decruncher re-enables interrupts and dma's after decrunching but 
 'System killer' doesn't.

 As mentioned above this cruncher is really fast. Unfortunately the price to
 pay for speed is less efficient result. Now I'll show a list of tests I made
 with this cruncher and you can see how fast it is.

 Tests were made: 1.CED (relocated), 2.Intro for Stc v3.00,
		  3.DPaint 4 (relocated), 4.Triad bbs intro, 5.AsmOne doc-file

                ! STC 3.10 ! Stc 3.00 | PowerPacker

 1. CED (114360 bytes as relocated)
 -------------------------------------------------
 Result         ! 70944    ! not      | 59944
 Crunching time ! 6 sec!   ! tested   | 1.12 min
 -------------------------------------------------
 
 2. Intro for Stc v3.00 (124244 bytes)
 -------------------------------------------------
 Result         ! 88472    ! not      | 76924
 Crunching time ! 7 sec!   ! tested   | 2.31 min
 -------------------------------------------------
 
 3. DPaint 4 (365544 bytes as relocated)
 -------------------------------------------------
 Result         ! 258484   ! not      | 227700
 Crunching time ! 20 sec!  ! tested   | 5.12 min
 -------------------------------------------------
 
 4. Triad bbs intro (155416 bytes)
 -------------------------------------------------
 Result         ! 118456   ! 111920   | 111504
 Crunching time ! 9 sec!   ! 15.33 min| 2.15 min
 -------------------------------------------------
 
 5. AsmOne.doc (258198 bytes)
 -------------------------------------------------
 Result         ! 126132   ! not      | 100548
 Crunching time ! 9 sec!   ! tested   | 4.47 min
 -------------------------------------------------

 *The times aren't very exact (taken with a normal clock).
 *Efficiency was on every test 4096 bytes and if possible files were
 *relocated. 
 *These tests were run on 7.14Mhz A2000.

 You must have noticed the bad efficiency b'cos Stc v3.10 loses in every test
 but compare the crunching speed. It's up to you when you need more fast
 cruncher than efficient. Anyway 10 kilobytes less in over 100 kilobytes long
 file makes seldom troubles.

 First I wanted to make tests with all popular crunchers but when I saw that
 PowerPacker (v3.0a) lost so much I dropped whole test. As you can see older
 Stc v3.00 crunched the test file 103 times slower and won just 8 kilobytes.
 Time for a good laugh? In average Stc v3.10 is over 18 times faster than
 good old PowerPacker (which is fast too).

 Well of course I hope you use this cruncher b'cos I spent quite a many sleep
 less nights in front of my computer typing boring assembly commands. If you
 find any bugs or really want me to add something (update this cruncher) to
 this cruncher just write me a nice letter or leave a message into our bbs.
 My address will be at the end of this text file.

 Now few personal hellos...
 ·Jupe and Fang for their crazy ideas.
 ·Lancer (hi Juha) for being more than just a computer pal.
 ·Elf-Co (hi Paul) for his coolness and just being a great person to know.
 ·Mic Dair (mitas mies?) and Arnold for long time friendship.
 ·Zerox (hello Frode) my long time penfriend!
 ·Damien and Chucky for giving me an opportunity to get the latest stuff.
 ·Corto for his coolness and also being a good coder.

 Last note... please support poor student with few $$$'s.

				Yours,
				Mr.Spiv




				My address... Please no swapping!

				Jouni Korhonen
				Hiihtomajantie
				11120 Riihimaki
				FINLAND





 MOVEQ	#0,d0		;succesful exit
 RTS






 Just in case I thought to include the decruncher sourcecode for those who
 are interested in it.

;------------------------------------------------
;decruncher sourcecode for stc v3.10
;(c) 1991 mr.spiv of cave
;------------------------------------------------
lzd_go:		lea	$dff180,a6
		lea	$bfd100,a3
		lea	lzd_start(pc),a0
		move.w	(a0)+,$09a-$180(a6)
		move.w	(a0)+,$096-$180(a6)
		move.b	#$81,(a3)
		lea	lzd_data+4(pc),a2
		st	(a3)

lzd_location:	lea	$fc0000,a4
		moveq	#(lzd_data-lzd_run)/4-1,d0
lzd_move:	move.l	(a0)+,(a4)+
		dbf	d0,lzd_move
		bne.s	lzd_normal

		lea	lzd_super(pc),a0
		move.l	a0,$10.w
		illegal
lzd_super:	moveq	#0,d0
lzd_usp:	lea	$fc0000,a0
		move.l	a0,usp
lzd_ssp:	lea	$fc0000,a7
		move.w	d0,sr			;clear SR -> back to uservisor

lzd_normal:	moveq	#2,d5
		moveq	#31,d6
		moveq	#7,d7
lzd_load:	lea	$fc0000,a0		;load address
		jmp	lzd_run-lzd_data(a4)

		dc.b	" Mr.Spiv Of Cave! "	;who's he?

lzd_start:	dc.w	$4000,$0200

;------------------------------------------------
;decruncher - main program
;------------------------------------------------
lzd_run:	move.l	(a2)+,a3		;uncrunched length
		move.l	(a2)+,d0		;crunched length
		add.l	a0,a3
		move.l	a2,a1
		add.l	d0,a1
		cmp.l	a0,a1			;if areastart > dataend then ok
		blo.s	lzd_ok
		cmp.l	a3,a1			;if areaend <= dataend then ok
		bhs.s	lzd_ok

lzd_high:	lea	$fc0000,a2		;high address
lzd_trans:	move.l	-(a1),-(a2)
		subq.l	#4,d0
		bne.s	lzd_trans

lzd_ok:		move.l	(a2)+,d0
		lsr.w	#1,d6
		bra.s	lzd_first

lzd_deloop:	move.w	a1,(a6)
		add.l	d0,d0
		bne.s	lzd_no_ovl1
		move.l	(a2)+,d0
lzd_first:	addx.l	d0,d0
lzd_no_ovl1:	bcs	lzd_copy

lzd_byte:	moveq	#0,d3
lzd_loop6:	moveq	#0,d2
		rept	3
		add.l	d0,d0
		bne.s	*+6
		move.l	(a2)+,d0
		addx.l	d0,d0
		addx.w	d2,d2
		endr
		add.l	d2,d3
		cmp.w	d7,d2
		beq.s	lzd_loop6
lzd_loop7:	rept	8
		add.l	d0,d0
		bne.s	*+6
		move.l	(a2)+,d0
		addx.l	d0,d0
		addx.b	d2,d2
		endr
		move.b	d2,(a0)+
		subq.l	#1,d3
		bne.s	lzd_loop7

		bra	lzd_test

lzd_help:	dc.b	10-8-1,11-8-1,12-8-1,8-8-1

lzd_copy:	moveq	#0,d2
		rept	2
		add.l	d0,d0
		bne.s	*+6
		move.l	(a2)+,d0
		addx.l	d0,d0
		addx.w	d2,d2
		endr

		moveq	#0,d3
		moveq	#0,d1			;d1=dist
		move.b	lzd_help(pc,d2.w),d3
		bmi.s	lzd_loop4

lzd_loop3:	add.l	d0,d0
		bne.s	lzd_no_ovl4
		move.l	(a2)+,d0
		addx.l	d0,d0
lzd_no_ovl4:	addx.w	d1,d1
		dbf	d3,lzd_loop3

lzd_loop4:	rept	8
		add.l	d0,d0
		bne.s	*+6
		move.l	(a2)+,d0
		addx.l	d0,d0
		addx.w	d1,d1
		endr

		cmp.w	d5,d2
		blo.s	lzd_quick
		moveq	#0,d2
lzd_loop5:	moveq	#0,d3
		rept	4
		add.l	d0,d0
		bne.s	*+6
		move.l	(a2)+,d0
		addx.l	d0,d0
		addx.w	d3,d3
		endr
		add.l	d3,d2
		cmp.w	d6,d3
		beq.s	lzd_loop5

lzd_quick:	addq.l	#3,d2			;d2=kpl
		move.l	a0,a1
		sub.w	d1,a1
lzd_loop8:	move.b	(a1)+,(a0)+
		subq.l	#1,d2
		bne.s	lzd_loop8

lzd_test:	cmp.l	a3,a0
		blo	lzd_deloop
		move.w	-(a4),$096-$180(a6)
		move.w	-(a4),$09a-$180(a6)
lzd_jump:	jmp	$fc0000			;jump address
lzd_ret:	dc.w	$c000,$8200

;------------------------------------------------
;bitrun crunched data
;------------------------------------------------
lzd_data:	dc.b	"S310"			;datatype stc v3.10
lzd_uncrunched:	dc.l	0
lzd_crunched:	dc.l	0
