nonarkitten / pseudo-jit

PJIT is a real-time version of JIT.
Other
65 stars 4 forks source link

Fix stub functions #1

Open nonarkitten opened 2 years ago

nonarkitten commented 2 years ago

Some opcodes like BCD may require the stack (check) and if so, will need to be rewritten.

nonarkitten commented 2 years ago

So yes they do. So right now, BCD opcodes look like this:

        .global opcode_4803
    .syntax unified
    @ NBCD #,D3
opcode_4803:
    push    {lr}
    ldrsb   r0, [r5,#12]
    bl      handle_nbcd
    strb    r0, [r5,#12]
    pop     {pc}

The push and pop are now illegal for PJIT; what we'll have to do is do a plain branch to handle_nbcd and let it write-back the result. This may mean needing a unique handle_nbcd for each addressing mode.

nonarkitten commented 2 years ago

Perhaps something like

opcode_4803:
        add     r1, r5,#12 @ precompure EA write-back
        ldrsb   r0, [r1]
        b       handle_nbcd_ea
nonarkitten commented 2 years ago

Note that this is also used for the division routines.