anchor.diff:  ;;; Flag effects
   
   (defun set-cf-on-add (value is-word)
  -  (setf (flag-p :cf) (if is-word (>= (/ value #x10000) 1) (>= (/ value #x100) 1)))
  +  (setf (flag-p :cf) (if is-word (>= value #x10000) (>= value #x100)))
     (wrap-overflow value is-word))
   
   (defun set-cf-on-sub (value1 value2)
  
positive.code:   (+ low (ash high 8)))
  
  (defun wrap-overflow (value is-word)
    (if is-word (mod value #x10000) (mod value #x100)))
  
  ;;; Instruction loader
  
  (defun load-instructions (instrs)
    (setf (register :ip) 0)
    (setf (subseq *ram* 0 #x7fff) instrs))
  
  (defun next-instruction ()
    (incf (register :ip))
  
negative.code:     ((= opcode #xf8) (clear-carry-flag))
      ((= opcode #xf9) (set-carry-flag))))
  
  ;;; Main functions
  
  (defun execute-instructions ()
    "Loop through loaded instructions."
    (loop
       for ret = (parse-opcode (next-instruction))
       until (equal ret '("hlt"))
       finally (return t)))
  
  (defun disasm-instructions (instr-length)
    "Disassemble code."
    (loop
       for ret = (parse-opcode (next-instruction))
       collecting ret into disasm
       until (= (register :ip) instr-length)
       finally (return disasm)))
  
  (defun loop-instructions (instr-length)
    (if *disasm*
        (disasm-instructions instr-length)
        (execute-instructions)))
  
  (defun load-instructions-from-file (file)
    (format t "~a" file) ; Placeholder
    #())
  
  (defun load-instructions (&key (file nil))
    (if file
        (load-instructions-from-file file)
        *test-instructions*))
  
  (defun main (&key (disasm nil) (file nil))
    (setf *disasm* disasm)
    (loop-instructions (load-instructions-into-ram (load-instructions :file file))))
  
  ;;; Test instructions
  
  (defparameter *test-instructions* #(#x40 #x40 #x40 #x91 #xb0 #xff #x50 #x5a #x52 #x51 #x48 #xbe #x02 #x03 #xf4) "Test instructions")
  