23 lines
292 B
Plaintext
23 lines
292 B
Plaintext
myVar equ $20
|
|
|
|
LDA #3
|
|
STA myVar
|
|
LDA #0
|
|
STA myVar+1 ;equivalent C: uint16_t myVar = 3;
|
|
|
|
negate:
|
|
LDA myVar+1
|
|
EOR #255
|
|
STA myVar+1
|
|
|
|
LDA myVar
|
|
EOR #255
|
|
STA myVar
|
|
CLC
|
|
ADC #1
|
|
STA myVar
|
|
;this handles the case if we started with something where the low byte was zero.
|
|
LDA myVar+1
|
|
ADC #0
|
|
STA myVar+1
|