Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Fixed jmp label(pc) opcode decoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Kononovich committed Nov 21, 2018
1 parent d280a67 commit ab5964e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
25 changes: 14 additions & 11 deletions Gensida/ida/ida_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ static int idaapi hook_idp(void *user_data, int notification_code, va_list va)
(op.addr >= 0xC00020 && op.addr <= 0xC0003F)) // VDP mirrors
op.addr &= 0xC000FF;

if ((cmd.itype != 0x76 && cmd.itype != 0x75) || op.n != 0 ||
if ((cmd.itype != 0x76 && cmd.itype != 0x75 && cmd.itype != 0x74) || op.n != 0 ||
(op.phrase != 0x09 && op.phrase != 0x0A) ||
(op.addr == 0 || op.addr > MAX_ROM_SIZE) ||
op.specflag1 != 2) // lea table(pc),Ax; jsr func(pc)
op.specflag1 != 2) // lea table(pc),Ax; jsr func(pc); jmp label(pc)
break;

short diff = op.addr - value;
Expand Down Expand Up @@ -321,24 +321,27 @@ static int idaapi hook_idp(void *user_data, int notification_code, va_list va)
return 2;
}

if ((cmd.itype == 0x76 || cmd.itype == 0x75) && cmd.Op1.phrase == 0x5B && cmd.Op1.specflag1 == 0x10) // lea table(pc),Ax; jsr func(pc)
if ((cmd.itype == 0x76 || cmd.itype == 0x75 || cmd.itype == 0x74) &&
cmd.Op1.phrase == 0x5B && cmd.Op1.specflag1 == 0x10) // lea table(pc),Ax; jsr func(pc); jmp label(pc)
{
short diff = cmd.Op1.addr - cmd.ea;
if (diff >= SHRT_MIN && diff <= SHRT_MAX)
{
ua_add_dref(cmd.Op1.offb, cmd.Op1.addr, dr_O);
ua_add_cref(0, cmd.ea + cmd.size, fl_F);

if (cmd.itype != 0x74)
ua_add_cref(0, cmd.ea + cmd.size, fl_F);

return 2;
}
}

if (cmd.itype != M68K_linea && cmd.itype != M68K_linef)
break;

ua_add_cref(0, cmd.Op1.addr, fl_CN);
ua_add_cref(cmd.Op1.offb, cmd.ea + cmd.size, fl_F);

return 2;
if (cmd.itype == M68K_linea || cmd.itype == M68K_linef)
{
ua_add_cref(0, cmd.Op1.addr, fl_CN);
ua_add_cref(cmd.Op1.offb, cmd.ea + cmd.size, fl_F);
return 2;
}
} break;
case processor_t::idp_notify::custom_mnem:
{
Expand Down
2 changes: 1 addition & 1 deletion Gensida/ida/ida_plugin.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#define NAME "GensIDA"
#define VERSION "1.21"
#define VERSION "1.22"
2 changes: 1 addition & 1 deletion smd_loader/smd_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

#define VERSION "1.21"
#define VERSION "1.22"
/*
* SEGA MEGA DRIVE/GENESIS ROMs Loader (Modified/Updated HardwareMan's source)
* Author: Dr. MefistO [Lab 313] <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion z80_loader/z80_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

#define VERSION "1.21"
#define VERSION "1.22"
/*
* SEGA MEGA DRIVE/GENESIS Z80 Drivers Loader
* Author: Dr. MefistO [Lab 313] <[email protected]>
Expand Down

0 comments on commit ab5964e

Please sign in to comment.