anchor.diff:    (adotimes #x4e
       (write-short o)))
   
  -(defun write-interrecord-gap (o)
  -  (format t "Making interrecord gap...~%")
  -  (adotimes #x1500
  -    (write-short o)))
  -
  -(defun write-interblock-gap (o)
  -  (format t "Making interblock gap...~%")
  -  (adotimes #x4f
  -    (write-short o)))
  -
  -(defun write-sync (o repeated?)
  -  (format t "Making ~Async...~%" (? repeated?
  -                                     "repeated "
  -                                     ""))
  -  (dolist (i '(9 8 7 6 5 4 3 2 1))
  -    (write-byte o (+ (? repeated?
  -                        0
  -                        128)
  -                     i))))
  -
   (defun write-header (o type start end name repeated?)
  -  (when repeated?
  -    (write-interblock-gap o))
     (write-sync o repeated?)
  -  (format t "Making ~Aheader...~%" (? repeated?
  -                                       "repeated "
  -                                       ""))
  +  (format t "Making ~Aheader...~%" (? repeated?  "repeated " ""))
  +  (= *chk* 0)
     (write-byte o type)
  -  (= *chk* 0)
  -  (unless (== 2 type)
  -    (write-byte o (mod start 256))
  -    (write-byte o (>> start 8))
  -    (write-byte o (mod (++ end) 256))
  -    (write-byte o (>> (++ end) 8))
  -    (dolist (i (string-list name))
  -      (write-byte o i))
  -    (dotimes (i (- 187 (length name)))
  -      (write-byte o 32))
  -    (write-byte o *chk*)
  -    (write-eod o)
  -    (when repeated?
  -      (write-trailer o))))
  +  (write-byte o (mod start 256))
  +  (write-byte o (>> start 8))
  +  (write-byte o (mod end 256))
  +  (write-byte o (>> end 8))
  +  (dolist (i (string-list name))
  +    (write-byte o i))
  +  (dotimes (i (- 187 (length name)))
  +    (write-byte o 32))
  +  (write-byte-without-checksumming o *chk*)
  +  (write-eod o))
   
   (defun write-data (o data repeated?)
  -  (? repeated?
  -     (write-interblock-gap o)
  -     (write-interrecord-gap o))
     (write-sync o repeated?)
  -  (format t "Making ~A bytes of ~Adata...~%" (length data)
  -                                              (? repeated?
  -                                                 "repeated "
  -                                                 ""))
  +  (format t "Making ~Adata (~A bytes)...~%"
  +          (? repeated?  "repeated " "")
  +          (length data))
     (= *chk* 0)
     (adolist data
       (write-byte o !))
  -  (write-byte o 0)
  -  (write-byte o *chk*)
  -  (write-eod o)
  -  (when repeated?
  -    (write-trailer o)))
  +  (write-byte-without-checksumming o *chk*)
  +  (write-eod o))
   
   (defun bin2cbmtap (data name &key (type +cbmtype-relocatable+) start)
  -  (with (data    (filter [? (< _ 0)
  -                            (+ 256 _)
  -                            _]
  +  (with (data  (filter [? (< _ 0)
  +                          (+ 256 _)
  +                          _]
                            data)
  -         len     (length data)
  -         end     (-- (+ start len)))
  +         len   (length data)
  +         end   (+ start len))
  +    (format t "CBM file name is ~A.~%" name)
       (format t "CBM file type is ~A.~%" type)
       (format t "Start: $~A, end: $~A~%"
               (print-hexword start nil)
               (print-hexword end nil))
       (let p (make-string-stream)
  +      (write-gap p)
         (write-leader p)
         (write-header p type start end name nil)
  -      (write-header p type start end name t)
  +      (write-interblock-gap p)
  +      (write-header p type start end name :repeated)
  +      (write-trailer p)
  +      (write-gap p)
  +      (write-interrecord-gap p)
         (write-data p data nil)
  -      (write-data p data t)
  +      (write-interblock-gap p)
  +      (write-data p data :repeated)
  +      (write-trailer p)
         (list-string (queue-list (stream-user-detail p))))))
  
positive.code:       (= x (>> x 1)))
      (write-bit o chk)))
  
  (defun write-leader (o)
    (format t "Making leader...~%")
    (adotimes #x6400
      (write-short o)))
  
  (defun write-trailer (o)
  
negative.code: 
  (defun write-pulse (o len)
    (princ (code-char len) o))
  
  (defun write-gap (o)
    (format t "Making empty gap...~%")
    (write-pulse o 0)
    (write-pulse o #x7a)
    (write-pulse o #xfb)
    (write-pulse o #x05))
  
  (defun write-short (o)
    (write-pulse o +short+))
  