Apple II manual Acc, Subtract, POP DOUBLE-BYTE Indirect

Models: II

1 257
Download 257 pages 49.17 Kb
Page 48
Image 48

EXAMPLE:

 

 

 

 

14

34

A0

SET

R4

$A034

;Init pointers

15

22

90

SET

R5

$9022

 

84

 

 

POP

@R4

 

;Move byte from

95

 

 

STP

@R5

 

;$A033 to $9021

84

 

 

POP

@R4

 

;Move byte from

95

 

 

STP

@R5

 

;$A032 to $9020

ADD:

 

 

 

 

 

 

ADD Rn

 

 

 

[ An ]

 

The contents of Rn are added to the contents of ACC (R0), and the low-order 16 bits of the sum restored in ACC. the 17th sum bit becomes the carry and the other branch conditions reflect the final ACC contents.

EXAMPLE:

10

34

76

SET

R0

$7634

;Init R0 (ACC) and

R1

11

27

42

SET

R1

$4227

 

 

 

 

A1

 

 

ADD

R1

 

;Add R1

(sum=B85B,

C clear)

A0

 

 

ADD

R0

 

;Double

ACC

(R0) to $70B6

 

 

 

 

 

 

;with carry

set.

 

SUBTRACT:

SUB Rn

[ Bn ]

The contents of Rn are subtracted from the ACC contents by performing a two's complement addition:

ACC = ACC + Rn + 1

The low order 16 bits of the subtraction are restored in the ACC, the 17th sum bit becomes the carry and other branch conditions reflect the final ACC contents. 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. Rn is not disturbed.

EXAMPLE:

10

34

76

SET

R0

$7634

;Init R0 (ACC)

11

27

42

SET

R1

$4227

;and R1

 

B1

 

 

SUB

R1

 

;subtract R1

 

 

 

 

 

 

 

;(diff=$340D

with c set)

B0

 

 

SUB

R0

 

;clears ACC. (R0)

POP DOUBLE-BYTE INDIRECT:

POPD @Rn

[ Cn ]

Rn is decremented by 1 and the high-order ACC byte is loaded

Page 48
Image 48
Apple II manual Acc, Subtract, POP DOUBLE-BYTE Indirect