Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M68K disassembly displays wrong instruction #30

Open
djipi opened this issue May 15, 2021 · 12 comments
Open

M68K disassembly displays wrong instruction #30

djipi opened this issue May 15, 2021 · 12 comments
Labels
bug legacy Happens also in the original VJ S1

Comments

@djipi
Copy link
Owner

djipi commented May 15, 2021

User reports a display disassembly error but the opcode is correct and correctly executed.
Problem occurs also in the M68K Disassembly Browser, available in the debug Alpine mode.
It is also a legacy issue, occuring in Virtual Jaguar 2.1.2.

  • Source code:
    move.l d0,(a0)+
    move.l d1,(a0)+
    movem.l d0-d1,bmpupdate

  • Disassembly:
    MOVE.L D0, (A0)+
    MOVE.L D1, (A0)+
    MVMLE.L A6-A7, $9108

  • Listing
    8021EC: 20C0 | MOVE.L D0, (A0)+
    8021EE: 20C1 | MOVE.L D1, (A0)+
    8021F0: 48F9 0003 0001 6C28 | MVMLE.L A6-A7, bmpupdate

@djipi djipi added this to the R5 milestone May 15, 2021
@djipi
Copy link
Owner Author

djipi commented May 15, 2021

M68KDisassemble() function in m68kdasm.c is a good start to look at the problem.
Problem has been spoted in the function ShowEA() within case imm1.

Depend the situation HandleMovem(buffer, offset, 1) is correct but for our case it should be 0 instead of 1.

Exemple of correct usage with parameter as 1:
48E7 7880 MVMLE.L D1-D4/A0, -(A7)
48E7 C080 MVMLE.L D0-D1/A0, -(A7)
And as 0:
4CDF 011E MVMEL.L (A7)+, D1-D4/A0
4CDF 0103 MVMEL.L (A7)+, D0-D1/A0

djipi added a commit that referenced this issue May 22, 2021
Comments have been added when looking for an issue.
#30
@djipi djipi removed this from the R5 milestone May 25, 2021
@djipi djipi added the legacy Happens also in the original VJ label Jan 4, 2022
@42Bastian
Copy link

moveq and move sr,dx are also wrong disassembled.

@djipi djipi pinned this issue Mar 31, 2022
@djipi
Copy link
Owner Author

djipi commented Mar 31, 2022

This is good to know, and I guess it occurs also in the original Virtual Jaguar 2.1.2 / 2.1.3.
Could you provide a (small) binary using moveq and move sr,dx? It can help to investigate.

@42Bastian
Copy link

I will make one this evening.

@42Bastian
Copy link

Sorry, to tired. Anyway here the source and cof for the moveq and move ..,sr problem.
disass.zip

@djipi
Copy link
Owner Author

djipi commented Apr 1, 2022

Sorry, to tired. Anyway here the source and cof for the moveq and move ..,sr problem. disass.zip

No problems, thank you for the file. I do not promise a fix but I will look at it for sure.

@42Bastian
Copy link

No problem. Just collecting issues ;-) It is not the most urgent one.

@djipi
Copy link
Owner Author

djipi commented Jul 18, 2022

Looked at the moveq issue and to make it "short", 2 problems arise.

  1. The dasm is looking for .B, .W or .L to handle the move, so moveq will require a specific treatment for the dasm.
    -- The dasm considers the moveq as move.l because it simplify the treatment.
  2. It will require an additional dasm type size to represent the moveq instruction.

It is possible to fix the moveq in the dasm within a cautious approach.
At time of writing, 2 functions needs to be modified: M68KDisassemble & build_insn

@42Bastian
Copy link

Looked into the 68000 folder, wow, this is not an easy change :(

@djipi
Copy link
Owner Author

djipi commented Jul 19, 2022

Looked into the 68000 folder, wow, this is not an easy change :(

VJ's 68000 emulation has been ported from the UAE 68000 cpu core. May be their Amiga emulator got updates since then.

@42Bastian
Copy link

Just checked
https://github.com/tonioni/WinUAE/blob/master/table68k
and I see no chance to merge it unless you want to spend a lot of time testing if nothing is broken.

@djipi
Copy link
Owner Author

djipi commented Jul 20, 2022

James Hammons did the port for the Atari Jaguar many years ago, but unsure if he is still active on the console.

@djipi djipi unpinned this issue Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug legacy Happens also in the original VJ S1
Projects
None yet
Development

No branches or pull requests

2 participants