Zio:
         move.l   4,a6
         lea      doslib,a1
         jsr      -$0198(a6)
         move.l   d0,dosbase
         beq.s    orror
         bra.s    AmigaOK

Orror:      
         moveq    #$-01,d0
         rts      

AmigaOk:
         move.l   dosbase,a6
         jsr      -$3c(a6)
         move.l   d0,handleout
         jsr      -$36(a6)
         move.l   d0,handlein

Ask_menu:
         move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #pr,d2
         move.l   #[prend-pr],d3
         jsr      -$30(a6)
	 
Cruncher:
         move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #Workspace,d2
         move.l   #[workend-workspace],d3
         jsr      -$30(a6)
         bsr.l    savereg
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$04,d3
         jsr      -$2a(a6)
         cmpi.l   #$01,d0
         bls.s    Cruncher
         subq.l   #$01,d0
         move.l   #storefile,a0
         adda.l   d0,a0
         move.b   -(a0),d1
         subq.l   #$1,d0
         bsr.l    compresstable
         cmpi.b   #$0a,d1
         bcc.L    Cruncher2
         moveq    #$00,d2
         move.b   d1,d2
         tst.b    d0
         beq.s    Byte
         move.b   -(a0),d1
         subq.l   #$1,d0
         bsr.l    compresstable
         cmpi.b   #$0a,d1
         bcc.L    Cruncher2
         andi.w   #$0f,d1
         mulu     #$0a,d1
         add.w    d1,d2
         tst.b    d0
         beq.s    byte
         move.b   -(a0),d1
         bsr.l    compresstable
         cmpi.b   #$0a,d1
         bcc.l    Cruncher2
         andi.w   #$0f,d1
         mulu     #$64,d1
         add.w    d1,d2
         tst.w    d2
         beq.l    Cruncher2

Byte:
         moveq    #$00,d0
         subq.w   #$1,d2

Lloop:
         addi.l   #$0400,d0
         dbf      d2,Lloop
         move.l   d0,pointerlloop
         move.l   4,a6
         move.l   #$010000,d1
         move.l   pointerlloop,d0
         jsr      -$c6(a6)		; Alloca
         move.l   d0,pointermem
         beq.l    Cruncher2
         addi.l   #$80,d0
         move.l   d0,pointercruncher
         move.l   dosbase,a6

Loadfile:
         move.l   handleout,d1
         move.l   #load,d2
         move.l   #[loadend-load],d3
         jsr      -$0030(a6)
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$2a(a6)
         cmpi.l   #$01,d0
         bls.s    Loadfile
         subq.l   #$1,d0
         lea      storefile,a0
         adda.l   d0,a0
         clr.b    (a0)
         move.l   #storefile,d1
         move.l   #$03ed,d2		; Mode new
         jsr      -$1e(a6)		; Open
         move.l   d0,pointer1
         beq.L    Loadfile2
         move.l   pointer1,d1		; File
         move.l   pointercruncher,d2	; Buffer
         move.l   pointerlloop,d3	; Lunghezza
         subi.l   #$80,d3
         jsr      -$2a(a6)		; Read
         move.l   d0,filepointer	; Lunghezza in d0
         move.l   pointer1,d1
         jsr      -$24(a6)		; Close
         move.l   pointerlloop,d0
         subi.l   #$80,d0
         cmp.l    filepointer,d0
         bls.l    Loadfile2

Checktype:
	 move.l   pointercruncher,a0
	 cmp.l	  #$000003f3,(a0)
	 bne	  vabbuono
	 move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #kidding,d2
         move.l   #[kiddend-kidding],d3
         jsr      -$30(a6)
	 bra	  loadfile

Vabbuono:
	 move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #offset,d2
         move.l   #[offend-offset],d3
         jsr      -$30(a6)
         bsr.l    savereg
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$05,d3
         jsr      -$2a(a6)
         cmpi.l   #$01,d0
         bls.s    vabbuono
         moveq    #$04,d0
         bsr.l    compress
         cmpi.w   #$9,d0
         bhi.s    vabbuono
	 mulu	  #64,d0
         bclr     #$00,d0
         move.l   d0,L54

Asksound:
         move.l   handleout,d1
         move.l   #soundorflash,d2
         move.l   #[souend-soundorflash],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  asksound
	 subq.l	  #1,d0
	 lea	  storefile,a0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #'s',(a0)
	 beq	  sound
	 cmpi.b	  #'f',(a0)
	 beq	  gocrunch
	 bra	  asksound

