So, I'm learning Atmel AVR assembly from Huang's textbook. There is the following example in the book:
// Subtract 10 from mem(0x2000)
ldi XL, 0x00 ; Load mem(0x2000) into X
ldi XH, 0x20 ;
ld r0, X ; Load the value into r0
sbi r0, 10 ; Subtract 10 from r0.
st X, r0 ; Store the result back in mem(0x2000)
Isn't this incorrect? Shouldn't line 4 actually be subi
, not sbi
.
The documentation for sbi
reads:
Description:
Sets a specified bit in an I/O register. This instruction operates on the
lower 32 I/O registers - addresses 0-31.
That doesn't seem at all related to what the example is trying to do. Did I miss something, or should I notify the publisher?