dword.inc | |
32 bits (Double Word) value manipulation macros. | |
stdwz | Set stated memory location to zero. |
stdw | Store 32 bits value at stated memory location. |
adcdw | Add 32 bits value plus carry to value at stated memory location. |
adddw | Add 32 bits value to value at stated memory location. |
sbcdw | Substract 32 bits value plus carry from value at stated memory location. |
subdw | Substract 32 bits value plus carry from value at stated memory location. |
incdw | Increment a 32 bits value at stated memory location. |
decdw | Decrement a 32 bits value at stated memory location. |
roldw | Left rotate 32 bits value. |
asldw | Left shift 32 bits value. |
rordw | Right rotate 32 bits value. |
lsrdw | Right shift 32 bits value. |
negdw | Negate 32 bits value. |
phdw | Push 32 bits value onto the stack. |
pldw | Pull 32 bits value from the stack. |
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.
adcdw p0, p1 adcdw p0, p1, p2
p0 | First operand. |
p1 | Second operand. |
p2 | (Optional) Output memory location. |
p0 | Zero Page, Absolute or Immediate. |
p1 | Zero Page, Absolute or Immediate if the 3rd argument is set. |
p2 | Zero Page or Absolute |
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
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.
sbcdw p0, p1 sbcdw p0, p1, p2
p0 | First operand. |
p1 | Second operand. |
p2 | (Optional) Output memory location. |
p0 | Zero Page, Absolute or Immediate. |
p1 | Zero Page, Absolute or Immediate if the 3rd argument is set. |
p2 | Zero Page or Absolute. |
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