I'm looking for code or help with AVR for this function. Or if not code can I get some clue how to do it?
R20 = (4 * R16 + 3 * R17 - R18) / 8
For now I have something like this:
.org 0x0000
start:
.DEF ANSL = R0
.DEF ANSH = R1
.DEF A = R19
.DEF B = R21
.DEF C = R22
.DEF D = R20
ldi A, 4
ldi B, 3
ldi C, 8
ldi R16, 5
ldi R17, 10
ldi R18, 58
MUL A,R16 (4 * R16)
MUL B,R17 (3 * R17)
add A,B (4 * R16 + 3*R17)
sub A, R18 (4 * R16+3*R17 - R18)
I'm not sure if it's code is correct.