(t
(ez-mem-set-word (+ prop-addr 1) value)))))
+(defun ez-get-obj-attr (obj attr)
+ (let* ((byte-num (/ attr 8))
+ (bit-num (mod attr 8))
+ (bit-mask (lsh 1 (- 7 bit-num))))
+ (if (> (logand bit-mask (ez-mem-ref-byte (+ (ez-get-obj-addr obj) byte-num))) 0)
+ 1
+ 0)))
+
+(defun ez-set-obj-attr (obj attr val)
+ (let* ((byte-num (/ attr 8))
+ (bit-num (mod attr 8))
+ (bit-mask (lsh 1 (- 7 bit-num)))
+ (byte-addr (+ (ez-get-obj-addr obj) byte-num))
+ (byte (ez-mem-ref-byte byte-addr))
+ (current-set (> (logand bit-mask byte) 0)))
+ (if (or (and current-set (= val 0))
+ (and (not current-set) (> val 0)))
+ (ez-mem-set-byte byte-addr (logxor byte bit-mask)))))
+
;; Z-strings
(defvar ez-zstring-alphabets
operand-types '(w)))
((<= #xB0 opbyte #xBF)
(setq optype '0op
- opcode (- opbyte #xb0)))
+ opcode (- opbyte #xb0)
+ operands '()
+ operand-types '()))
((<= #xC0 opbyte #xDF)
(error "Unsupported op %x" opbyte))
((<= #xE0 opbyte #xFF)
(error "Unsupported op PC:%x Optype:%s Opcode:%x Operands:%s Operand-types:%s"
instr-pc optype opcode operands operand-types))
(let ((mnemonic (elt table-row 1)))
- (message "PC:%x Optype:%s Opcode:%x Mnemonic:%s Operands:%s"
- instr-pc optype opcode mnemonic operands))
+ (message "PC:%x Optype:%s Opcode:%x Mnemonic:%s Operands:%s Operand-types:%s"
+ instr-pc optype opcode mnemonic operands operand-types))
(funcall (elt table-row 2) operands operand-types))))
(defun ez-read-var-operands-and-inc ()
(let ((type4 (logand #b11)))
(if (= type4 #b11)
nil
- (list type4)))))))))))))
- (operands nil))
+ (list type4))))))))))))))
(cons
(mapcar
(lambda (type)