Sound:
	 move.w	#1,soundflag

Gocrunch:
	 move.l	  4,a6
	 jsr	  -132(a6)

Cuea:
	 move.w	  #$0200,$dff096
	 move.w	  #$0000,$dff180
         bsr.l    crunch_it
	 tst.w	  soundflag
	 beq	  noendsound
	 move.w	  #$0001,$dff096

Noendsound:
	 move.w	  #$8200,$dff096
	 move.l	  4,a6
	 jsr	  -138(a6)
         move.l   pointermem,a0
         move.l   PM,(a0)
         move.l   dosbase,a6
         lea      L58(pc),a5
         moveq    #$05,d1

Loopagain:
         move.w   (a5)+,d0
         bsr.l    L32
         dbf      d1,loopagain
         move.l   handleout,d1
         move.l   #orl,d2
         move.l   #[orlend-orl],d3
         jsr      -$30(a6)
         move.l   filepointer,d0
         bsr.l    decimal
         move.l   handleout,d1
         move.l   #plen,d2
         move.l   #[pend-plen],d3
         jsr      -$30(a6)
         move.l   pm,d0
         addi.l   #$0c,d0
         bsr.l    decimal
         move.l   handleout,d1
         move.l   #gained,d2
         move.l   #[gend-gained],d3
         jsr      -$30(a6)
	 move.l	  filepointer,d0
	 move.l	  pm,d1
	 subi.l   #$c,d1
	 sub.l	  d1,d0
	 bsr	  decimal

Askloc:
         move.l   handleout,d1
         move.l   #loc,d2
         move.l   #[lend-loc],d3
         jsr      -$30(a6)
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$2a(a6)
         cmpi.l   #$01,d0
         bls.s    askloc
         moveq    #$05,d0
         bsr.l    compress
         move.l   d0,orgaddress

Askjump:
         move.l   handleout,d1
         move.l   #jump,d2
         move.l   #[jend-jump],d3
         jsr      -$0030(a6)
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
         cmpi.l   #$00000001,d0
         bls.s    askjump
         moveq    #$05,d0
         bsr.l    compress
         move.l   d0,jumpaddress

Ask1:
         move.l   handleout,d1
         move.l   #dtype,d2
         move.l   #[dend-dtype],d3
         jsr      -$0030(a6)

Dloop:
	 cmp.b	#$5f,$bfec01
	 beq	bkiller
	 cmp.b	#$5d,$bfec01
	 beq	puthunks
	 cmp.b	#$5b,$bfec01
	 beq	eff1
	 cmp.b	#$59,$bfec01
	 beq	eff2
	 cmp.b	#$57,$bfec01
	 beq	eff3
	 bra	dloop

Bkiller:
	 lea	hunk,a0
	 move.w	#$23c8,$be(a0)
	 move.w	#$23c8,$d8(a0)
	 bra	puthunks

Eff1:
	 lea	hunk,a0
	 move.w	#$b179,$be(a0)
	 move.w	#$b179,$d8(a0)
	 bra	puthunks

Eff2:
	 lea	hunk,a0
	 move.w	#$c179,$be(a0)
	 move.w	#$c179,$d8(a0)
	 bra	puthunks

Eff3:
	 lea	hunk,a0
	 move.w	#$8179,$be(a0)
	 move.w	#$8179,$d8(a0)

Puthunks:
         move.l   handleout,d1
         move.l   #confirm,d2
         move.l   #[confend-confirm],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  puthunks
	 subq.l	  #1,d0
	 lea	  storefile,a0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #"y",(a0)
	 beq	  ask2
	 bra	  ask1

Ask2:
	 move.l	  handleout,d1
         move.l   #dtype2,d2
         move.l   #[dend2-dtype2],d3
         jsr      -$0030(a6)

Dloop2:
	 cmp.b	#$5f,$bfec01
	 beq	color0
	 cmp.b	#$5d,$bfec01
	 beq	color1
	 cmp.b	#$5b,$bfec01
	 beq	color2
	 cmp.b	#$59,$bfec01
	 beq	color3
	 cmp.b	#$57,$bfec01
	 beq	delay
	 cmp.b	#$55,$bfec01
	 beq	modulo
	 cmp.b	#$53,$bfec01
	 beq	mouse
	 cmp.b	#$51,$bfec01
	 beq	none
	 bra	dloop2

