Aldridge1991
Aldridge1991

Reputation: 1367

Aseembly ldi instruction

I'm working on a project which consist on migrating an assembly project into C code. I have quite a lot already done but i came across an instruction which i can't fully understand. It's this one:

ldi ZH, high(V_avgbuf)

where V_avgbuf is a buffer holding 8 x 24-bit V samples. It was defined like this:

V_avgbuf:   .byte   24  ; 8 x 24-bit V samples

My question is, after the exevution of the instruction, which is the content of the ZH register? (ZH is a 8 bit register).

Thanks in advance,

Alex

Upvotes: 0

Views: 619

Answers (1)

Kissiel
Kissiel

Reputation: 1955

Because V_avgbuf is bigger in size than ZH, it has to be split into two parts. High takes the 'upper' part of the address.

High is a macro.

See This for reference.

Upvotes: 1

Related Questions