Skip to content

[6502] Indirect Addressing incorrect #196

@thestr4ng3r

Description

@thestr4ng3r

Example:

[0x00000000]> wx a142b1428113913760
[0x00000000]> af
[0x00000000]> pdf
┌ 9: fcn.0 (int8_t arg_100h, int8_t arg_101h);
│           0x00000000      a142           lda (0x42,x)
│           0x00000002      b142           lda (0x42),y
│           0x00000004      8113           sta (0x13,x)
│           0x00000006      9137           sta (0x37),y
└           0x00000008      60             rts

Expected:

/* r2dec pseudo code output */
/* malloc://512 @ 0x0 */
#include <stdint.h>
 
void fcn_0 () {
    acc = *(*(0x42 + x));
    acc = *((*0x42) + y);
    *(*(0x13 + x)) = acc;
    *((*0x37) + y) = acc;
    return;
}

Actual:

/* r2dec pseudo code output */
/* malloc://512 @ 0x0 */
#include <stdint.h>
 
void fcn_0 () {
    do {
label_0:
        acc = *(0x42);
        acc += x;
    } while (1);
    acc = *((0x42 + y));
    goto label_0;
    *(0x13) = acc;
    acc += x;
    goto label_0;
    *((0x37 + y)) = acc;
    goto label_0;
    return;
    goto label_0;
}

The gotos and the do/while seem wrong too.

pddi: 6502_pddi.json.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions