home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Cruncher / RRR-DR0.LHA / dR0 / Asm / zerø!packer!v0.4.S < prev    next >
Encoding:
Text File  |  1995-03-20  |  2.2 KB  |  98 lines

  1.  
  2. *******************************************************************************
  3. *
  4. *         !a little data-packer før thøse whø can't dø their!
  5. *         !øwn packer ør whø just need a simple øne!
  6. *            !this uncanny versiøn can!
  7. *        !pack -belive ør nøt- ønly zerøes(!!!!!!!!)!
  8. *
  9. *          VER: zerø-packer v0.1  by teuvo tursas (29/08/1993)
  10. *          VER: zerø-packer v0.2  by teuvo tursas (23/10/1993)
  11. *          VER: zerø-packer v0.3  by teuvo tursas (02/04/1993)
  12. *          VER: zerø-packer v0.31 by teuvo tursas (24/02/1995)
  13. *         $VER: zerø-packer v0.4  by teuvo tursas (25/02/1995)
  14. *
  15. *        v0.1    -    started frøm a scratch
  16. *        v0.2    -    nøw writes file's lenght intø packet
  17. *        v0.3    -    works with unpacker v0.3
  18. *        v0.31    -    løts øf little øptimizatiøns
  19. *        v0.4    -    writes the øriginal lenght alsø
  20. *
  21. *            a5 - pointer to original file
  22. *               a6 - pointer to packet's area
  23. *
  24. *******************************************************************************
  25.  
  26. testoptions:    move.l    a5,a0
  27.         move.l    #filelenght,d0
  28.         sub.b    d1,d1
  29.         sub.l    d6,d6            ;Zeros.
  30.         sub.l    d7,d7            ;AddBytes.
  31.  
  32. headersearch:    move.b    (a0)+,d2
  33.         cmp.b    d1,d2
  34.         beq.s    addoneandagain
  35.         subq.l    #1,d0
  36.         bne.s    headersearch
  37.         move.b    d1,d5            ;Header found.
  38.         bra.b    writeheader
  39.  
  40. addoneandagain:    cmp.b    #$ff,d1
  41.         beq.w    headeroverflow
  42.         addq.b    #1,d1
  43.         move.l    #filelenght,d0
  44.         move.l    a5,a0
  45.         bra.b    headersearch
  46.  
  47. writeheader:    move.l    a6,a0
  48.  
  49. writelenght:    move.l    #0,(a0)+        ;Nulls here, because in the
  50.         move.l    #filelenght,(a0)+    ;end we put the real values
  51.         move.b    d5,(a0)+        ;to the beginning of the packet
  52.         move.l    #4+4+1,d7        ;lenght of header and lenghts.
  53.  
  54. beginning:    move.l    a5,a1
  55.         move.l    #filelenght,d0
  56.  
  57. packloop:    move.b    (a1)+,d2
  58.         beq.s    zerobytefound
  59.         move.b    d2,(a0)+
  60.         addq.l    #1,d7
  61.         subq.l    #1,d0
  62.         beq.s    quit
  63.         bra.b    packloop
  64.  
  65. zerobytefound:    addq.l    #1,d6
  66.         move.b    d5,(a0)+
  67.         addq.l    #1,d7
  68.         subq.l    #1,d0
  69.         beq.s    endoffile
  70.  
  71. searchloop:    tst.l    d0
  72.         beq.s    endoffile
  73.         subq.l    #1,d0
  74.         move.b    (a1)+,d2
  75.         bne.s    notzero
  76.         addq.l    #1,d6
  77.         bra.b    searchloop
  78.  
  79. notzero:    move.l    d6,d4
  80.         move.l    d4,(a0)+
  81.         addq.l    #4,d7
  82.         sub.l    d6,d6
  83.         move.b    d2,(a0)+
  84.         addq.l    #1,d7
  85.         bra.w    packloop
  86.  
  87. endoffile:    move.l    d6,d4
  88.         move.l    d4,(a0)+
  89.         addq.l    #4,d7
  90.  
  91. quit:        move.l    a6,a0
  92.         move.l    d7,(a0)+        ;Here we put it!
  93.         sub.l    d0,d0
  94.         rts
  95.  
  96. headeroverflow:    moveq.l    #1,d0                   ;Error!
  97.         rts
  98.