dword.inc

Summary
dword.inc
32 bits (Double Word) value manipulation macros.
stdwzSet stated memory location to zero.
stdwStore 32 bits value at stated memory location.
adcdwAdd 32 bits value plus carry to value at stated memory location.
adddwAdd 32 bits value to value at stated memory location.
sbcdwSubstract 32 bits value plus carry from value at stated memory location.
subdwSubstract 32 bits value plus carry from value at stated memory location.
incdwIncrement a 32 bits value at stated memory location.
decdwDecrement a 32 bits value at stated memory location.
roldwLeft rotate 32 bits value.
asldwLeft shift 32 bits value.
rordwRight rotate 32 bits value.
lsrdwRight shift 32 bits value.
negdwNegate 32 bits value.
phdwPush 32 bits value onto the stack.
pldwPull 32 bits value from the stack.

32 bits (Double Word) value manipulation macros.

stdwz

Set stated memory location to zero.

Assembly call

stdwz op

Parameter

opOutput memory location

Restrictions

opAddressing modes must be either Zero Page or Absolute.

stdw

Store 32 bits value at stated memory location.

Assembly call

stdw p0, p1

Parameters

p0Input data.
p1Output memory location.

Restrictions

p0Zero Page, Absolute or Immediate.
p1Zero Page or Absolute.

adcdw

Add 32 bits value plus carry to value at stated memory location.  Depending on the number of arguments, the addition is performed in place or the result is stored in the memory location specified in the third argument.

Assembly call

adcdw p0, p1
adcdw p0, p1, p2

Parameters

p0First operand.
p1Second operand.
p2(Optional) Output memory location.

Restrictions

p0Zero Page, Absolute or Immediate.
p1Zero Page, Absolute or Immediate if the 3rd argument is set.
p2Zero Page or Absolute

Examples

The following bits of code adds $0badcafe to the 32 bits value stored in RAM at $2220 to $2223 and stores the result at the same memory location.

adcw #$0badcafe, $2200

This is equivalent in pseudo-code to:

$2200 += #$0badcafe

The next example adds 16300 and 200524 and stores the result into a 32 bits value stored in zero page.

adcdw #16300, #200524, <_out

The corresponding pseudo-code is:

<_out = #200524 + #16300

adddw

Add 32 bits value to value at stated memory location.

Description

This is equivalent to call the clc instruction followed by the adcdw macro.

See Also

adcdw

sbcdw

Substract 32 bits value plus carry from value at stated memory location.  Depending on the number of arguments, the substraction is performed in place or the result is stored in the memory location specified in the third argument.

Assembly call

sbcdw p0, p1
sbcdw p0, p1, p2

Parameters

p0First operand.
p1Second operand.
p2(Optional) Output memory location.

Restrictions

p0Zero Page, Absolute or Immediate.
p1Zero Page, Absolute or Immediate if the 3rd argument is set.
p2Zero Page or Absolute.

Examples

Substract $0badcafe to the 32 bits value stored in RAM at $2220 to $2223, and stores the result at the same memory location.

sbcdw #$0badcafe, $2200

Or to put it in pseudo-code:

$2200 -= #$0badcafe

Substract 16300 from 200524 and stores the result into a 32 bits value stored in zero page.

sbcdw #16300, #200524, <_out

Which givec in C pseudo-code:

<_out = #200524 - #16300

subdw

Substract 32 bits value plus carry from value at stated memory location.  This is equivalent to call the sec instruction followed by the sbcdw macro.

See Also

sbcdw

incdw

Increment a 32 bits value at stated memory location.

Assembly call

incdw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute

decdw

Decrement a 32 bits value at stated memory location.

Assembly call

decdw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

roldw

Left rotate 32 bits value.

Assembly call

roldw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

asldw

Left shift 32 bits value.

Assembly call

asldw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

rordw

Right rotate 32 bits value.

Assembly call

rordw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

lsrdw

Right shift 32 bits value.

Assembly call

lsrdw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

negdw

Negate 32 bits value.

Assembly call

negdw p0

Parameter

p0Memory location.

Restrictions

p0Zero Page or Absolute.

phdw

Push 32 bits value onto the stack.

Assembly call

phdw p0

Parameter

p0Value.

Restrictions

p0Zero Page, Absolute or Immediate.

pldw

Pull 32 bits value from the stack.

Assembly call

pldw p0

Parameter

p0Value.

Restrictions

p0Zero Page or Absolute.
Add 32 bits value plus carry to value at stated memory location.
Substract 32 bits value plus carry from value at stated memory location.
Close