anchor.diff:  ;;;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   ;;;; DEALINGS IN THE SOFTWARE.
   
  -; State
  +;;; Program settings
  +
  +(defparameter *disasm* nil "Whether to disassemble")
  +
  +;;; State variables
  +
   (defparameter *ram* (make-array (* 64 1024) :initial-element 0 :element-type '(unsigned-byte 8)) "Primary segment")
   (defparameter *stack* (make-array (* 64 1024) :initial-element 0 :element-type '(unsigned-byte 8)) "Stack segment")
  -(defparameter *flags* '(:cf nil :sf nil :zf nil) "Flags")
  +(defparameter *flags* '(:cf 0 :sf 0 :zf 0) "Flags")
   (defparameter *registers* '(:ax 0 :bx 0 :cx 0 :dx 0 :bp 0 :sp #x100 :si 0 :di 0 :ip 0) "Registers")
   
  -; Constants
  +;;; Constants
  +
   (defconstant +byte-register-to-word+ '(:al (:ax nil) :ah (:ax t) :bl (:bx nil) :bh (:bx t) :cl (:cx nil) :ch (:cx t) :dl (:dx nil) :dh (:dx t)) "Mapping from byte registers to word registers")
   (defconstant +bits-to-register+ '(:ax :cx :dx :bx :sp :bp :si :di) "Mapping from index to word register")
   (defconstant +bits-to-byte-register+ '(:al :cl :dl :bl :ah :ch :dh :bh) "Mapping from index to byte register")
   
  -; Constant mappings
  +;;; Constant mappings
   
   (defun bits->word-reg (bits)
     (elt +bits-to-register+ bits))
  
positive.code: (defun bits->byte-reg (bits)
    (elt +bits-to-byte-register+ bits))
  
  ; setf-able locations
  
  (defun register (reg)
    (getf *registers* reg))
  
negative.code: 
  (defsetf byte-register set-byte-reg)
  
  (defun flag (name)
    (getf *flags* name))
  
  (defun set-flag (name value)
    (setf (getf *flags* name) value))
  
  (defsetf flag set-flag)
  
  (defun flag-p (name)
    (= (flag name) 1))
  
  (defun set-flag-p (name is-set)
    (setf (flag name) (if is-set 1 0)))
  
  (defsetf flag-p set-flag-p)
  
  ;;; Convenience functions
  
  (defun reverse-little-endian (low high)
    "Reverse a little-endian number."
    (+ low (ash high 8)))
  
  ;;; Instruction loader
  
  (defun next-instruction ()
    (incf (register :ip))
    (elt *ram* (1- (register :ip))))
  
  (defun load-instructions (instrs)
    (setf (register :ip) 0)
    (setf (subseq *ram* 0 #x7fff) instrs))
  
  ;;; Memory access
  
  (defun read-word-from-ram (loc &optional (segment *ram*))
    "Read a word from a RAM segment."
  