Calindro / emulicious

8 stars 0 forks source link

Control-flow-dependent code doesn't work well in the debugger #2

Open maxim-zhao opened 2 years ago

maxim-zhao commented 2 years ago

I'm looking at one of the decompressors for Exomizer compression, which uses data to rewrite opcodes depending on whether PC flows into the data byte or jumps into the opcode. For example:

get5    push    hl
        ld      hl, 1
        defb    56
setbit  add     hl, hl
        dec     a
        jr      nz, setbit

In WLA DX form:

get5:
  push hl
    ld hl, 1
.db 56
setbit:
    add hl, hl
    dec a
    jr nz, setbit

Here the 56 converts the opcode to jr c, +$29 which I think is never taken, thereby skipping the add hl,hl in a shorter and faster way than an explicit jump. However in Emulicious' debugger, it seems unable to trace execution when it is at the setbit label and shows this when PC is at setbit: image

Source - compilable but not doing anything meaningful: deexoopt_f3_sms.zip

Calindro commented 1 year ago

Thanks for reporting this. It should be fixed by this month's update. :)