Color0:
	 lea	hunk,a0
	 move.w	#$f180,$c2(a0)
	 move.w	#$f180,$dc(a0)
	 bra	puthunks2

Color1:
	 lea	hunk,a0
	 move.w	#$f182,$c2(a0)
	 move.w	#$f182,$dc(a0)
	 bra	puthunks2

Color2:
	 lea	hunk,a0
	 move.w	#$f184,$c2(a0)
	 move.w	#$f184,$dc(a0)
	 bra	puthunks2

Color3:
	 lea	hunk,a0
	 move.w	#$f186,$c2(a0)
	 move.w	#$f186,$dc(a0)
	 bra	puthunks2

Delay:
	 lea	hunk,a0
	 move.w	#$f102,$c2(a0)
	 move.w	#$f102,$dc(a0)
	 bra	puthunks2

Modulo:
	 lea	hunk,a0
	 move.w	#$f108,$c2(a0)
	 move.w	#$f10a,$dc(a0)
	 bra	puthunks2

Mouse:
	 lea	hunk,a0
	 move.w	#$f1a2,$c2(a0)
	 move.w	#$f1a2,$dc(a0)
	 bra	puthunks2

None:
	 lea	hunk,a0
	 move.w	#$f190,$c2(a0)
	 move.w	#$f190,$dc(a0)

Puthunks2:
         move.l   handleout,d1
         move.l   #confirm,d2
         move.l   #[confend-confirm],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  puthunks2
	 subq.l	  #1,d0
	 lea	  storefile,a0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #"y",(a0)
	 beq	  putreal
	 bra	  ask2

Putreal:
         move.l   pointermem,a0
         adda.l   pm,a0
         adda.l   #$0000000c,a0
         move.l   a0,a1
         adda.l   #$0000010c,a1
         move.l   a1,a2
         move.l   pm,d0
         addi.l   #$0000000c,d0
         move.l   d0,d1
         swap     d1
         bra.s    L19

L18:
         move.b   -(a0),-(a1)

L19:
         dbf      d0,L18
         dbf      d1,L18
         lea      HUNK,a0
         move.l   pointermem,a1
         move.w   #267,d0		; Numero bytes degli hunks

L20:
         move.b   (a0)+,(a1)+
         dbf      d0,L20
         move.l   a2,d0
         sub.l    pointermem,d0
         subi.l   #$24,d0
         move.l   d0,d1
         divu     #4,d1
         swap     d1
         tst.b    d1
         beq.s    L21
         addi.l   #2,d0
         move.l   d0,d1
         divu     #4,d1
         swap     d1

L21:
         swap     d1
         move.l   pointermem,a0
         move.l   d1,$14(a0)
         move.l   d1,$20(a0)
         addi.l   #$24,d0
         move.l   d0,a2
         adda.l   a0,a2
         addi.l   #$18,d0
         subi.l   #$c,d0
         move.l   d0,pm
         lea      hunkend,a0
         move.l   a2,a1
         moveq    #23,d0		; Numero bytes secondo hunk

L22:
         move.b   (a0)+,(a1)+
         dbf      d0,L22
         move.l   pointermem,a0		; Puntatore programma finale
         move.l   orgaddress,$2a(a0)
         move.l   jumpaddress,$d0(a0)

Saveroutine:
         move.l   handleout,d1
         move.l   #save,d2
         move.l   #[savend-save],d3
         jsr      -$0030(a6)
         move.l   handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
         cmpi.l   #$00000001,d0
         bls.L    saveroutine2
         subq.l   #$1,d0
         lea      storefile,a0
         adda.l   d0,a0
         clr.b    (a0)

L24:     move.l   #storefile,d1
         move.l   #$000003ee,d2
         jsr      -$001e(a6)
         move.l   d0,pointer1
         move.l   d0,d1
         move.l   pointermem,d2
         move.l   pm,d3
         addi.l   #$0000000c,d3
         jsr      -$0030(a6)
         cmpi.l   #-$00000001,d0
         beq.l    saveroutine2
         move.l   pointer1,d1
         jsr      -$0024(a6)

Ancora:
         move.l   handleout,d1
         move.l   #saveagain,d2
         move.l   #[sagend-saveagain],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  ancora
	 subq.l	  #1,d0
	 lea	  storefile,a0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #"y",(a0)
	 beq	  saveroutine

