home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / A / ARC20.ARC / ARCMACS.ARC / UNSQUEEZ.MAC < prev   
Text File  |  1989-11-07  |  1KB  |  82 lines

  1. ; UNSQUEEZE for Turbo-ARC, TR 071189
  2.     .z80
  3.     extrn    siz,crypt,getc_decsiz,source,node
  4.     extrn    putc_ncr,dest,notspeof
  5.  
  6.     ld    ix,siz        ; point to global size
  7.     xor    a        ; A=bitpos
  8. loop:    bit    7,(ix+3)
  9.     jr    nz,exit        ; SIZ negative: exit
  10.     ld    de,0
  11. inloop:    or    a
  12.     jr    nz,noread
  13.     push    af
  14.     push    de
  15.     push    ix
  16.     ld    de,(source)
  17.     push    de
  18.     call    getc_decsiz
  19.     push    hl
  20.     call    crypt
  21.     ld    c,l        ; C = crypt(getc_decsiz(source))
  22.     pop    ix
  23.     pop    de
  24.     pop    af
  25. noread:    ld    hl,(node)
  26.     srl    c
  27.     jr    nc,noinc
  28.     inc    hl
  29.     inc    hl
  30. noinc:    add    hl,de
  31.     add    hl,de
  32.     add    hl,de
  33.     add    hl,de
  34.     ld    e,(hl)
  35.     inc    hl
  36.     ld    d,(hl)        ; i:=node(i,curin and 1)
  37.     inc    a
  38.     and    7
  39.     bit    7,d
  40.     jr    z,inloop    ; until i<0
  41.     ld    hl,notspeof
  42.     sbc    hl,de
  43.     jr    z,eof
  44.     push    af
  45.     push    bc
  46.     push    ix
  47.     ld    hl,(dest)
  48.     push    hl
  49.     ld    a,e
  50.     cpl
  51.     ld    e,a
  52.     ld    d,0
  53.     push    de
  54.     call    putc_ncr    ; putc_ncr(dest,not i);
  55.     pop    ix
  56.     pop    bc
  57.     pop    af
  58.     jr    loop
  59.  
  60. eof:    bit    7,(ix+3)    ; siz < 0 ?
  61.     jr    nz,exit
  62.     ld    hl,(source)
  63.     push    hl
  64.     call    getc_decsiz
  65.     jr    eof        ; read until siz negative
  66.  
  67. exit:
  68.  
  69.     end
  70.  
  71.   bitpos:=0;
  72.   while siz.hi>-1 do begin
  73.     i:=0;
  74.     repeat
  75.       if bitpos=0 then curin:=crypt(getc_decsiz(source));
  76.       i:=node^[i,curin and 1];
  77.       curin:=curin shr 1;
  78.       bitpos:=succ(bitpos) and 7;
  79.     until i<0;
  80.     if i<>notspeof then putc_ncr(dest,not i);
  81.     end;
  82.