vmcu_registerpair_t - Milo-D/libvmcu-Virtual-MCU-Library GitHub Wiki

Definition

Defined in libvmcu_analyzer.h
typedef struct vmcu_registerpair_t { ... } vmcu_registerpair_t;

Description

vmcu_registerpair_t represents a typical AVR registerpair (Rh:Rl).

typedef struct vmcu_registerpair {            ///< registerpair structure (rh:rl)

    VMCU_REGISTER low;                        ///< low byte register
    VMCU_REGISTER high;                       ///< high byte register

} vmcu_registerpair_t;

Example

#include "libvmcu_analyzer.h" // vmcu_registerpair_t

int main(const int argc, const char **argv) {
   
    vmcu_instr_t instr;

    vmcu_model_t *m328p = vmcu_model_ctor(VMCU_DEVICE_M328P);
    vmcu_disassemble_bytes(0xddf1, &instr, m328p);

    // print registerpair if source operand = RP
    if(instr.src.type == VMCU_OPTYPE_RP) {

        vmcu_registerpair_t *rp = &instr.src.rp;
        printf("r%d:r%d\n", rp->high, rp->low);
    }

    // print registerpair if destination operand = RP
    if(instr.dest.type == VMCU_OPTYPE_RP) {

        vmcu_registerpair_t *rp = &instr.dest.rp;
        printf("r%d:r%d\n", rp->high, rp->low);
    }

    vmcu_model_dtor(m328p);
    return 0;
}

Possible Output

r31:r30
r1:r0