Checcazzo:
	 move.l	  dosbase,a6
         move.l   handleout,d1
         move.l   #runnow,d2
         move.l   #[runend-runnow],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  checcazzo
	 lea	  storefile,a0
	 subq.l	  #1,d0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #"y",(a0)
	 bne	  eadesso

Okrun:
	 move.l	  pointermem,a0
	 jsr	  $24(a0)
	 
Eadesso:
	 move.l	  dosbase,a6
         move.l   handleout,d1
         move.l   #chefai,d2
         move.l   #[chend-chefai],d3
         jsr      -$0030(a6)
	 move.l	  handlein,d1
         move.l   #storefile,d2
         moveq    #$1e,d3
         jsr      -$002a(a6)
	 cmpi.b	  #1,d0
	 bls.s	  eadesso
	 lea	  storefile,a0
	 subq.l	  #1,d0
	 adda.l	  d0,a0
	 clr.b	  (a0)
	 lea	  storefile,a0
	 cmpi.b	  #"y",(a0)
	 beq	  torna

Fine:
         move.l   handleout,d1
         move.l   #contact,d2
         move.l   #[coend-contact],d3
         jsr      -$0030(a6)
	 move.l	  4,a6
	 move.l   pointerlloop,d0
	 move.l	  pointermem,a1
	 jsr	  -210(a6)
	 move.l   4,a6
         move.l   dosbase,a1
         jsr      -$019e(a6); closelib
         clr.l    d0
         rts      

Cruncher2:
         move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #allocerr,d2
         move.l   #[alend-allocerr],d3
         jsr      -$30(a6)	; text
	 bra	  cruncher

Loadfile2:
         move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #loaderr,d2
         move.l   #[loaderrend-loaderr],d3
         jsr      -$30(a6)	; text
	 bra	  loadfile

Saveroutine2:
         move.l   dosbase,a6
         move.l   handleout,d1
         move.l   #saverr,d2
         move.l   #[saveerrend-saverr],d3
         jsr      -$30(a6)	; text
	 bra	  saveroutine

Torna:
	 move.l	  4,a6
	 move.l   pointerlloop,d0
	 move.l	  pointermem,a1
	 jsr	  -210(a6)
	 bra 	  Ask_menu

Compress:
	 movem.l  d1-d7/a0-a6,-(a7)
         move.l   d0,d3
         clr.l    d0
         clr.l    d1
         clr.l    d2
         lea      storefile,a0

Compressloop:
	 move.b   (a0)+,d1
         bsr.s    compresstable
         andi.w   #$0f,d1
         lsl.l    #$4,d2
         or.w     d1,d2
         cmpi.b   #$0a,(a0)
         beq.s    compressok
         dbf      d3,compressloop

Compressok:
         move.l   d2,d0
         movem.l  (a7)+,d1-d7/a0-a6
         rts      

Compresstable:
         movem.l  d0/a0,-(a7)
         moveq    #$00,d0
         lea      table,a0

Compresscmp:
         cmp.b    $00(a0,d0.l),d1
         beq.s    compressend
         addq.l   #$1,d0
         cmpi.l   #$10,d0
         bcs.s    compresscmp

Compressend:
         move.l   d0,d1
         movem.l  (a7)+,d0/a0
         rts      

L32:     movem.l  d0-d7/a0-a6,-(a7)
         lea      storefile,a0
         adda.l   #$06,a0
         lea      table,a1
         move.b   #$20,-(a0)
         moveq    #$04,d2

L33:     move.l   d0,d1
         andi.l   #$0f,d1
         move.b   $00(a1,d1.l),-(a0)
         lsr.l    #$4,d0
         dbf      d2,L33
         move.b   #$24,(a0)
         move.l   handleout,d1
         move.l   #storefile,d2
         moveq    #$06,d3
         movem.l  (a7)+,d0-d7/a0-a6
         rts      

Crunch_it:
	 move.l	  $80,trappointer
	 move.l	  #gogo,$80
	 trap	  #$00

Gogo:
	 move.w	  #$2700,sr
	 move.l   pointercruncher,a0
         move.l   pointercruncher,a1
         adda.l   filepointer,a1
         move.l   pointermem,a2
         move.l   #$00000000,(a2)+
         move.l   filepointer,(a2)+
         move.l   #$00000000,(a2)+
         moveq    #$01,d2
         clr.w    d1
         clr.l    d7

