home *** CD-ROM | disk | FTP | other *** search
-
- ; Mini decruncher
-
- ; By Fredrik Juto 1989
- ; This software is public domain,
- ; you may freely distribute, modify or sell it.
- ; (See `crunch.s' for crunch routine)
-
- ; FROM A0
- ; TO A1
- ; LENGTH D0
-
- decrunch:
- movem.l d0-d2/a0-a2,-(sp) ; Push the callers stuff on the stack.
- move.l a1,a2
- add.l d0,a2 ; A2 points to source end.
-
- de_main:
- moveq #0,d1 ; Clear d1
- move.b (a0)+,d1 ; Place next byte in d1 (control byte)
- btst #7,d1 ; Is it dump & crunch?
- bne.s de_crunch ; Crunch.
-
- *** Dump ***
- de_dump:
- move.b (a0)+,(a1)+ ; Dumping...
- cmpa.l a1,a2 ; Is the whole job done?
- beq.s de_exit ; Yeah! exit
- dbf d1,de_dump ; Decrease d1, if d1 is true, continue dumping..
- bra.s de_main ; Jump to main
-
- *** Crunch ***
- de_crunch:
- bclr #7,d1 ; Clear the dump/crunch flag in d1 (control byte)
- move.b (a0)+,d2 ; Read in byte to be repeated
- de_crunchloop:
- move.b d2,(a1)+ ; Repeat byte
- cmpa.l a1,a2 ; Are we finished?
- beq.s de_exit ; Yep, exit.
- dbf d1,de_crunchloop ; if (d1--) goto de_crunchloop;
- bra.s de_main ; Jump to main.
-
- de_exit:
- movem.l (sp)+,d0-d2/a0-a2 ; Push callers stuff from stack.
- rts ; Exit to caller
-
- end ; End of assembly
-