Apple ii Battery Charger User Manual


 
from the memory location whose address now resides in Rn. Rn is
again decremented by 1 and the low-order ACC byte is loaded from
the corresponding memory location. Branch conditions reflect the
final ACC contents. The carry is cleared. Because Rn is
decremented prior to loading each of the ACC halves, double-byte
stacks may be implemented with the STD @Rn and POPD @Rn ops
(Rn is the stack pointer).
EXAMPLE:
15 34 A0 SET R5 $A034 ;Init stack pointer
10 12 AA SET R0 $AA12 ;Load $AA12 into ACC
75 STD @R5 ;Push $AA12 onto stack
10 34 BB SET R0 $BB34 ;Load $BB34 into ACC
75 STD @R5 ;Push $BB34 onto stack
C5 POPD @R5 ;Pop $BB34 off stack
C5 POPD @R5 ;Pop $AA12 off stack
COMPARE:
CPR Rn [ Dn ]
The ACC (R0) contents are compared to Rn by performing the 16
bit binary subtraction ACC-Rn and storing the low order 16
difference bits in R13 for subsequent branch tests. If the 16
bit unsigned ACC contents are greater than or equal to the 16
bit unsigned Rn contents, then the carry is set, otherwise it
is cleared. No other registers, including ACC and Rn, are
disturbed.
EXAMPLE:
15 34 A0 SET R5 $A034 ;Pointer to memory
16 BF A0 SET R6 $A0BF ;Limit address
B0 LOOP1 SUB R0 ;Zero data
75 STD @R5 ;clear 2 locations
;increment R5 by 2
25 LD R5 ;Compare pointer R5
D6 CPR R6 ;to limit R6
02 FA BNC LOOP1 ;loop if C clear
INCREMENT:
INR Rn [ En ]
The contents of Rn are incremented by 1. The carry is cleared
and other branch conditions reflect the incremented value.
EXAMPLE:
15 34 A0 SET R5 $A034 ;(Pointer)
B0 SUB R0 ;Zero to R0
55 ST @R5 ;Clr Location $A034
E5 INR R5 ;Incr R5 to $A036
55 ST @R5 ;Clrs location $A036
;(not $A035)