L37:     bsr.L    L39
         tst.b    d0
         beq.s    L38
         addq.w   #$1,d1
         cmpi.w   #$0108,d1
         bne.s    L38
         bsr.l    L61

L38:     cmpa.l   a0,a1
         bgt.s    L37
         bsr.l    L61
         bsr.l    L66
         move.l   a2,d0
         sub.l    pointermem,d0
         subi.l   #$0000000c,d0
         move.l   d0,pm
	 tst.w	  soundflag
	 beq	  nosound
	 move	  #2,$dff0a4
	 move.l	  #wave,$dff0a0
	 move	  #$440,$dff0a6
	 move	  #$3f,$dff0a8
	 move	  #$8201,$dff096
	 move.l	  d0,$dff0a6
	 bra	  noflash

Nosound:
	 eor.w	  d0,$dff180

Noflash:
         move.l   pointermem,a3
         move.l   d7,$0008(a3)
         move.l   d0,$0000(a3)
	 move.w	  #$0000,sr
	 move.l	  trappointer,$80
         rts      

L39:     move.l   a0,a3
         adda.l   L54,a3
         cmpa.l   a1,a3
         ble.s    L40
         move.l   a1,a3

L40:     moveq    #$01,d5
         move.l   a0,a5
         addq.w   #$1,a5

L41:     move.b   (a0),d3
         move.b   $0001(a0),d4

L42:     cmp.b    (a5)+,d3
         bne.s    L43
         cmp.b    (a5),d4
         beq.s    L44

L43:     cmpa.l   a5,a3
         bgt.s    L42
         bra.L    L51

L44:     subq.w   #$1,a5
         move.l  a0,a4

L45:     move.b   (a4)+,d3
         cmp.b    (a5)+,d3
         bne.s    L46
         cmpa.l   a5,a3
         bgt.s    L45

L46:     move.l   a4,d3
	 tst.w	  soundflag
	 beq	  flash
	 move	  #2,$dff0a4
	 move.l	  #wave,$dff0a0
	 move	  #$440,$dff0a6
	 move	  #$3f,$dff0a8
	 move	  #$8201,$dff096
	 move.l	  a4,$dff0a6
	 bra	  noflash2

Flash:
	 move.w	  a4,$dff180

Noflash2:
         sub.l    a0,d3
         subq.l   #$1,d3
         cmp.l    d3,d5
         bge.s    L50
         move.l   a5,d4
         sub.l    a0,d4
         sub.l    d3,d4
         subq.w   #$1,d4
         cmpi.l   #$00000004,d3
         ble.s    L48
         moveq    #$06,d6
         cmpi.l   #$00000101,d3
         blt.s    L47
         move.w   #$0100,d3

L47:     bra.s    L49

L48:     move.w   d3,d6
         subq.w   #$2,d6
         lsl.w    #$1,d6

L49:     lea      L57,a6
         cmp.w    $00(a6,d6.w),d4
         bge.s    L50
         move.l   d3,d5
         move.l   d4,L55
         move.b   d6,L56

L50:     cmpa.l   a5,a3
         bgt.L    L41

L51:
         cmpi.l   #$00000001,d5
         beq.s    L53
         bsr.l    L61
         move.b   L56,d6
         move.l   L55,d3
	 move.w   $08(a6,d6.w),d0
         bsr.l    L64
         move.w   $10(a6,d6.w),d0
         beq.s    L52
         move.l   d5,d3
         subq.w   #$1,d3
         bsr.l    L64

L52:     move.w   $18(a6,d6.w),d0
         move.w   $20(a6,d6.w),d3
         bsr.l    L64
         addi.w   #$0001,$28(a6,d6.w)
         adda.l   d5,a0
         clr.b    d0
         rts      

L53:     move.b   (a0)+,d3
         moveq    #$08,d0
         bsr      L64
         moveq    #$01,d0
         rts      

L54:     dc.b     0,0,0,0

L55:     dc.b    0,0,0,0

L56:     dc.b    0,0

L57:     dc.b     $01,$00,$02,$00,$04,$00
         dc.b     $10,$00,$00,$08,$00,$09
         dc.b     $00,$0a,$00,$0c
         dc.b     0,0,0,0,0,0,0
         dc.b     $08,$00,$02,$00,$03,$00
         dc.b     $03,$00,$03,$00,$01,$00
         dc.b     $04,$00,$05,$00,$06
