home *** CD-ROM | disk | FTP | other *** search
-
- *******************************************************************************
- *
- * !a little data-packer før thøse whø can't dø their!
- * !øwn packer ør whø just need a simple øne!
- * !this uncanny versiøn can!
- * !pack -belive ør nøt- ønly zerøes(!!!!!!!!)!
- *
- * VER: zerø-packer v0.1 by teuvo tursas (29/08/1993)
- * VER: zerø-packer v0.2 by teuvo tursas (23/10/1993)
- * VER: zerø-packer v0.3 by teuvo tursas (02/04/1993)
- * VER: zerø-packer v0.31 by teuvo tursas (24/02/1995)
- * $VER: zerø-packer v0.4 by teuvo tursas (25/02/1995)
- *
- * v0.1 - started frøm a scratch
- * v0.2 - nøw writes file's lenght intø packet
- * v0.3 - works with unpacker v0.3
- * v0.31 - løts øf little øptimizatiøns
- * v0.4 - writes the øriginal lenght alsø
- *
- * a5 - pointer to original file
- * a6 - pointer to packet's area
- *
- *******************************************************************************
-
- testoptions: move.l a5,a0
- move.l #filelenght,d0
- sub.b d1,d1
- sub.l d6,d6 ;Zeros.
- sub.l d7,d7 ;AddBytes.
-
- headersearch: move.b (a0)+,d2
- cmp.b d1,d2
- beq.s addoneandagain
- subq.l #1,d0
- bne.s headersearch
- move.b d1,d5 ;Header found.
- bra.b writeheader
-
- addoneandagain: cmp.b #$ff,d1
- beq.w headeroverflow
- addq.b #1,d1
- move.l #filelenght,d0
- move.l a5,a0
- bra.b headersearch
-
- writeheader: move.l a6,a0
-
- writelenght: move.l #0,(a0)+ ;Nulls here, because in the
- move.l #filelenght,(a0)+ ;end we put the real values
- move.b d5,(a0)+ ;to the beginning of the packet
- move.l #4+4+1,d7 ;lenght of header and lenghts.
-
- beginning: move.l a5,a1
- move.l #filelenght,d0
-
- packloop: move.b (a1)+,d2
- beq.s zerobytefound
- move.b d2,(a0)+
- addq.l #1,d7
- subq.l #1,d0
- beq.s quit
- bra.b packloop
-
- zerobytefound: addq.l #1,d6
- move.b d5,(a0)+
- addq.l #1,d7
- subq.l #1,d0
- beq.s endoffile
-
- searchloop: tst.l d0
- beq.s endoffile
- subq.l #1,d0
- move.b (a1)+,d2
- bne.s notzero
- addq.l #1,d6
- bra.b searchloop
-
- notzero: move.l d6,d4
- move.l d4,(a0)+
- addq.l #4,d7
- sub.l d6,d6
- move.b d2,(a0)+
- addq.l #1,d7
- bra.w packloop
-
- endoffile: move.l d6,d4
- move.l d4,(a0)+
- addq.l #4,d7
-
- quit: move.l a6,a0
- move.l d7,(a0)+ ;Here we put it!
- sub.l d0,d0
- rts
-
- headeroverflow: moveq.l #1,d0 ;Error!
- rts
-