- ((A) ((core-get B-ptr) 'set-A-num!
- (f ((core-get B-ptr) 'A-num) ((core-get A-ptr) 'A-num)) name))
- ((B) ((core-get B-ptr) 'set-B-num!
- (f ((core-get B-ptr) 'B-num) ((core-get A-ptr) 'B-num)) name))
- ((AB) ((core-get B-ptr) 'set-B-num!
- (f ((core-get B-ptr) 'B-num) ((core-get A-ptr) 'A-num)) name))
- ((BA) ((core-get B-ptr) 'set-A-num!
- (f ((core-get B-ptr) 'A-num) ((core-get A-ptr) 'B-num)) name))
- ((F I) ((core-get B-ptr) 'set-A-num!
- (f ((core-get B-ptr) 'A-num) ((core-get A-ptr) 'A-num))) name
- ((core-get B-ptr) 'set-B-num!
- (f ((core-get B-ptr) 'B-num) ((core-get A-ptr) 'B-num)) name))
- ((X) ((core-get B-ptr) 'set-A-num!
- (f ((core-get B-ptr) 'A-num) ((core-get A-ptr) 'B-num)) name)
- ((core-get B-ptr) 'set-B-num!
- (f ((core-get B-ptr) 'B-num) ((core-get A-ptr) 'A-num)) name))))
-
-(define (eval-operand mode num ptr)
+ ((A AB)
+ (if decrement (core ptr 'set! 'A-num (addr+ (core ptr 'A-num) -1) name))
+ (= 0 (core ptr 'A-num)))
+ ((A AB)
+ (if decrement (core ptr 'set! 'B-num (addr+ (core ptr 'B-num) -1) name))
+ (= 0 (core ptr 'B-num)))
+ ((X I F)
+ (if decrement
+ (begin
+ (core ptr 'set! 'A-num (addr+ (core ptr 'A-num) -1) name)
+ (core ptr 'set! 'B-num (addr+ (core ptr 'B-num) -1) name)))
+ (and (= 0 (core ptr 'A-num))
+ (= 0 (core ptr 'B-num))))))
+
+(define (combine-and-store core A-ptr B-ptr modifier name f)
+ (case modifier
+ ((A) (core B-ptr 'set! 'A-num
+ (f (core B-ptr 'A-num) (core A-ptr 'A-num)) name))
+ ((B) (core B-ptr 'set! 'B-num
+ (f (core B-ptr 'B-num) (core A-ptr 'B-num)) name))
+ ((AB) (core B-ptr 'set! 'B-num
+ (f (core B-ptr 'B-num) (core A-ptr 'A-num)) name))
+ ((BA) (core B-ptr 'set! 'A-num
+ (f (core B-ptr 'A-num) (core A-ptr 'B-num)) name))
+ ((F I) (core B-ptr 'set! 'A-num
+ (f (core B-ptr 'A-num) (core A-ptr 'A-num)) name)
+ (core B-ptr 'set! 'B-num
+ (f (core B-ptr 'B-num) (core A-ptr 'B-num)) name))
+ ((X) (core B-ptr 'set! 'A-num
+ (f (core B-ptr 'A-num) (core A-ptr 'B-num)) name)
+ (core B-ptr 'set! 'B-num
+ (f (core B-ptr 'B-num) (core A-ptr 'A-num)) name))))
+
+(define (eval-operand core mode num ptr name)