L58:     dc.b     0,0,0,0,0,0,0,0

L59:     dc.b     0,0
L60:     dc.b     0,0

L61:
         tst.w    d1
         beq.s    L62
         move.w   d1,d3
         clr.w    d1
         cmpi.w   #$0009,d3
         bge.s    L63
         addq.w   #$1,L59
         subq.w   #$1,d3
         moveq    #$05,d0
         bra.s    L64

L62:
         rts      

L63:
         addq.w   #$1,L60
         subi.w   #$0009,d3
         ori.w    #$0700,d3
         moveq    #$0b,d0
         nop      

L64:
         subq.w   #$1,d0

L65:
         lsr.l    #$1,d3
         roxl.l   #$1,d2
         bcs.s    L67
         dbf      d0,L65
         rts      

L66:
         clr.w    d0

L67:
         move.l   d2,(a2)+
         eor.l    d2,d7
         moveq    #$01,d2
         dbf      d0,L65
         rts      

Decimal:
	move.l	d0,d7
	lea	Workie,a0
	lea	10(a0),a0
	moveq	#8,d5

loop:
	divu	#10,d0
	move.l	d0,d1
	swap	d0
	clr.w	d0
	swap	d0
	swap	d1
	and.b	#$f,d1
	add.b	#'0',d1
	move.b	d1,-(a0)
	dbf	d5,loop
	move.l	dosbase,a6
	move.l	handleout,d1
	move.l	#Msg,d2
	move.l	#em-msg,d3
	jsr	-48(a6)
	rts

SaveReg:
         movem.l  d0/a0,-(a7)
         lea      storefile,a0
         moveq    #$0e,d0

Regloop:
         clr.w    (a0)+
         dbf      d0,regloop
         movem.l  (a7)+,d0/a0
         rts      

HUNK:
         dc.b     0,0
         dc.b     $03,$f3
         dc.b     0,0,0,0,0,0,0
         dc.b     $02
         dc.b     0,0,0,0,0,0,0
         dc.b     $01,$00,$00,$00,$3b,$00
         dc.b     $00,$00,$01,$00,$00,$03
         dc.b     $e9,$00,$00,$00,$3b

; Here we go with the REAL decruncher!

Cloaca:
         lea      hunksublabel(pc),a0
         lea      $40000,a1
         move.l   (a0)+,d0
         move.l   (a0)+,d1
         move.l   (a0)+,d5
         move.l   a1,a2
         adda.l   d0,a0
         adda.l   d1,a2
         move.l   -(a0),d0
         eor.l    d0,d5

Shift:
         lsr.l    #$1,d0
         bne.s    shifted
         bsr.l    Dec16

Shifted: 
         bcs.s    Dec9
         moveq    #$08,d1
         moveq    #$01,d3
         lsr.l    #$1,d0
         bne.s    Dec3
         bsr.l    Dec16

Dec3:
         bcs.s    Dec11
         moveq    #$03,d1
         clr.w    d4

Dec4:
         bsr.l    Dec17
         move.w   d2,d3
         add.w    d4,d3

Dec5:
         moveq    #$07,d1

Dec6:
         lsr.l    #$1,d0
         bne.s    Dec7
         bsr.l    Dec16

Dec7:
         roxl.l   #$1,d2
         dbf      d1,Dec6
         move.b   d2,-(a2)
         dbf      d3,Dec5
         bra.l    Dec13

Dec8:
         moveq    #$08,d1
         moveq    #$08,d4
         bra.l    Dec4

Dec9:
         moveq    #$02,d1
         bsr.l    Dec17
         cmpi.b   #$02,d2
         blt.s    Dec10
         cmpi.b   #$03,d2
         beq.s    Dec8
         moveq    #$08,d1
         bsr.l    Dec17
         move.w   d2,d3
         move.w   #$000c,d1
         bra.l    Dec11

Dec10:
         move.w   #$0009,d1
         add.w    d2,d1
         addq.w   #$2,d2
         move.w   d2,d3

Dec11:
         bsr.l    dec17

Dec12:
         subq.w   #$1,a2
         move.b   $00(a2,d2.w),(a2)
         dbf      d3,Dec12

Dec13:
         move.w   a0,$dff180
         cmpa.l   a2,a1
         blt.l    shift
         tst.l    d5
         bne.s    Dec14
         jmp      $123456

Dec14:
         move.w   #-$0001,d0

Dec15:
         move.w   a0,$00dff180
         dbf      d0,Dec15
         moveq    #-$01,d0
         rts      

Dec16:
         move.l   -(a0),d0
         eor.l    d0,d5
         move     #$0010,ccr
         roxr.l   #$1,d0
         rts      

Dec17:
         subq.w   #$1,d1
         clr.w    d2

Dec18:
         lsr.l    #$1,d0
         bne.s    Dec19
         move.l   -(a0),d0
         eor.l    d0,d5
         move     #$0010,ccr
         roxr.l   #$1,d0

Dec19:
         roxl.l   #$1,d2
         dbf      d1,Dec18
         rts      

Hunksublabel:
         dc.b     $e2,$90,$e3,$92,$69,$6e
         dc.b     $66,$6f

HUNKend:
         dc.b     $00,$00,$03,$ec
         dc.b     0,0,0,0,0,0
         dc.b     $03,$f2,$00,$00,$03,$eb
         dc.b     $00,$00,$00,$01,$00,$00
         dc.b     $03,$f2
         dc.b     $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff

POINTER1:    dc.l 0
HandleOut:   dc.l 0
Handlein:    dc.l 0
DosBase:     dc.l 0
Doslib:      dc.b 'dos.library',0
Soundflag:   dc.w 0
PM:	     dc.l 0
Filepointer: dc.l 0
wave:	     dc.b 127,-127
storefile:   blk.b 30,0
Pointerlloop:dc.l 0
PointerMem:  dc.l 0
PointerCruncher:dc.l 0
Orgaddress:  dc.l 0
Jumpaddress: dc.l 0
Trappointer: dc.l 0
Table:       dc.b '0123456789abcdef'

** Strings **

Workspace:
dc.b "Workspace (KBytes): "
Workend:

Load:
dc.b "Filename to load: "
Loadend:

Orl:
dc.b $0a
dc.b 27,'[33mFile informations:',27,'[0m',10
dc.b "Original length:"
Orlend:

Plen:   
dc.b "Packed length:"
Pend:

Gained:
dc.b "Bytes gain:"
Gend:

Save:
dc.b 10
dc.b "Filename to save: "
Savend:
	 
Offset:     
dc.b "Crunch depth (1-9): "
Offend:

Loc:
dc.b "Locate at $"
Lend:

Jump:
dc.b "Jump to $"
Jend:

Pr:
dc.b $0c,27,"[32m"
dc.b "BLACK & DECKER v2.1 - Coded by Filippetto of Savage"
dc.b 27,"[0m",10,10
Prend:

Chefai:
dc.b "Restart cruncher (y/n)? "
Chend:

Runnow:
dc.b "Run now (y/n)? "
Runend:

Saveagain:
dc.b "Save again (y/n)? "
Sagend:

Soundorflash:
dc.b "Sound cruncher or flash cruncher (s/f)? "
Souend:

Dtype:
dc.b $c
dc.b 10,27,"[32m"
dc.b "Choose decruncher:",27,"[0m",10
dc.b "[F1] Byte Killer   [F2] Tnm           [F3] Eor",10
dc.b "[F4] And           [F5] Or",10
Dend:

Dtype2:
dc.b 10,27,"[32m"
dc.b "Choose register:",27,"[0m",10
dc.b "[F1] Background    [F2] Color1        [F3] Color2",10
dc.b "[F4] Color3        [F5] Delay         [F6] Modulo",10
dc.b "[F7] Mouse pointer [F8] None",10
Dend2:

Contact:
dc.b 10
dc.b "Contact us:",10
dc.b "Savage - P.O. Box 46 - 8607 Kapfenberg - Austria",10
dc.b "Filippo Rizzi - Via Vescovado 39 - 35100 Padova - Italy",10
dc.b "Giuliano Galea - Via Zenson di Piave 2/B - 31100 Treviso - "
dc.b "Italy",10
Coend:

Kidding:
dc.b "This program contains hunks! Sorry, can't crunch it!",10
Kiddend:

Confirm:
dc.b "Confirm choice (y/n)? "
Confend:

Allocerr:
dc.b "Sorry, can't allocate!",10
Alend:

Loaderr:
dc.b "Sorry, can't load!",10
Loaderrend:

Saverr:
dc.b "Sorry, can't save!",10
Saveerrend:

Msg:
Workie:dc "           ",10
em:
